Mockgun is a testing utility that simulates a ShotGrid instance in memory. ShotGrid MCP Server includes an enhanced version of Mockgun that provides additional functionality and better compatibility with the ShotGrid API.
To use Mockgun, set use_mockgun=True when creating your server:
Copy
from shotgrid_mcp_server import ShotGridMCPServer# Create a server with Mockgunserver = ShotGridMCPServer( name="ShotGrid Test Server", use_mockgun=True)# Now server.connection is a Mockgun instance
server = ShotGridMCPServer( name="ShotGrid Test Server", use_mockgun=True, schema_path="tests/data/schema.bin", entity_schema_path="tests/data/entity_schema.bin")
Mockgun supports “field hopping” (dot notation) in filters:
Copy
# Find shots in a specific sequenceshots = server.connection.find( "Shot", [["sg_sequence.Sequence.code", "is", "SEQ001"]], ["code"])# Find tasks assigned to a specific usertasks = server.connection.find( "Task", [["task_assignees.HumanUser.name", "contains", "Alice"]], ["content"])
Mockgun validates entity types and fields against the schema:
Copy
try: # This will fail if "NonExistentEntity" is not in the schema server.connection.create("NonExistentEntity", {"name": "Test"})except ValueError as e: print(f"Error: {e}")try: # This will fail if "non_existent_field" is not in the schema for Project server.connection.create("Project", {"non_existent_field": "Test"})except ValueError as e: print(f"Error: {e}")