MCP support is experimental. Enable with experimental.mcp configuration.
Model Context Protocol (MCP) servers provide a standardized way to expose tools to AI applications like Claude Desktop, Cursor, and other MCP-compatible clients.
Quick Start
import { Composio } from '@composio/core' ;
const composio = new Composio ({
apiKey: 'your-key' ,
experimental: { mcp: true }
});
const server = await composio . mcp . create ( 'my-server' , {
toolkits: [ 'github' , 'slack' ],
allowedTools: [ 'GITHUB_CREATE_ISSUE' , 'SLACK_SEND_MESSAGE' ]
});
console . log ( 'MCP URL:' , server . MCPUrl );
Creating MCP Servers
create()
async create (
name : string ,
config : MCPConfigCreationParams
): Promise < MCPConfigCreateResponse >
Unique name for the MCP server
config
MCPConfigCreationParams
required
toolkits
string[] | ToolkitConfig[]
required
Toolkits to include
manuallyManageConnections
If true, users connect accounts manually; if false, uses chat-based authentication
Basic Server
With Specific Tools
With Auth Config
Manual Connections
const server = await composio . mcp . create ( 'github-server' , {
toolkits: [ 'github' ]
});
const server = await composio . mcp . create ( 'limited-server' , {
toolkits: [ 'github' ],
allowedTools: [
'GITHUB_GET_REPOS' ,
'GITHUB_CREATE_ISSUE'
]
});
const server = await composio . mcp . create ( 'custom-server' , {
toolkits: [
{
toolkit: 'github' ,
authConfigId: 'auth_config_123'
}
]
});
const server = await composio . mcp . create ( 'manual-server' , {
toolkits: [ 'github' ],
manuallyManageConnections: true // Users connect via dashboard
});
Managing MCP Servers
list()
List all MCP servers:
const servers = await composio . mcp . list ({
page: 1 ,
limit: 10 ,
toolkits: [ 'github' ],
name: 'github'
});
servers . items . forEach ( server => {
console . log ( server . id , server . name , server . MCPUrl );
});
get()
Retrieve a specific server:
const server = await composio . mcp . get ( 'mcp_abc123' );
console . log ( 'Name:' , server . name );
console . log ( 'Tools:' , server . allowedTools );
console . log ( 'Setup commands:' , server . commands );
update()
Update server configuration:
const updated = await composio . mcp . update ( 'mcp_abc123' , {
name: 'Updated Server Name' ,
toolkits: [ 'github' , 'slack' ],
allowedTools: [ 'GITHUB_CREATE_ISSUE' , 'SLACK_SEND_MESSAGE' ]
});
delete()
Delete an MCP server:
await composio . mcp . delete ( 'mcp_abc123' );
Generating User Instances
generate()
Create a user-specific MCP server instance:
const instance = await composio . mcp . generate (
'user_123' ,
'mcp_abc123' ,
{ manuallyManageConnections: false }
);
console . log ( 'User MCP URL:' , instance . url );
console . log ( 'User ID:' , instance . userId );
Client Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers" : {
"composio-github" : {
"command" : "npx" ,
"args" : [
"-y" ,
"@modelcontextprotocol/server-fetch" ,
"https://mcp.composio.dev/mcp/abc123"
],
"env" : {
"x-api-key" : "your-composio-api-key"
}
}
}
}
Cursor
Add to Cursor MCP settings:
{
"mcpServers" : {
"composio" : {
"url" : "https://mcp.composio.dev/mcp/abc123" ,
"headers" : {
"x-api-key" : "your-composio-api-key"
}
}
}
}
Windsurf
Use the setup command from server.commands.windsurf.
Server Response
interface MCPConfigCreateResponse {
id : string ; // Server ID
name : string ; // Server name
MCPUrl : string ; // MCP endpoint URL
allowedTools : string []; // Enabled tools
authConfigIds : string []; // Auth configs
commands : { // Client setup commands
claude : string ;
cursor : string ;
windsurf : string ;
};
generate : ( userId : string ) => Promise < MCPServerInstance >; // Generate user instance
}
Complete Example
import { Composio } from '@composio/core' ;
const composio = new Composio ({
apiKey: process . env . COMPOSIO_API_KEY ! ,
experimental: { mcp: true }
});
async function setupMCPServer () {
// Create MCP server
const server = await composio . mcp . create ( 'github-server' , {
toolkits: [ 'github' ],
allowedTools: [
'GITHUB_GET_REPOS' ,
'GITHUB_CREATE_ISSUE' ,
'GITHUB_LIST_ISSUES'
],
manuallyManageConnections: false // Chat-based auth
});
console . log ( '✅ MCP Server created' );
console . log ( 'ID:' , server . id );
console . log ( 'URL:' , server . MCPUrl );
console . log ( ' \n Setup commands:' );
console . log ( 'Claude:' , server . commands . claude );
console . log ( 'Cursor:' , server . commands . cursor );
// Generate user instance
const instance = await server . generate ( 'user_123' );
console . log ( ' \n User instance:' , instance . url );
return server ;
}
const server = await setupMCPServer ();
Best Practices
Tool Selection : Only include necessary tools
Naming : Use descriptive server names
Auth Management : Choose appropriate connection management
Documentation : Document setup for your users
Updates : Update servers when adding new tools
Limitations
MCP support is experimental
Requires MCP-compatible clients
Some features may not work in all environments
API may change in future versions
Next Steps
Tool Router Alternative approach
Tools API Learn about tools
Connected Accounts Manage connections