ShotGrid MCP Server can be accessed by any client that implements the Model Context Protocol (MCP). This page provides an overview of the available client options and how to connect to your server.
The official MCP Python SDK includes a client that can connect to any MCP server, including ShotGrid MCP Server:
Copy
from mcp.client import Clientasync def main(): # Connect to your ShotGrid MCP 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 a tool result = await client.call_tool("find_projects", {"status": "Active"}) print(f"Active projects: {result}")if __name__ == "__main__": import asyncio asyncio.run(main())
To connect to a ShotGrid MCP Server, you need the server’s URL:
Copy
from mcp.client import Client# Connect to a local serverclient = Client("http://localhost:8000")# Connect to a remote serverclient = Client("https://shotgrid-mcp.example.com")
import anthropicfrom mcp.client import Clientasync def claude_with_mcp(): # Connect to ShotGrid MCP Server mcp_client = Client("http://localhost:8000") # List available tools tools = await mcp_client.list_tools() # Create Claude client claude = anthropic.Anthropic(api_key="your-api-key") # Create a message with tools message = claude.messages.create( model="claude-3-opus-20240229", max_tokens=1000, system="You are a helpful assistant with access to ShotGrid data.", messages=[ {"role": "user", "content": "Find all in-progress shots in the Awesome Film project."} ], tools=tools # Claude can use MCP tools directly ) # Process tool calls for tool_call in message.tool_calls: tool_result = await mcp_client.call_tool( tool_call.name, tool_call.parameters ) # Send the tool result back to Claude message = claude.messages.create( model="claude-3-opus-20240229", max_tokens=1000, system="You are a helpful assistant with access to ShotGrid data.", messages=[ {"role": "user", "content": "Find all in-progress shots in the Awesome Film project."}, {"role": "assistant", "content": message.content, "tool_calls": message.tool_calls}, {"role": "user", "content": "", "tool_results": [ {"tool_call_id": tool_call.id, "result": tool_result} ]} ] ) print(message.content)if __name__ == "__main__": import asyncio asyncio.run(claude_with_mcp())