Server management

Create, update, and manage MCP servers

This guide covers all server management operations for MCP servers.

Create a server

1server = composio.mcp.create(
2 name="my-gmail-server",
3 toolkits=[{
4 "toolkit": "gmail",
5 "auth_config": "ac_xyz123"
6 }],
7 allowed_tools=["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL"]
8)
9
10print(f"Created server: {server.id}")

List servers

Find and filter your MCP servers.

1# List all servers
2servers = composio.mcp.list()
3print(f"Found {len(servers['items'])} servers")
4
5# Filter by toolkit
6gmail_servers = composio.mcp.list(
7 toolkits="gmail",
8 limit=20
9)
10
11# Filter by name
12production_servers = composio.mcp.list(
13 name="production"
14)

Get server details

1# Get by ID
2server = composio.mcp.get("mcp_server_id")
3print(f"Server name: {server.name}")
4print(f"Toolkits: {server.toolkits}")

Update a server

Modify server configuration, tools, or auth configs.

1updated = composio.mcp.update(
2 server_id="mcp_server_id",
3 name="updated-name",
4 allowed_tools=["GMAIL_FETCH_EMAILS", "GMAIL_SEARCH_EMAILS"]
5)

Delete a server

1result = composio.mcp.delete("mcp_server_id")
2if result['deleted']:
3 print("Server deleted successfully")

Multi-toolkit servers

Combine multiple services in a single MCP server.

1server = composio.mcp.create(
2 name="productivity-suite",
3 toolkits=[
4 {"toolkit": "gmail", "auth_config": "ac_gmail"},
5 {"toolkit": "slack", "auth_config": "ac_slack"},
6 {"toolkit": "github", "auth_config": "ac_github"}
7 ],
8 allowed_tools=[
9 "GMAIL_FETCH_EMAILS",
10 "SLACK_SEND_MESSAGE",
11 "GITHUB_CREATE_ISSUE"
12 ]
13)

Generate user URLs

After creating a server, generate unique URLs for each user.

1# Generate instance for user
2instance = server.generate("user@example.com")
3
4print(f"URL: {instance['url']}")
5print(f"Tools: {instance['allowed_tools']}")
6
7# Chat-based authentication is enabled by default
8# Set manually_manage_connections=True to disable it:
9instance_manual = server.generate(
10 "user@example.com",
11 manually_manage_connections=True
12)

Chat-based authentication:

  • TypeScript: Enabled by default (set manuallyManageConnections=false or omit it)
  • Python: Enabled by default (set manually_manage_connections=False or omit it)

When enabled, the agent can authenticate users dynamically during conversation if they’re missing required connections. Set manuallyManageConnections=true (TypeScript) or manually_manage_connections=True (Python) to disable it.

Best practices

  • Use descriptive names - Makes servers easy to find
  • Limit tools appropriately - Only include necessary tools
  • Reuse servers - Don’t create duplicates for same configuration
  • Store server IDs - Keep track of created server IDs