MCP
Deprecated
Use a session's MCP endpoint instead: composio.create(user_id, mcp=True) returns a session that exposes session.mcp.url / session.mcp.headers. MCP is now opt-in per session; this standalone composio.mcp server-management API is kept only for backwards compatibility. Prefer the session MCP endpoint; do not generate new code against composio.mcp. See https://docs.composio.dev/docs/sessions-via-mcp
Methods
create()
Create a new MCP server configuration with specified toolkits and authentication settings.
def create(name: str, toolkits: List[Union[ConfigToolkit, str]], manually_manage_connections: bool = ..., allowed_tools: List[str] | None = ...) -> MCPCreateResponseParameters
| Name | Type | Description |
|---|---|---|
name | str | Unique name for the MCP configuration |
toolkits | List[Union[ConfigToolkit, str]] | List of toolkit configurations. Can be either: - MCPToolkitConfig objects with detailed configuration - Strings representing toolkit names (for simple cases) |
manually_manage_connections? | bool | Whether to manually manage account connections (default: False) |
allowed_tools? | List[str] | None | List of specific tools to enable across all toolkits (default: None for all tools) |
Returns
MCPCreateResponse — Created server details with generate method
Example
# Using toolkit configuration objects with auth
server = composio.mcp.create(
'personal-mcp-server',
toolkits=[
{
'toolkit': 'github',
'auth_config_id': 'ac_xyz',
},
{
'toolkit': 'slack',
'auth_config_id': 'ac_abc',
},
],
allowed_tools=['GITHUB_CREATE_AN_ISSUE', 'GITHUB_LIST_REPOS', 'SLACK_SEND_MESSAGE'],
manually_manage_connections=False
)
# Using simple toolkit names (most common usage)
server = composio.mcp.create(
'simple-mcp-server',
toolkits=['composio_search', 'text_to_pdf'],
allowed_tools=['COMPOSIO_SEARCH_DUCK_DUCK_GO_SEARCH', 'TEXT_TO_PDF_CONVERT_TEXT_TO_PDF']
)
# Using all tools from toolkits (default behavior)
server = composio.mcp.create(
'all-tools-server',
toolkits=['composio_search', 'text_to_pdf']
# allowed_tools=None means all tools from these toolkits
)
# Get server instance for a user
mcp = server.generate('user_12345', None)list()
List MCP servers with optional filtering and pagination.
def list(page_no: int | None = ..., limit: int | None = ..., toolkits: str | None = ..., auth_config_ids: str | None = ..., name: str | None = ..., order_by: Literal['created_at', 'updated_at'] | None = ..., order_direction: Literal['asc', 'desc'] | None = ...) -> MCPListResponseParameters
| Name | Type | Description |
|---|---|---|
page_no? | int | None | Page number for pagination (default: 1) |
limit? | int | None | Maximum items per page (default: 10) |
toolkits? | str | None | Filter by toolkit name (single string) |
auth_config_ids? | str | None | Filter by auth configuration ID (single string) |
name? | str | None | Filter by server name (partial match) |
order_by? | Literal['created_at', 'updated_at'] | None | Order by field ('created_at' or 'updated_at') |
order_direction? | Literal['asc', 'desc'] | None | Order direction ('asc' or 'desc') |
Returns
MCPListResponse — Paginated list of MCP servers
Example
# List all servers
all_servers = composio.mcp.list()
# List with pagination
paged_servers = composio.mcp.list(page_no=2, limit=5)
# Filter by toolkit
github_servers = composio.mcp.list(toolkits='github', name='personal')get()
Retrieve detailed information about a specific MCP server/config.
def get(server_id: str)Parameters
| Name | Type | Description |
|---|---|---|
server_id | str | The unique identifier of the MCP server/config |
Example
server = composio.mcp.get('mcp_12345')
print(server['name']) # "My Personal MCP Server"
print(server['allowed_tools']) # ["GITHUB_CREATE_AN_ISSUE", "SLACK_SEND_MESSAGE"]
print(server['toolkits']) # ["github", "slack"]
print(server['server_instance_count']) # 3update()
Update an existing MCP server configuration.
def update(server_id: str, name: str | None = ..., toolkits: List[Union[ConfigToolkit, str]] | None = ..., manually_manage_connections: bool | None = ..., allowed_tools: List[str] | None = ...)Parameters
| Name | Type | Description |
|---|---|---|
server_id | str | The unique identifier of the MCP server to update |
name? | str | None | Optional new name for the MCP server |
toolkits? | List[Union[ConfigToolkit, str]] | None | Optional list of toolkit configurations (strings or objects) |
manually_manage_connections? | bool | None | Optional flag for connection management |
allowed_tools? | List[str] | None | Optional list of specific tools to enable across all toolkits |
Example
# Update server name only
updated_server = composio.mcp.update(
'mcp_12345',
name='My Updated MCP Server'
)
# Update toolkits and tools
server_with_new_tools = composio.mcp.update(
'mcp_12345',
toolkits=['github', 'slack'],
allowed_tools=['GITHUB_CREATE_AN_ISSUE', 'SLACK_SEND_MESSAGE']
)
# Update with auth configs
server_with_auth = composio.mcp.update(
'mcp_12345',
toolkits=[
{'toolkit': 'github', 'auth_config_id': 'auth_abc123'},
{'toolkit': 'slack', 'auth_config_id': 'auth_def456'}
],
allowed_tools=['GITHUB_CREATE_AN_ISSUE', 'SLACK_SEND_MESSAGE'],
manually_manage_connections=False
)delete()
Permanently delete an MCP server configuration.
def delete(server_id: str) -> Dict[str, Any]Parameters
| Name | Type | Description |
|---|---|---|
server_id | str | The unique identifier of the MCP server to delete |
Returns
Dict[str, Any] — Deletion result
Example
# Delete a server
result = composio.mcp.delete('mcp_12345')
if result['deleted']:
print(f"Server {result['id']} has been successfully deleted")
else:
print(f"Failed to delete server {result['id']}")generate()
Get server URLs for an existing MCP server. This matches the TypeScript implementation exactly.
def generate(user_id: str, mcp_config_id: str, manually_manage_connections: bool | None = ...) -> MCPServerInstanceParameters
| Name | Type | Description |
|---|---|---|
user_id | str | External user ID from your database |
mcp_config_id | str | MCP configuration ID |
manually_manage_connections? | bool | None | Whether to manually manage connections (optional) |
Returns
MCPServerInstance — MCP server instance
Example
mcp = composio.mcp.generate(
'user_12345',
'mcp_67890',
manually_manage_connections=False
)
print(mcp['url']) # Server URL for the user
print(mcp['allowed_tools']) # Available tools