Provider integrations
Connect MCP servers to AI frameworks
Integrate your MCP servers with popular AI SDKs and frameworks.
Composio MCP servers only support Streamable HTTP transport.
Anthropic SDK
Use MCP servers with the Anthropic Claude API.
1 from anthropic import Anthropic 2 from composio import Composio 3 4 # Initialize clients 5 composio = Composio() 6 anthropic = Anthropic(api_key="your-anthropic-api-key") 7 8 # Create MCP server with GitHub and Linear tools 9 server = composio.mcp.create( 10 name="dev-workflow-server", 11 toolkits=[ 12 {"toolkit": "github", "auth_config": "ac_github_id"}, 13 {"toolkit": "linear", "auth_config": "ac_linear_id"} 14 ], 15 allowed_tools=["GITHUB_LIST_PRS", "GITHUB_CREATE_COMMENT", "LINEAR_CREATE_ISSUE"] 16 ) 17 18 # Generate MCP instance for user 19 instance = server.generate("user@example.com") 20 21 # Use MCP with Anthropic to manage development workflow 22 response = anthropic.beta.messages.create( 23 model="claude-sonnet-4-5", 24 system="You are a helpful assistant with access to GitHub and Linear tools. Use these tools to help manage development workflows. Do not ask for confirmation before using the tools.", 25 max_tokens=1000, 26 messages=[{ 27 "role": "user", 28 "content": "Check my GitHub PRs for review comments, create Linear tasks for any requested changes, and update the PR descriptions with task links" 29 }], 30 mcp_servers=[{ 31 "type": "url", 32 "url": instance['url'], 33 "name": "composio-mcp-server" 34 }], 35 betas=["mcp-client-2025-04-04"] # Enable MCP beta 36 ) 37 38 print(response.content)
OpenAI SDK
Integrate MCP servers with OpenAI GPT models.
1 from openai import OpenAI 2 from composio import Composio 3 4 # Initialize clients 5 composio = Composio() 6 openai = OpenAI(api_key="your-openai-api-key") 7 8 # Create MCP server with Google Sheets and Notion tools 9 server = composio.mcp.create( 10 name="data-docs-server", 11 toolkits=[ 12 {"toolkit": "googlesheets", "auth_config": "ac_sheets_id"}, 13 {"toolkit": "notion", "auth_config": "ac_notion_id"} 14 ], 15 allowed_tools=["GOOGLESHEETS_GET_DATA", "GOOGLESHEETS_UPDATE_DATA", "NOTION_CREATE_PAGE"] 16 ) 17 18 # Generate MCP instance for user 19 instance = server.generate("user@example.com") 20 21 # Use MCP with OpenAI for data management 22 response = openai.responses.create( 23 model="gpt-5", 24 tools=[ 25 { 26 "type": "mcp", 27 "server_label": "composio-server", 28 "server_description": "Composio MCP server with Google Sheets and Notion integrations", 29 "server_url": instance['url'], 30 "require_approval": "never", 31 }, 32 ], 33 input="Export the Q4 metrics from Google Sheets and create a comprehensive Notion page with charts and analysis", 34 ) 35 36 print("OpenAI MCP Response:", response.output_text)
Mastra
Use MCP servers with Mastra framework.
TypeScript
1 import { MCPClient } from "@mastra/mcp"; 2 import { openai } from "@ai-sdk/openai"; 3 import { Agent } from "@mastra/core/agent"; 4 import { Composio } from "@composio/core"; 5 6 // Initialize Composio 7 const composio = new Composio(); 8 9 // Create MCP server with GitHub, Linear, and Notion tools 10 const server = await composio.mcp.create( 11 "dev-automation-server", 12 { 13 toolkits: [ 14 { toolkit: "github", authConfigId: "ac_github_id" }, 15 { toolkit: "linear", authConfigId: "ac_linear_id" }, 16 { toolkit: "notion", authConfigId: "ac_notion_id" } 17 ], 18 allowedTools: [ 19 "GITHUB_LIST_ISSUES", "GITHUB_CREATE_ISSUE", 20 "LINEAR_CREATE_ISSUE", "LINEAR_UPDATE_ISSUE", 21 "NOTION_CREATE_PAGE", "NOTION_UPDATE_PAGE" 22 ] 23 } 24 ); 25 26 // Generate MCP instance for user 27 const instance = await server.generate("user@example.com"); 28 29 // Create MCP client with Composio server 30 export const mcpClient = new MCPClient({ 31 id: "composio-mcp-client", 32 servers: { 33 composio: { url: new URL(instance.url) }, 34 } 35 }); 36 37 // Create a development workflow agent 38 export const devAgent = new Agent({ 39 name: "Dev Assistant", 40 description: "AI assistant for development workflow automation", 41 instructions: "Help manage GitHub repos, Linear issues, and Notion documentation.", 42 model: openai("gpt-4-turbo"), 43 tools: await mcpClient.getTools() 44 }); 45 46 // Example: Automate development workflow 47 (async () => { 48 const response = await devAgent.generate( 49 "Review open GitHub issues, create Linear tasks for bugs labeled 'priority', and update the Notion roadmap page" 50 ); 51 console.log(response.text); 52 })();