This guide will help you set up a basic ShotGrid MCP Server and create your first tools. By the end, you’ll have a working server that can interact with ShotGrid data through the MCP protocol.
First, let’s create a simple server that connects to ShotGrid:
Copy
from shotgrid_mcp_server import ShotGridMCPServer# Create a server with your ShotGrid credentialsserver = ShotGridMCPServer( name="ShotGrid Assistant", shotgrid_url="https://your-site.shotgunstudio.com", script_name="your_script_name", api_key="your_api_key")# Run the serverif __name__ == "__main__": server.run(host="localhost", port=8000)
Save this as server.py and run it with python server.py. Your server will start on http://localhost:8000.
For development and testing, you can use Mockgun instead of connecting to a real ShotGrid instance:
Copy
from shotgrid_mcp_server import ShotGridMCPServer# Create a server with Mockgunserver = ShotGridMCPServer( name="ShotGrid Test Server", use_mockgun=True, # This enables Mockgun schema_path="path/to/schema.bin" # Optional: path to a schema file)if __name__ == "__main__": server.run(host="localhost", port=8000)
You can test your server using the built-in MCP client:
Copy
from mcp.client import Clientasync def test_server(): # Connect to your server client = Client("http://localhost:8000") # List available tools tools = await client.list_tools() print(f"Available tools: {[tool.name for tool in tools]}") # Call the find_projects tool result = await client.call_tool("find_projects", {"status": "Active"}) print(f"Active projects: {result}")if __name__ == "__main__": import asyncio asyncio.run(test_server())
Save this as test_client.py and run it with python test_client.py while your server is running.