Understanding the ShotGrid MCP Server architecture
ShotGrid MCP Server is built on the Model Context Protocol (MCP) and provides a standardized way for LLMs to interact with ShotGrid data. This page provides an overview of the server architecture and key components.
ShotGrid MCP Server consists of several key components:
Server: The main ShotGridMCPServer
class that implements the MCP protocol and manages all components.
Connection Pool: Manages connections to the ShotGrid API, providing efficient connection reuse and error handling.
Schema Loader: Loads and caches the ShotGrid schema, which defines entity types, fields, and relationships.
Tool Manager: Registers and manages tools that can be called by MCP clients.
Mockgun Extension: An enhanced version of ShotGrid’s Mockgun for testing without a real ShotGrid instance.
When creating a ShotGridMCPServer
instance, you can configure various aspects of its behavior:
Parameter | Type | Description |
---|---|---|
name | str | Name of the server, shown to clients |
shotgrid_url | str | URL of your ShotGrid instance |
script_name | str | Script name for API authentication |
api_key | str | API key for authentication |
shotgun | Shotgun | Existing Shotgun instance to use |
use_mockgun | bool | Whether to use Mockgun instead of real ShotGrid |
max_connections | int | Maximum number of connections in the pool |
connection_timeout | int | Timeout for ShotGrid API calls (seconds) |
schema_path | str | Path to a cached schema file |
entity_schema_path | str | Path to a cached entity schema file |
on_duplicate_tools | str | How to handle duplicate tool registrations |
ShotGrid MCP Server provides hooks for running code at different points in the server lifecycle:
To start the server, call the run
method:
For more control over the server lifecycle, you can use the async API:
Now that you understand the server architecture, you can: