Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

mcp docs revamp

Sushmithamallesh15ff0d35a113
diff --git a/fern/assets/images/mcp_server_client.png b/fern/assets/images/mcp_server_client.png
deleted file mode 100644
index 6a25b70f2..000000000
Binary files a/fern/assets/images/mcp_server_client.png and /dev/null differ
diff --git a/fern/assets/videos/mcp-claude-oauth.mp4 b/fern/assets/videos/mcp-claude-oauth.mp4
deleted file mode 100644
index 087cd1ee5..000000000
Binary files a/fern/assets/videos/mcp-claude-oauth.mp4 and /dev/null differ
diff --git a/fern/assets/videos/mcp-claude.mp4 b/fern/assets/videos/mcp-claude.mp4
deleted file mode 100644
index 58ea64bfc..000000000
Binary files a/fern/assets/videos/mcp-claude.mp4 and /dev/null differ
diff --git a/fern/assets/videos/mcp-cursor-oauth.mp4 b/fern/assets/videos/mcp-cursor-oauth.mp4
deleted file mode 100644
index 9d560484b..000000000
Binary files a/fern/assets/videos/mcp-cursor-oauth.mp4 and /dev/null differ
diff --git a/fern/assets/videos/mcp-cursor.mp4 b/fern/assets/videos/mcp-cursor.mp4
deleted file mode 100644
index f65c89413..000000000
Binary files a/fern/assets/videos/mcp-cursor.mp4 and /dev/null differ
diff --git a/fern/docs.yml b/fern/docs.yml
index e233967cd..da3b3da2e 100644
--- a/fern/docs.yml
+++ b/fern/docs.yml
@@ -159,18 +159,30 @@ navigation:
icon: server
skip-slug: true
contents:
- - page: Overview
- path: pages/dist/mcp/overview.mdx
- slug: mcp-overview
- - page: Developers
- path: pages/dist/mcp/developers.mdx
- slug: mcp-developers
- - page: Partner Program
- path: pages/dist/mcp/partner-api.mdx
- slug: mcp-partner-api
+ - page: Quickstart
+ path: pages/dist/mcp/quickstart.mdx
+ slug: mcp-quickstart
+ - page: Authentication
+ path: pages/dist/mcp/authentication.mdx
+ slug: mcp-authentication
+ - page: Server management
+ path: pages/dist/mcp/server-management.mdx
+ slug: mcp-server-management
- page: Providers
path: pages/dist/mcp/providers.mdx
slug: mcp-providers
+ - page: Partner Program
+ path: pages/dist/mcp/partner-api.mdx
+ slug: mcp-partner-api
+ - page: Developers (old)
+ path: pages/dist/mcp/developers.mdx
+ slug: mcp-developers-old
+ - page: Introduction (old)
+ path: pages/dist/mcp/introduction.mdx
+ slug: mcp-introduction-old
+ - page: Implementation (old)
+ path: pages/dist/mcp/implementation.mdx
+ slug: mcp-implementation-old
- section: Tool Router (Beta)
icon: tools
skip-slug: true
diff --git a/fern/pages/src/mcp/authentication.mdx b/fern/pages/src/mcp/authentication.mdx
new file mode 100644
index 000000000..98276a9c4
--- /dev/null
+++ b/fern/pages/src/mcp/authentication.mdx
@@ -0,0 +1,169 @@
+---
+title: MCP authentication
+subtitle: Managing user authentication for MCP servers
+---
+
+Before users can access tools through your MCP server, they need to authenticate with the external services.
+
+## Check connection status
+
+Verify if a user has the required connections before generating server URLs.
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+# Python SDK - connection checking coming soon
+# For now, the generate method handles auth automatically
+instance = server.generate("[email protected]")
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+const status = await composio.mcp.getUserConnectionStatus(
+ server.id
+);
+
+if (status.connected) {
+ console.log("✅ All toolkits connected");
+} else {
+ console.log("❌ Missing connections:");
+
+ for (const [toolkit, toolkitStatus] of Object.entries(status.connectedToolkits)) {
+ if (!toolkitStatus.connected) {
+ console.log(`- ${toolkit}: Not connected`);
+ }
+ }
+}
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Authentication flows
+
+### Pre-authentication (Recommended)
+
+Authenticate users before they use the MCP server for a smoother experience.
+
+<CodeGroup>
+<CodeGroupItem title="TypeScript">
+```typescript
+// 1. Check what's needed
+const authParams = await composio.mcp.getConnectionParams(
+ server.id,
+ "gmail"
+);
+
+console.log("Required fields:", authParams.required_fields);
+
+// 2. Start authentication
+const authRequest = await composio.mcp.authorize(
+ server.id,
+ "gmail"
+);
+
+if (authRequest.redirectUrl) {
+ // 3. Send user to authenticate
+ console.log("Authenticate here:", authRequest.redirectUrl);
+
+ // 4. After completion, verify
+ const status = await composio.mcp.getUserConnectionStatus(
+ server.id
+ );
+
+ if (status.connected) {
+ console.log("✅ Ready to generate URLs");
+ }
+}
+```
+</CodeGroupItem>
+</CodeGroup>
+
+### Chat-based authentication
+
+Let the AI agent guide users through authentication when needed.
+
+```typescript
+// Enable chat auth when creating the server
+const server = await composio.mcp.create(
+ "assistant-server",
+ [{ authConfigId: "ac_xyz", allowedTools: ["GMAIL_FETCH_EMAILS"] }],
+ { isChatAuth: true } // Agent handles auth prompts
+);
+
+// Generate URLs directly - agent will handle missing auth
+const urls = await composio.mcp.getServer(
+ server.id,
+);
+```
+
+## Auth config setup
+
+Auth configs define how users authenticate with external services. Create them in the [Composio dashboard](https://platform.composio.dev).
+
+### Types of auth
+
+- **OAuth** - Redirect-based flow (Gmail, Slack, GitHub)
+- **API Key** - Direct credential entry (OpenAI, Anthropic)
+- **Basic Auth** - Username/password
+
+### Creating auth configs
+
+1. Go to [Composio dashboard](https://platform.composio.dev)
+2. Navigate to Settings → Authentication
+3. Click "Create Auth Config"
+4. Select toolkit and auth type
+5. Configure scopes and permissions
+6. Save and copy the `authConfigId`
+
+## Handle authentication errors
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+try:
+ instance = server.generate("[email protected]")
+except Exception as e:
+ if "authentication" in str(e).lower():
+ print("User needs to authenticate first")
+ # Guide user to auth flow
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+try {
+ const urls = await composio.mcp.getServer(
+ server.id,
+ );
+} catch (error) {
+ if (error.message.includes("not connected")) {
+ // Handle missing authentication
+ const auth = await composio.mcp.authorize(
+ server.id,
+ "gmail"
+ );
+ console.log(`Please authenticate: ${auth.redirectUrl}`);
+ }
+}
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Next steps
+
+<Cards>
+ <Card title="Server management" href="/docs/mcp-server-management" icon="server">
+ Create and manage MCP servers
+ </Card>
+ <Card title="Quickstart" href="/docs/mcp-quickstart" icon="rocket">
+ Get started quickly
+ </Card>
+ <Card title="Troubleshooting" href="/docs/troubleshooting/mcp" icon="wrench">
+ Common auth issues
+ </Card>
+</Cards>
\ No newline at end of file
diff --git a/fern/pages/src/mcp/implementation.mdx b/fern/pages/src/mcp/implementation.mdx
new file mode 100644
index 000000000..d79f37f0b
--- /dev/null
+++ b/fern/pages/src/mcp/implementation.mdx
@@ -0,0 +1,192 @@
+---
+title: MCP implementation
+subtitle: Complete guide to MCP server development
+---
+
+This guide covers everything you need to implement MCP servers in production.
+
+## Authentication
+
+MCP servers handle authentication for you. Configure OAuth, API keys, or custom auth through auth configs.
+
+### Check connection status
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+# Python SDK - connection checking coming soon
+# For now, use the generate method which handles auth
+instance = server.generate("[email protected]")
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+const status = await composio.mcp.getUserConnectionStatus(
+ server.id
+);
+
+if (!status.connected) {
+ // Handle missing authentication
+ const auth = await composio.mcp.authorize(
+ server.id,
+ "gmail"
+ );
+ console.log(`Authenticate at: ${auth.redirectUrl}`);
+}
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Server management
+
+### List servers
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+# List all servers
+servers = composio.mcp.list()
+
+# Filter by toolkit
+gmail_servers = composio.mcp.list(toolkits="gmail")
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+// List all servers
+const servers = await composio.mcp.list();
+
+// Filter by toolkit
+const gmailServers = await composio.mcp.list({
+ toolkits: ["gmail"]
+});
+```
+</CodeGroupItem>
+</CodeGroup>
+
+### Update servers
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+updated = composio.mcp.update(
+ server_id="mcp_server_id",
+ name="updated-name",
+ allowed_tools=["GMAIL_FETCH_EMAILS"]
+)
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+const updated = await composio.mcp.update(
+ "mcp_server_id",
+ "updated-name",
+ [{ toolkit: "gmail", authConfigId: "ac_new" }]
+);
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Multi-toolkit servers
+
+Combine multiple services in a single MCP server:
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+server = composio.mcp.create(
+ name="productivity-suite",
+ toolkits=[
+ {"toolkit": "gmail", "auth_config": "ac_gmail"},
+ {"toolkit": "slack", "auth_config": "ac_slack"},
+ {"toolkit": "github", "auth_config": "ac_github"}
+ ],
+ allowed_tools=[
+ "GMAIL_FETCH_EMAILS",
+ "SLACK_SEND_MESSAGE",
+ "GITHUB_CREATE_ISSUE"
+ ]
+)
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+const server = await composio.mcp.create(
+ "productivity-suite",
+ [
+ { authConfigId: "ac_gmail", allowedTools: ["GMAIL_FETCH_EMAILS"] },
+ { authConfigId: "ac_slack", allowedTools: ["SLACK_SEND_MESSAGE"] },
+ { authConfigId: "ac_github", allowedTools: ["GITHUB_CREATE_ISSUE"] }
+ ],
+ { isChatAuth: true }
+);
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Error handling
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+from composio.exceptions import ValidationError
+
+try:
+ server = composio.mcp.create(
+ name="test-server",
+ toolkits=[{"toolkit": "gmail"}]
+ )
+except ValidationError as e:
+ print(f"Error: {e}")
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+try {
+ const server = await composio.mcp.create(
+ "test-server",
+ [{ authConfigId: "invalid" }]
+ );
+} catch (error) {
+ if (error instanceof ValidationError) {
+ console.error("Validation failed:", error.message);
+ }
+}
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## API reference
+
+### Python methods
+
+| Method | Description |
+|--------|-------------|
+| `create()` | Create new MCP server |
+| `generate()` | Generate user instance |
+| `list()` | List servers |
+| `get()` | Get server details |
+| `update()` | Update server |
+| `delete()` | Delete server |
+
+### TypeScript methods
+
+| Method | Description |
+|--------|-------------|
+| `create()` | Create new MCP server |
+| `getServer()` | Generate user URLs |
+| `getUserConnectionStatus()` | Check auth status |
+| `list()` | List servers |
+| `get()` | Get server details |
+| `getByName()` | Find server by name |
+| `update()` | Update server |
+| `delete()` | Delete server |
+| `authorize()` | Start auth flow |
+
+## Next steps
+
+- [Quickstart guide](/docs/mcp-quickstart) - Get started quickly
+- [Provider integrations](/docs/mcp-providers) - Framework-specific implementations
+- [Troubleshooting](/docs/troubleshooting/mcp) - Common issues and solutions
\ No newline at end of file
diff --git a/fern/pages/src/mcp/overview.mdx b/fern/pages/src/mcp/overview.mdx
deleted file mode 100644
index aab793fb3..000000000
--- a/fern/pages/src/mcp/overview.mdx
+++ /dev/null
@@ -1,130 +0,0 @@
----
-title: Composio MCP Servers
-subtitle: "Transform any app into an MCP server with powerful tools and seamless authentication"
-image: "https://og.composio.dev/api/og?title=Composio%20MCP%20Servers" # image for socials
-keywords: "MCP, Model Context Protocol, AI tools, authentication, SDK"
-hide-nav-links: true
----
-
-[Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) is an open protocol that standardizes how LLM-powered applications provide _tools_ and relevant context to the underlying models.
-
-The protocol follows a client-server model, where the MCP server provides the tools and context to the MCP client.
-
-**Composio MCP Servers** make all [Composio tools](/toolkits/introduction) available through this standardized protocol, enabling seamless integration with any MCP-compatible client.
-
-## ✨ Key Features
-
-Our MCP SDK features an intuitive, powerful, and developer-friendly API:
-
-- **⚡ Streamlined Authentication** - Simplified user auth flows with better error handling
-- **📊 Real-time Connection Monitoring** - Check user authentication status before using servers
-- **🛠 Enhanced Tool Management** - Fine-grained control over which tools are available
-- **Tool Limiting** - Restrict which tools are available per user or context
-- **TypeScript Support** - Full type safety and autocomplete, python support to come soon.
-
-
-## 🚀 Getting Started
-
-Choose your path based on your role:
-
-### For End Users
-If you are an individual looking to use composio mcp servers directly for yourself, this is all you have todo.
-
-1. Visit [mcp.composio.dev](https://mcp.composio.dev)
-2. Click on any app that you want the MCP server for.
-3. Use with Claude Desktop, Cursor, or any MCP client
-
-### For Developers
-If you are looking to build on top of composio MCP servers, have granual control over MCP servers and manage it seperately for each of your users - you can simply follow the below guide.
-
-<Steps>
- <Step title="Install the SDK">
- ```bash
- npm install @composio/core
- ```
- </Step>
- <Step title="Create your first server">
- ```typescript
- import { Composio } from '@composio/core';
-
- const composio = new Composio({
- apiKey: process.env.COMPOSIO_API_KEY,
- });
-
- const mcpServer = await composio.mcp.create({
- name: "personal-gmail-server",
- serverConfig: [
- {
- authConfigId: "your_auth_config_id",
- allowedTools: ["GMAIL_FETCH_EMAILS"]
- }
- ],
- options: {
- isChatAuth: true
- }
- });
- ```
- </Step>
- <Step title="Generate user-specific URLs">
- ```typescript
- // Check if user is authenticated
- const status = await composio.mcp.getUserConnectionStatus({
- id: mcpServer.id,
- userId: "[email protected]"
- });
-
- if (status.connected) {
- const urls = await mcpServer.getServer({
- userId: "[email protected]"
- });
- console.log("Ready to use:", urls);
- }
- ```
- </Step>
-</Steps>
-
-## 🏗 Architecture Overview
-
-```mermaid
-graph TB
- A[Your Application] --> B[Composio SDK]
- B --> C[MCP Server]
- C --> D[Tools & Authentication]
- E[MCP Clients] --> C
- E --> F[Claude Desktop]
- E --> G[Cursor IDE]
- E --> H[Custom Clients]
-
- style C fill:#4762DA,color:#fff
- style B fill:#9EB6FF,color:#000
-```
-
-1. **Your Application** creates and manages MCP servers via the Composio SDK
-2. **MCP Servers** expose your chosen tools with proper authentication
-3. **MCP Clients** (Claude, Cursor, etc.) connect to servers and use tools
-4. **Users** interact with tools through their preferred MCP client
-
-## 📚 Documentation Structure
-
-<Cards>
- <Card title="Developer Guide" href="/docs/mcp-developers" icon="code">
- Step-by-step guide to creating and managing MCP servers
- </Card>
- <Card title="Provider Examples" href="/docs/mcp-providers" icon="code">
- Framework-specific implementations for Anthropic, OpenAI, Mastra, and more
- </Card>
- <Card title="Partner Program" href="/docs/mcp-partner-api" icon="handshake">
- Enterprise integration options and white-label solutions
- </Card>
-</Cards>
-
-## 🔗 Quick Links
-
-- **[Tool Catalog](/toolkits/introduction)** - Browse 1000+ available tools
-- **[Dashboard](https://platform.composio.dev)** - Manage servers and auth configs
-- **[API Reference](/api-reference/mcp)** - Complete endpoint documentation
-
-<Tip>
-Need help getting started? Reach out on [Discord](https://discord.com/invite/composio) or [email](mailto:[email protected]) - our team is here to help!
-</Tip>
-
diff --git a/fern/pages/src/mcp/providers-dummy.mdx b/fern/pages/src/mcp/providers-dummy.mdx
new file mode 100644
index 000000000..af6997ef3
--- /dev/null
+++ b/fern/pages/src/mcp/providers-dummy.mdx
@@ -0,0 +1,360 @@
+---
+
+title: MCP Providers
+subtitle: "Guide to Using Composio MCP Servers with Your Agent Framework"
+image: "https://og.composio.dev/api/og?title=MCP%20Providers" # image for socials
+keywords: ""
+hide-nav-links: true
+
+---
+
+<Warning title="Only available for TypeScript SDK" icon="warning">At this time, MCP providers using the Composio SDK are only supported in the TypeScript SDK. Support for the Python SDK is coming soon.</Warning>
+
+Integrating external tools into agent frameworks can be a complex and time-consuming process. Composio MCP (Model Context Protocol) servers simplify this workflow, enabling you to connect your framework to a wide array of tools and services with minimal configuration.
+
+This guide introduces the primary MCP providers, each optimized for a popular agent framework. With these providers, you can focus on developing intelligent agent logic while Composio handles the integration details.
+
+---
+
+## 1. Anthropic Provider
+
+The **Anthropic Provider** is purpose-built for use with the Anthropic Claude API. It supports Model Context Protocol (MCP) tools via a lightweight client that exposes a `getServer` method for retrieving the appropriate Composio MCP Server URL, preconfigured for your user. This provider ensures seamless compatibility between Composio tools and Anthropic's function calling APIs.
+
+<CodeGroup>
+ <CodeGroupItem title="TypeScript">
+
+```typescript
+import { Composio } from '@composio/core';
+import { AnthropicProvider } from '@composio/anthropic';
+import Anthropic from '@anthropic-ai/sdk';
+
+// Initialize Anthropic client
+const anthropic = new Anthropic({
+ apiKey: process.env.ANTHROPIC_API_KEY,
+});
+
+// Initialize Composio with the Anthropic provider
+const composio = new Composio({
+ apiKey: process.env.COMPOSIO_API_KEY,
+ provider: new AnthropicProvider({ cacheTools: true }),
+});
+
+// Create MCP server with the new API structure
+const mcpConfig = await composio.mcp.create({
+ name: "Gmail Readonly Server",
+ serverConfig: [
+ {
+ authConfigId: "<auth_config_id>", // Your auth config ID
+ allowedTools: ["GMAIL_FETCH_EMAILS"]
+ }
+ ],
+ options: {
+ isChatAuth: true
+ }
+});
+
+console.log(`✅ MCP server created: ${mcpConfig.id}`);
+console.log(`🔧 Available toolkits: ${mcpConfig.toolkits.join(", ")}`);
+
+// Check user connection status before proceeding
+const connectionStatus = await composio.mcp.getUserConnectionStatus({
+ id: mcpConfig.id,
+ userId: "utkarsh-dixit"
+});
+
+if (!connectionStatus.connected) {
+ console.log("❌ User needs to connect required accounts");
+ // Handle authentication as needed
+ return;
+}
+
+// Retrieve server instances for connected accounts
+const serverInstances = await mcpConfig.getServer({
+ userId: "utkarsh-dixit",
+});
+
+console.log("Server instances for connected accounts:", serverInstances);
+
+console.log("\n=== Fetching and Summarizing Recent Emails ===");
+
+const stream = await anthropic.beta.messages.stream(
+{
+ model: "claude-3-5-sonnet-20241022",
+ max_tokens: 1000,
+ mcp_servers: serverInstances,
+ messages: [
+ {
+ role: "user",
+ content:
+ "Please fetch the latest 10 emails and provide a detailed summary with sender, subject, date, and brief content overview for each email. Format the response in a clear, organized way.",
+ },
+ ],
+},
+{
+ headers: {
+ "anthropic-beta": "mcp-client-2025-04-04",
+ },
+}
+);
+
+console.log("\n📬 Email Summary:");
+for await (const event of stream) {
+ if (
+ event.type === "content_block_delta" &&
+ event.delta.type === "text_delta"
+ ) {
+ process.stdout.write(event.delta.text);
+ }
+}
+process.stdout.write("\n");
+
+console.log("\n✅ Anthropic MCP example completed successfully!");
+```
+
+ </CodeGroupItem>
+</CodeGroup>
+
+---
+
+## 2. Mastra Provider
+
+The **Mastra Provider** is tailored for the [Mastra](https://mastra.ai/en/docs/tools-mcp/overview#creating-tools) TypeScript-native agent framework. This client provides a getServer method to obtain the Composio MCP Server URL, configured for your user.
+
+<CodeGroup>
+ <CodeGroupItem title="Mastra">
+
+```typescript
+import { MastraProvider } from '@composio/mastra';
+import { Composio } from '@composio/core';
+import { MCPClient } from '@mastra/mcp';
+import { Agent } from '@mastra/core/agent';
+import { openai } from '@ai-sdk/openai';
+import type { MastraMCPServerDefinition } from '@mastra/mcp';
+
+const composio = new Composio({
+ apiKey: process.env.COMPOSIO_API_KEY,
+ provider: new MastraProvider(),
+});
+
+// Create an MCP server with the Gmail toolkit using new API structure
+const mcpConfig = await composio.mcp.create({
+ name: "Gmail Readonly Server",
+ serverConfig: [
+ {
+ authConfigId: "<auth_config_id>", // Your auth config ID
+ allowedTools: ["GMAIL_FETCH_EMAILS"]
+ }
+ ],
+ options: {
+ isChatAuth: true
+ }
+});
+
+console.log(`✅ MCP server created: ${mcpConfig.id}`);
+console.log(`🔧 Available toolkits: ${mcpConfig.toolkits.join(", ")}`);
+
+// Check user connection status
+const connectionStatus = await composio.mcp.getUserConnectionStatus({
+ id: mcpConfig.id,
+ userId: "utkarsh-dixit"
+});
+
+console.log("Connection status:", connectionStatus.connected);
+
+if (!connectionStatus.connected) {
+ console.log("❌ User needs to authenticate with required services");
+ // Handle authentication flow
+ Object.entries(connectionStatus.connectedToolkits).forEach(([toolkit, status]) => {
+ if (!status.connected) {
+ console.log(`Please connect ${toolkit}`);
+ }
+ });
+ return;
+}
+
+// Retrieve server instance for connected accounts
+const serverInstance = await mcpConfig.getServer({
+ userId: "utkarsh-dixit"
+});
+
+console.log("Server instance for connected accounts:", serverInstance);
+
+// Initialize MCPClient with the server URLs
+const mcpClient = new MCPClient({
+servers: Object.fromEntries(
+ Object.entries(serverInstance as Record<string, { url: string }>).map(
+ ([key, value]) => [key, { url: new URL(value.url) }]
+ )
+) satisfies Record<string, MastraMCPServerDefinition>,
+});
+
+// List available tools from MCP client
+const tools = await mcpClient.getTools();
+console.log(`🔧 Available tools: ${Object.keys(tools).join(", ")}`);
+
+// Create a Gmail agent using the MCP tools
+const gmailAgent = new Agent({
+ name: "Gmail Assistant",
+ instructions: `
+ You are a helpful Gmail assistant that fetches and summarizes emails.
+ When fetching emails, provide a clear summary of the results including sender, subject, and date.
+ Be concise and provide actionable information based on the email content.
+ `,
+ model: openai("gpt-4o-mini"),
+ tools,
+});
+
+// Fetch and summarize recent emails
+console.log("\n=== Fetching and Summarizing Recent Emails ===");
+const emailResponse = await gmailAgent.generate(
+"Fetch the latest 10 emails and provide a detailed summary with sender, subject, date, and brief content overview for each email"
+);
+console.log("\n📬 Email Summary:");
+console.log(emailResponse.text);
+
+console.log("\n✅ Gmail MCP example completed successfully!");
+```
+
+ </CodeGroupItem>
+</CodeGroup>
+
+---
+
+## 3. OpenAI SDK Provider
+
+The **OpenAI SDK Provider** is designed for use with the OpenAI SDK and supports MCP tools through a streamlined client. This client provides a `getServer` method to obtain the Composio MCP Server URL, configured for your user.
+
+<CodeGroup>
+ <CodeGroupItem title="TypeScript">
+
+```typescript
+import { Composio } from '@composio/core';
+import { OpenAIProvider } from '@composio/openai';
+import OpenAI from 'openai';
+
+const openai = new OpenAI({
+ apiKey: process.env.OPENAI_API_KEY,
+});
+
+const composio = new Composio({
+ apiKey: process.env.COMPOSIO_API_KEY,
+ provider: new OpenAIProvider(),
+});
+
+// Create MCP server with new API structure
+const mcpConfig = await composio.mcp.create({
+ name: "Gmail Readonly Server",
+ serverConfig: [
+ {
+ authConfigId: "<auth_config_id>", // Your auth config ID
+ allowedTools: ["GMAIL_FETCH_EMAILS"]
+ }
+ ],
+ options: {
+ isChatAuth: true
+ }
+});
+
+console.log(`✅ MCP server created: ${mcpConfig.id}`);
+console.log(`🔧 Available toolkits: ${mcpConfig.toolkits.join(", ")}`);
+
+// Check if user has necessary connections
+const connectionStatus = await composio.mcp.getUserConnectionStatus({
+ id: mcpConfig.id,
+ userId: "utkarsh-dixit"
+});
+
+if (!connectionStatus.connected) {
+ console.log("❌ User authentication required");
+ // Handle missing connections
+ for (const [toolkit, status] of Object.entries(connectionStatus.connectedToolkits)) {
+ if (!status.connected) {
+ const authParams = await composio.mcp.getConnectionParams({
+ id: mcpConfig.id,
+ toolkit
+ });
+
+ const authRequest = await composio.mcp.authorize({
+ id: mcpConfig.id,
+ userId: "utkarsh-dixit",
+ toolkit
+ });
+
+ if (authRequest.redirectUrl) {
+ console.log(`Please authenticate with ${toolkit}: ${authRequest.redirectUrl}`);
+ }
+ }
+ }
+ return;
+}
+
+// Retrieve server URLs for connected accounts
+const serverUrls = await mcpConfig.getServer({
+ userId: "utkarsh-dixit",
+ options: {
+ limitTools: ["GMAIL_FETCH_EMAILS"] // Optional: limit to specific tools
+ }
+});
+
+console.log("Server URLs for your MCP server:", serverUrls);
+
+// Use with OpenAI (example with hypothetical OpenAI MCP integration)
+const completion = await openai.chat.completions.create({
+ model: "gpt-4o-mini",
+ messages: [
+ {
+ role: "user",
+ content: "I've connected to Gmail and I want to fetch the latest email from my inbox and summarize it"
+ }
+ ],
+ // Note: This is a hypothetical integration - actual OpenAI MCP support may differ
+ tools: serverUrls,
+});
+
+console.log("\n📬 Email Summary:");
+console.log(completion.choices[0].message.content);
+
+console.log("\n✅ OpenAI MCP example completed successfully!");
+console.log("\n💡 Note: The MCP server URLs can also be used to connect from other MCP-compatible clients.");
+console.log(`📍 Server ID for future reference: ${mcpConfig.id}`);
+```
+
+ </CodeGroupItem>
+</CodeGroup>
+
+---
+
+## Managing Existing Servers
+
+You can also work with previously created MCP servers:
+
+```typescript
+// Find a server by name
+const existingServer = await composio.mcp.getByName("Gmail Readonly Server");
+
+// Check connection status for the existing server
+const status = await composio.mcp.getUserConnectionStatus({
+ id: existingServer.id,
+ userId: "[email protected]"
+});
+
+// Generate URLs for the existing server
+const urls = await composio.mcp.getServer({
+ id: existingServer.id,
+ userId: "[email protected]",
+ options: {
+ isChatAuth: true
+ }
+});
+```
+
+## Best Practices for Providers
+
+1. **Always check connection status** before using MCP servers to ensure users are authenticated
+2. **Handle authentication gracefully** by providing clear instructions and redirect URLs
+3. **Use meaningful server names** to make management easier
+4. **Limit tools appropriately** to only what your application needs
+5. **Cache server configurations** when possible to reduce API calls
+6. **Monitor connection health** and provide re-authentication flows when needed
+
+By using Composio MCP Servers with these providers, you can quickly connect your agent framework to a wide range of external tools with minimal effort. This lets you streamline integration, reduce setup time, and focus more on building your AI agent.
\ No newline at end of file
diff --git a/fern/pages/src/mcp/providers.mdx b/fern/pages/src/mcp/providers.mdx
index af6997ef3..afd5819f5 100644
--- a/fern/pages/src/mcp/providers.mdx
+++ b/fern/pages/src/mcp/providers.mdx
@@ -1,360 +1,189 @@
---
-
-title: MCP Providers
-subtitle: "Guide to Using Composio MCP Servers with Your Agent Framework"
-image: "https://og.composio.dev/api/og?title=MCP%20Providers" # image for socials
-keywords: ""
-hide-nav-links: true
-
+title: MCP providers
+subtitle: Using MCP servers with AI frameworks
---
-<Warning title="Only available for TypeScript SDK" icon="warning">At this time, MCP providers using the Composio SDK are only supported in the TypeScript SDK. Support for the Python SDK is coming soon.</Warning>
-
-Integrating external tools into agent frameworks can be a complex and time-consuming process. Composio MCP (Model Context Protocol) servers simplify this workflow, enabling you to connect your framework to a wide array of tools and services with minimal configuration.
-
-This guide introduces the primary MCP providers, each optimized for a popular agent framework. With these providers, you can focus on developing intelligent agent logic while Composio handles the integration details.
-
----
+Connect your MCP servers to popular AI frameworks and agents.
-## 1. Anthropic Provider
+## Anthropic (Claude)
-The **Anthropic Provider** is purpose-built for use with the Anthropic Claude API. It supports Model Context Protocol (MCP) tools via a lightweight client that exposes a `getServer` method for retrieving the appropriate Composio MCP Server URL, preconfigured for your user. This provider ensures seamless compatibility between Composio tools and Anthropic's function calling APIs.
+Use MCP servers with Claude API and Claude Desktop.
<CodeGroup>
- <CodeGroupItem title="TypeScript">
-
+<CodeGroupItem title="Python">
+```python
+# Python SDK - Anthropic integration coming soon
+# Use the standard MCP server URL generation for now
+instance = server.generate("[email protected]")
+print(f"MCP URL for Claude: {instance['url']}")
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
```typescript
-import { Composio } from '@composio/core';
-import { AnthropicProvider } from '@composio/anthropic';
import Anthropic from '@anthropic-ai/sdk';
-// Initialize Anthropic client
const anthropic = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});
-// Initialize Composio with the Anthropic provider
-const composio = new Composio({
- apiKey: process.env.COMPOSIO_API_KEY,
- provider: new AnthropicProvider({ cacheTools: true }),
-});
-
-// Create MCP server with the new API structure
-const mcpConfig = await composio.mcp.create({
- name: "Gmail Readonly Server",
- serverConfig: [
- {
- authConfigId: "<auth_config_id>", // Your auth config ID
- allowedTools: ["GMAIL_FETCH_EMAILS"]
- }
- ],
- options: {
- isChatAuth: true
- }
-});
-
-console.log(`✅ MCP server created: ${mcpConfig.id}`);
-console.log(`🔧 Available toolkits: ${mcpConfig.toolkits.join(", ")}`);
-
-// Check user connection status before proceeding
-const connectionStatus = await composio.mcp.getUserConnectionStatus({
- id: mcpConfig.id,
- userId: "utkarsh-dixit"
-});
-
-if (!connectionStatus.connected) {
- console.log("❌ User needs to connect required accounts");
- // Handle authentication as needed
- return;
-}
-
-// Retrieve server instances for connected accounts
-const serverInstances = await mcpConfig.getServer({
- userId: "utkarsh-dixit",
-});
-
-console.log("Server instances for connected accounts:", serverInstances);
-
-console.log("\n=== Fetching and Summarizing Recent Emails ===");
-
-const stream = await anthropic.beta.messages.stream(
-{
- model: "claude-3-5-sonnet-20241022",
- max_tokens: 1000,
- mcp_servers: serverInstances,
- messages: [
- {
- role: "user",
- content:
- "Please fetch the latest 10 emails and provide a detailed summary with sender, subject, date, and brief content overview for each email. Format the response in a clear, organized way.",
- },
- ],
-},
-{
- headers: {
- "anthropic-beta": "mcp-client-2025-04-04",
- },
-}
+// Get MCP server URL
+const serverUrls = await composio.mcp.getServer(
+ server.id,
);
-console.log("\n📬 Email Summary:");
-for await (const event of stream) {
- if (
- event.type === "content_block_delta" &&
- event.delta.type === "text_delta"
- ) {
- process.stdout.write(event.delta.text);
- }
-}
-process.stdout.write("\n");
-
-console.log("\n✅ Anthropic MCP example completed successfully!");
+// Use with Claude (when MCP support is available)
+const stream = await anthropic.beta.messages.stream({
+ model: "claude-3-5-sonnet-20241022",
+ mcp_servers: serverUrls,
+ messages: [{
+ role: "user",
+ content: "Fetch my latest emails"
+ }]
+});
```
-
- </CodeGroupItem>
+</CodeGroupItem>
</CodeGroup>
----
-
-## 2. Mastra Provider
+## OpenAI
-The **Mastra Provider** is tailored for the [Mastra](https://mastra.ai/en/docs/tools-mcp/overview#creating-tools) TypeScript-native agent framework. This client provides a getServer method to obtain the Composio MCP Server URL, configured for your user.
+Integrate MCP servers with OpenAI GPT models.
<CodeGroup>
- <CodeGroupItem title="Mastra">
-
-```typescript
-import { MastraProvider } from '@composio/mastra';
-import { Composio } from '@composio/core';
-import { MCPClient } from '@mastra/mcp';
-import { Agent } from '@mastra/core/agent';
-import { openai } from '@ai-sdk/openai';
-import type { MastraMCPServerDefinition } from '@mastra/mcp';
-
-const composio = new Composio({
- apiKey: process.env.COMPOSIO_API_KEY,
- provider: new MastraProvider(),
-});
-
-// Create an MCP server with the Gmail toolkit using new API structure
-const mcpConfig = await composio.mcp.create({
- name: "Gmail Readonly Server",
- serverConfig: [
- {
- authConfigId: "<auth_config_id>", // Your auth config ID
- allowedTools: ["GMAIL_FETCH_EMAILS"]
- }
- ],
- options: {
- isChatAuth: true
- }
-});
-
-console.log(`✅ MCP server created: ${mcpConfig.id}`);
-console.log(`🔧 Available toolkits: ${mcpConfig.toolkits.join(", ")}`);
-
-// Check user connection status
-const connectionStatus = await composio.mcp.getUserConnectionStatus({
- id: mcpConfig.id,
- userId: "utkarsh-dixit"
-});
-
-console.log("Connection status:", connectionStatus.connected);
-
-if (!connectionStatus.connected) {
- console.log("❌ User needs to authenticate with required services");
- // Handle authentication flow
- Object.entries(connectionStatus.connectedToolkits).forEach(([toolkit, status]) => {
- if (!status.connected) {
- console.log(`Please connect ${toolkit}`);
- }
- });
- return;
-}
+<CodeGroupItem title="Python">
+```python
+from openai import OpenAI
-// Retrieve server instance for connected accounts
-const serverInstance = await mcpConfig.getServer({
- userId: "utkarsh-dixit"
-});
+client = OpenAI()
-console.log("Server instance for connected accounts:", serverInstance);
+# Get MCP server instance
+instance = server.generate("[email protected]")
-// Initialize MCPClient with the server URLs
-const mcpClient = new MCPClient({
-servers: Object.fromEntries(
- Object.entries(serverInstance as Record<string, { url: string }>).map(
- ([key, value]) => [key, { url: new URL(value.url) }]
- )
-) satisfies Record<string, MastraMCPServerDefinition>,
-});
+# Use the MCP URL with OpenAI (hypothetical integration)
+# OpenAI MCP support details coming soon
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+import OpenAI from 'openai';
-// List available tools from MCP client
-const tools = await mcpClient.getTools();
-console.log(`🔧 Available tools: ${Object.keys(tools).join(", ")}`);
-
-// Create a Gmail agent using the MCP tools
-const gmailAgent = new Agent({
- name: "Gmail Assistant",
- instructions: `
- You are a helpful Gmail assistant that fetches and summarizes emails.
- When fetching emails, provide a clear summary of the results including sender, subject, and date.
- Be concise and provide actionable information based on the email content.
- `,
- model: openai("gpt-4o-mini"),
- tools,
+const openai = new OpenAI({
+ apiKey: process.env.OPENAI_API_KEY,
});
-// Fetch and summarize recent emails
-console.log("\n=== Fetching and Summarizing Recent Emails ===");
-const emailResponse = await gmailAgent.generate(
-"Fetch the latest 10 emails and provide a detailed summary with sender, subject, date, and brief content overview for each email"
+// Get MCP server URL
+const serverUrls = await composio.mcp.getServer(
+ server.id,
);
-console.log("\n📬 Email Summary:");
-console.log(emailResponse.text);
-console.log("\n✅ Gmail MCP example completed successfully!");
+// Integration with OpenAI (when available)
+// Use serverUrls with OpenAI's MCP support
```
-
- </CodeGroupItem>
+</CodeGroupItem>
</CodeGroup>
----
-
-## 3. OpenAI SDK Provider
+## Vercel AI SDK
-The **OpenAI SDK Provider** is designed for use with the OpenAI SDK and supports MCP tools through a streamlined client. This client provides a `getServer` method to obtain the Composio MCP Server URL, configured for your user.
-
-<CodeGroup>
- <CodeGroupItem title="TypeScript">
+Use MCP servers with Vercel's AI SDK.
```typescript
-import { Composio } from '@composio/core';
-import { OpenAIProvider } from '@composio/openai';
-import OpenAI from 'openai';
+import { experimental_createMCPClient as createMCPClient } from 'ai';
+import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
-const openai = new OpenAI({
- apiKey: process.env.OPENAI_API_KEY,
-});
+// Get server URL
+const serverUrls = await composio.mcp.getServer(
+ server.id,
+);
-const composio = new Composio({
- apiKey: process.env.COMPOSIO_API_KEY,
- provider: new OpenAIProvider(),
+// Create MCP client
+const mcpClient = await createMCPClient({
+ name: 'composio-mcp-client',
+ transport: new SSEClientTransport(new URL(serverUrls.url)),
});
-// Create MCP server with new API structure
-const mcpConfig = await composio.mcp.create({
- name: "Gmail Readonly Server",
- serverConfig: [
- {
- authConfigId: "<auth_config_id>", // Your auth config ID
- allowedTools: ["GMAIL_FETCH_EMAILS"]
- }
- ],
- options: {
- isChatAuth: true
- }
-});
+// Use with Vercel AI
+const tools = await mcpClient.tools();
+```
-console.log(`✅ MCP server created: ${mcpConfig.id}`);
-console.log(`🔧 Available toolkits: ${mcpConfig.toolkits.join(", ")}`);
+## Cursor IDE
-// Check if user has necessary connections
-const connectionStatus = await composio.mcp.getUserConnectionStatus({
- id: mcpConfig.id,
- userId: "utkarsh-dixit"
-});
+Configure MCP servers in Cursor settings.
-if (!connectionStatus.connected) {
- console.log("❌ User authentication required");
- // Handle missing connections
- for (const [toolkit, status] of Object.entries(connectionStatus.connectedToolkits)) {
- if (!status.connected) {
- const authParams = await composio.mcp.getConnectionParams({
- id: mcpConfig.id,
- toolkit
- });
-
- const authRequest = await composio.mcp.authorize({
- id: mcpConfig.id,
- userId: "utkarsh-dixit",
- toolkit
- });
-
- if (authRequest.redirectUrl) {
- console.log(`Please authenticate with ${toolkit}: ${authRequest.redirectUrl}`);
- }
+```json
+{
+ "mcpServers": {
+ "composio": {
+ "command": "npx",
+ "args": [
+ "-y",
+ "@modelcontextprotocol/server-compose",
+ "YOUR_MCP_SERVER_URL"
+ ]
}
}
- return;
}
-
-// Retrieve server URLs for connected accounts
-const serverUrls = await mcpConfig.getServer({
- userId: "utkarsh-dixit",
- options: {
- limitTools: ["GMAIL_FETCH_EMAILS"] // Optional: limit to specific tools
- }
-});
-
-console.log("Server URLs for your MCP server:", serverUrls);
-
-// Use with OpenAI (example with hypothetical OpenAI MCP integration)
-const completion = await openai.chat.completions.create({
- model: "gpt-4o-mini",
- messages: [
- {
- role: "user",
- content: "I've connected to Gmail and I want to fetch the latest email from my inbox and summarize it"
- }
- ],
- // Note: This is a hypothetical integration - actual OpenAI MCP support may differ
- tools: serverUrls,
-});
-
-console.log("\n📬 Email Summary:");
-console.log(completion.choices[0].message.content);
-
-console.log("\n✅ OpenAI MCP example completed successfully!");
-console.log("\n💡 Note: The MCP server URLs can also be used to connect from other MCP-compatible clients.");
-console.log(`📍 Server ID for future reference: ${mcpConfig.id}`);
```
- </CodeGroupItem>
-</CodeGroup>
+## Claude Desktop
----
+Add to Claude Desktop configuration:
-## Managing Existing Servers
+**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
+**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
-You can also work with previously created MCP servers:
-
-```typescript
-// Find a server by name
-const existingServer = await composio.mcp.getByName("Gmail Readonly Server");
-
-// Check connection status for the existing server
-const status = await composio.mcp.getUserConnectionStatus({
- id: existingServer.id,
- userId: "[email protected]"
-});
-
-// Generate URLs for the existing server
-const urls = await composio.mcp.getServer({
- id: existingServer.id,
- userId: "[email protected]",
- options: {
- isChatAuth: true
+```json
+{
+ "mcpServers": {
+ "composio-gmail": {
+ "command": "node",
+ "args": [
+ "/path/to/mcp-server.js",
+ "YOUR_MCP_SERVER_URL"
+ ]
+ }
}
-});
+}
```
-## Best Practices for Providers
-
-1. **Always check connection status** before using MCP servers to ensure users are authenticated
-2. **Handle authentication gracefully** by providing clear instructions and redirect URLs
-3. **Use meaningful server names** to make management easier
-4. **Limit tools appropriately** to only what your application needs
-5. **Cache server configurations** when possible to reduce API calls
-6. **Monitor connection health** and provide re-authentication flows when needed
-
-By using Composio MCP Servers with these providers, you can quickly connect your agent framework to a wide range of external tools with minimal effort. This lets you streamline integration, reduce setup time, and focus more on building your AI agent.
\ No newline at end of file
+## Quick integration guide
+
+<Steps>
+ <Step title="Create MCP server">
+ Create your server with the required toolkits and auth configs.
+ </Step>
+
+ <Step title="Generate URLs">
+ Generate user-specific URLs for your MCP server.
+ </Step>
+
+ <Step title="Configure client">
+ Add the MCP server URL to your AI framework or client configuration.
+ </Step>
+
+ <Step title="Start using">
+ The AI can now access the tools exposed by your MCP server.
+ </Step>
+</Steps>
+
+## Supported clients
+
+- **Claude Desktop** - Native MCP support
+- **Cursor IDE** - Built-in MCP integration
+- **Vercel AI SDK** - Experimental MCP support
+- **Custom clients** - Any MCP-compatible client
+
+## Next steps
+
+<Cards>
+ <Card title="Quickstart" href="/docs/mcp-quickstart" icon="rocket">
+ Get started with MCP servers
+ </Card>
+ <Card title="Implementation guide" href="/docs/mcp-implementation" icon="book">
+ Complete development guide
+ </Card>
+ <Card title="Troubleshooting" href="/docs/troubleshooting/mcp" icon="wrench">
+ Common issues and solutions
+ </Card>
+</Cards>
\ No newline at end of file
diff --git a/fern/pages/src/mcp/quickstart.mdx b/fern/pages/src/mcp/quickstart.mdx
new file mode 100644
index 000000000..8b7571210
--- /dev/null
+++ b/fern/pages/src/mcp/quickstart.mdx
@@ -0,0 +1,98 @@
+---
+title: MCP quickstart
+subtitle: Create your first MCP server
+---
+[Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) is an open-source standard for connecting AI applications to external tools. All the 500+ tools available in Composio are also available as MCP servers.
+
+Composio lets you create MCP servers that handle authentication (OAuth, API keys), generate unique URLs for each user, and control which tools are exposed. You can combine multiple toolkits in a single server.
+
+<Note>
+Composio MCP servers only support Streamable HTTP transport.
+</Note>
+
+## Install the SDK
+First, install the Composio SDK for your preferred language:
+
+<CodeGroup>
+```bash title="Python" for="python"
+pip install composio
+```
+```bash title="TypeScript" for="typescript"
+npm install @composio/core
+```
+</CodeGroup>
+
+## Create an MCP server
+
+<Steps>
+ <Step title="Initialize Composio">
+ <CodeGroup>
+ <SnippetCode src="fern/snippets/mcp/python/quickstart.py" title="Python" startLine={1} endLine={4} />
+ <SnippetCode src="fern/snippets/mcp/typescript/quickstart.ts" title="TypeScript" startLine={1} endLine={6} />
+ </CodeGroup>
+ </Step>
+
+ <Step title="Create server configuration">
+ <Warning>
+ **Before you begin:** [Create an auth configuration](/docs/authenticating-tools#creating-an-auth-config) for your toolkit.
+ </Warning>
+
+ Create an MCP server with your auth config. You can also set list of specific tools to enable across all toolkits
+
+ <CodeGroup>
+ <SnippetCode src="fern/snippets/mcp/python/quickstart.py" title="Python" startLine={6} endLine={22} />
+ <SnippetCode src="fern/snippets/mcp/typescript/quickstart.ts" title="TypeScript" startLine={8} endLine={23} />
+ </CodeGroup>
+
+ <Note>
+ **Alternative:** You can also create and manage MCP configs directly from the [Composio dashboard → MCP Configs](https://platform.composio.dev?next_page=/mcp-configs).
+ </Note>
+
+ </Step>
+
+ <Step title="Generate user URLs">
+ <Warning>
+ **Before generating URLs:** Users must authenticate with the toolkits configured in your MCP server. See [hosted authentication](/docs/authenticating-tools#hosted-authentication-connect-link) for how to connect user accounts.
+ </Warning>
+
+ Get server URLs for your users to connect:
+
+ <CodeGroup>
+ <SnippetCode src="fern/snippets/mcp/python/quickstart.py" title="Python" startLine={24} endLine={28} />
+ <SnippetCode src="fern/snippets/mcp/typescript/quickstart.ts" title="TypeScript" startLine={25} endLine={29} />
+ </CodeGroup>
+
+ <Note>
+ If users haven't authenticated, the MCP server will still generate a URL but tools requiring authentication won't work until the user connects their accounts.
+ </Note>
+ </Step>
+
+ <Step title="Use with AI providers">
+ Use the MCP server URL with your AI provider:
+
+ <CodeGroup>
+ <SnippetCode src="fern/snippets/mcp/python/openai-client.py" title="OpenAI (Python)" />
+ <SnippetCode src="fern/snippets/mcp/python/anthropic-client.py" title="Anthropic (Python)" />
+ <SnippetCode src="fern/snippets/mcp/typescript/mastra-client.ts" title="Mastra (TypeScript)" />
+ </CodeGroup>
+
+ </Step>
+</Steps>
+
+## Next steps
+
+<Cards>
+ <Card title="Authentication" href="/docs/mcp-authentication" icon="lock">
+ Handle user authentication and connections
+ </Card>
+ <Card title="Server management" href="/docs/mcp-server-management" icon="server">
+ Create and manage MCP servers
+ </Card>
+ <Card title="Providers" href="/docs/mcp-providers" icon="code">
+ Use with Anthropic, OpenAI, and other frameworks
+ </Card>
+</Cards>
+
+<Tip>
+Need help? Join our [Discord](https://discord.com/invite/composio) or [raise an issue on GitHub](https://github.com/ComposioHQ/composio/issues/new?labels=bug).
+</Tip>
\ No newline at end of file
diff --git a/fern/pages/src/mcp/server-management.mdx b/fern/pages/src/mcp/server-management.mdx
new file mode 100644
index 000000000..198e80bff
--- /dev/null
+++ b/fern/pages/src/mcp/server-management.mdx
@@ -0,0 +1,281 @@
+---
+title: Server management
+subtitle: Create, update, and manage MCP servers
+---
+
+This guide covers all server management operations for MCP servers.
+
+## Create a server
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+server = composio.mcp.create(
+ name="my-gmail-server",
+ toolkits=[{
+ "toolkit": "gmail",
+ "auth_config": "ac_xyz123"
+ }],
+ allowed_tools=["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL"]
+)
+
+print(f"Created server: {server.id}")
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+const server = await composio.mcp.create(
+ "my-gmail-server",
+ [{
+ authConfigId: "ac_xyz123",
+ allowedTools: ["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL"]
+ }],
+ { isChatAuth: true }
+);
+
+console.log(`Created server: ${server.id}`);
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## List servers
+
+Find and filter your MCP servers.
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+# List all servers
+servers = composio.mcp.list()
+print(f"Found {len(servers['items'])} servers")
+
+# Filter by toolkit
+gmail_servers = composio.mcp.list(
+ toolkits="gmail",
+ limit=20
+)
+
+# Filter by name
+production_servers = composio.mcp.list(
+ name="production"
+)
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+// List all servers
+const servers = await composio.mcp.list();
+console.log(`Found ${servers.items.length} servers`);
+
+// Filter by toolkit
+const gmailServers = await composio.mcp.list({
+ toolkits: ["gmail"],
+ limit: 20
+});
+
+// Filter by name
+const productionServers = await composio.mcp.list({
+ name: "production"
+});
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Get server details
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+# Get by ID
+server = composio.mcp.get("mcp_server_id")
+print(f"Server: {server['name']}")
+print(f"Toolkits: {server['toolkits']}")
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+// Get by ID
+const server = await composio.mcp.get("mcp_server_id");
+
+// Get by name (TypeScript only)
+const namedServer = await composio.mcp.getByName("my-gmail-server");
+
+console.log(`Server: ${server.name}`);
+console.log(`Toolkits: ${server.toolkits}`);
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Update a server
+
+Modify server configuration, tools, or auth configs.
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+updated = composio.mcp.update(
+ server_id="mcp_server_id",
+ name="updated-name",
+ allowed_tools=["GMAIL_FETCH_EMAILS", "GMAIL_SEARCH_EMAILS"]
+)
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+const updated = await composio.mcp.update(
+ "mcp_server_id",
+ "updated-name",
+ [{
+ toolkit: "gmail",
+ authConfigId: "ac_new_config",
+ allowedTools: ["GMAIL_FETCH_EMAILS", "GMAIL_SEARCH_EMAILS"]
+ }],
+ { isChatAuth: true }
+);
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Delete a server
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+result = composio.mcp.delete("mcp_server_id")
+if result['deleted']:
+ print("Server deleted successfully")
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+const result = await composio.mcp.delete("mcp_server_id");
+if (result.deleted) {
+ console.log("Server deleted successfully");
+}
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Multi-toolkit servers
+
+Combine multiple services in a single MCP server.
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+server = composio.mcp.create(
+ name="productivity-suite",
+ toolkits=[
+ {"toolkit": "gmail", "auth_config": "ac_gmail"},
+ {"toolkit": "slack", "auth_config": "ac_slack"},
+ {"toolkit": "github", "auth_config": "ac_github"}
+ ],
+ allowed_tools=[
+ "GMAIL_FETCH_EMAILS",
+ "SLACK_SEND_MESSAGE",
+ "GITHUB_CREATE_ISSUE"
+ ]
+)
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+const server = await composio.mcp.create(
+ "productivity-suite",
+ [
+ {
+ authConfigId: "ac_gmail",
+ allowedTools: ["GMAIL_FETCH_EMAILS"]
+ },
+ {
+ authConfigId: "ac_slack",
+ allowedTools: ["SLACK_SEND_MESSAGE"]
+ },
+ {
+ authConfigId: "ac_github",
+ allowedTools: ["GITHUB_CREATE_ISSUE"]
+ }
+ ],
+ { isChatAuth: true }
+);
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## Generate user URLs
+
+After creating a server, generate unique URLs for each user.
+
+<CodeGroup>
+<CodeGroupItem title="Python">
+```python
+# Generate instance for user
+instance = server.generate("[email protected]")
+
+print(f"URL: {instance['url']}")
+print(f"Tools: {instance['allowed_tools']}")
+```
+</CodeGroupItem>
+<CodeGroupItem title="TypeScript">
+```typescript
+// Generate URLs for user
+const urls = await composio.mcp.getServer(
+ server.id,
+);
+
+// Or use convenience method from create response
+const urls2 = await server.getServer({
+ userId: "[email protected]"
+});
+
+console.log("URL:", urls);
+```
+</CodeGroupItem>
+</CodeGroup>
+
+## 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
+
+## API reference
+
+### Python methods
+
+| Method | Description |
+|--------|-------------|
+| `create()` | Create new server |
+| `list()` | List servers |
+| `get()` | Get server by ID |
+| `update()` | Update server |
+| `delete()` | Delete server |
+| `generate()` | Generate user URL |
+
+### TypeScript methods
+
+| Method | Description |
+|--------|-------------|
+| `create()` | Create new server |
+| `list()` | List servers |
+| `get()` | Get server by ID |
+| `getByName()` | Find server by name |
+| `update()` | Update server |
+| `delete()` | Delete server |
+| `getServer()` | Generate user URL |
+
+## Next steps
+
+<Cards>
+ <Card title="Authentication" href="/docs/mcp-authentication" icon="lock">
+ Handle user authentication
+ </Card>
+ <Card title="Providers" href="/docs/mcp-providers" icon="code">
+ Framework integrations
+ </Card>
+ <Card title="Troubleshooting" href="/docs/troubleshooting/mcp" icon="wrench">
+ Common issues
+ </Card>
+</Cards>
\ No newline at end of file
diff --git a/fern/snippets/mcp/python/anthropic-client.py b/fern/snippets/mcp/python/anthropic-client.py
new file mode 100644
index 000000000..1660b0de3
--- /dev/null
+++ b/fern/snippets/mcp/python/anthropic-client.py
@@ -0,0 +1,25 @@
+from anthropic import Anthropic
+
+# Initialize Anthropic client
+client = Anthropic(api_key="your-anthropic-api-key")
+
+# Use the MCP server URL you generated
+mcp_server_url = "https://backend.composio.dev/v3/mcp/YOUR_SERVER_ID?include_composio_helper_actions=true&user_id=YOUR_USER_ID"
+
+# Use MCP with Anthropic (beta feature)
+response = client.beta.messages.create(
+ model="claude-3-5-sonnet-20241022",
+ max_tokens=1000,
+ messages=[{
+ "role": "user",
+ "content": "What meetings do I have tomorrow? Also check if I have any urgent emails"
+ }],
+ mcp_servers=[{
+ "type": "url",
+ "url": mcp_server_url,
+ "name": "composio-gmail-calendar-mcp-server"
+ }],
+ betas=["mcp-client-2025-01-15"] # Enable MCP beta
+)
+
+print(response.content)
\ No newline at end of file
diff --git a/fern/snippets/mcp/python/openai-client.py b/fern/snippets/mcp/python/openai-client.py
new file mode 100644
index 000000000..a30b635b3
--- /dev/null
+++ b/fern/snippets/mcp/python/openai-client.py
@@ -0,0 +1,24 @@
+from openai import OpenAI
+
+# Initialize OpenAI client
+client = OpenAI(api_key="your-openai-api-key")
+
+# Use the MCP server URL you generated
+mcp_server_url = "https://backend.composio.dev/v3/mcp/YOUR_SERVER_ID?include_composio_helper_actions=true&user_id=YOUR_USER_ID"
+
+# Use MCP with OpenAI Responses API
+response = client.responses.create(
+ model="gpt-5",
+ tools=[
+ {
+ "type": "mcp",
+ "server_label": "composio-server",
+ "server_description": "Composio MCP server for Gmail and Calendar integrations",
+ "server_url": mcp_server_url,
+ "require_approval": "never",
+ },
+ ],
+ input="What meetings do I have tomorrow? Also check if I have any urgent emails",
+)
+
+print("OpenAI MCP Response:", response.output_text)
\ No newline at end of file
diff --git a/fern/snippets/mcp/python/quickstart.py b/fern/snippets/mcp/python/quickstart.py
new file mode 100644
index 000000000..88fd2a738
--- /dev/null
+++ b/fern/snippets/mcp/python/quickstart.py
@@ -0,0 +1,28 @@
+from composio import Composio
+
+# Initialize Composio
+composio = Composio(api_key="YOUR_API_KEY")
+
+# Create MCP server with multiple toolkits
+server = composio.mcp.create(
+ name="mcp-config-73840", # Pick a unique name for your MCP server
+ toolkits=[
+ {
+ "toolkit": "gmail",
+ "auth_config": "ac_xyz123" # Your Gmail auth config ID
+ },
+ {
+ "toolkit": "googlecalendar",
+ "auth_config": "ac_abc456" # Your Google Calendar auth config ID
+ }
+ ],
+ allowed_tools=["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL", "GOOGLECALENDAR_EVENTS_LIST"]
+)
+
+print(f"Server created: {server.id}")
+print(server.id)
+
+# Generate server instance for user
+instance = composio.mcp.generate(user_id="user-73840", mcp_config_id=server.id) # Use the user ID for which you created the connected account
+
+print(f"MCP Server URL: {instance['url']}")
\ No newline at end of file
diff --git a/fern/snippets/mcp/typescript/mastra-client.ts b/fern/snippets/mcp/typescript/mastra-client.ts
new file mode 100644
index 000000000..e333d5543
--- /dev/null
+++ b/fern/snippets/mcp/typescript/mastra-client.ts
@@ -0,0 +1,26 @@
+import { MCPClient } from "@mastra/mcp";
+import { openai } from "@ai-sdk/openai";
+import { Agent } from "@mastra/core/agent";
+
+// Use the MCP server URL you generated
+const MCP_URL = "https://backend.composio.dev/v3/mcp/YOUR_SERVER_ID?include_composio_helper_actions=true&user_id=YOUR_USER_ID";
+
+export const client = new MCPClient({
+ id: "docs-mcp-client",
+ servers: {
+ composio: { url: new URL(MCP_URL) },
+ }
+});
+
+export const agent = new Agent({
+ name: "Assistant",
+ description: "Helpful AI with MCP tools",
+ instructions: "Use the MCP tools to answer.",
+ model: openai("gpt-4-turbo"),
+ tools: await client.getTools()
+});
+
+(async () => {
+ const res = await agent.generate("What meetings do I have tomorrow? Also check if I have any urgent emails");
+ console.log(res.text);
+})();
\ No newline at end of file
diff --git a/fern/snippets/mcp/typescript/quickstart.ts b/fern/snippets/mcp/typescript/quickstart.ts
new file mode 100644
index 000000000..27cb4706f
--- /dev/null
+++ b/fern/snippets/mcp/typescript/quickstart.ts
@@ -0,0 +1,29 @@
+import { Composio } from '@composio/core';
+
+// Initialize Composio
+const composio = new Composio({
+ apiKey: process.env.COMPOSIO_API_KEY
+});
+
+// Create MCP server with multiple toolkits
+const server = await composio.mcp.create("mcp-config-73840", { // Pick a unique name for your MCP server
+ toolkits: [
+ {
+ authConfigId: "ac_xyz123", // Your Gmail auth config ID
+ toolkit: "gmail"
+ },
+ {
+ authConfigId: "ac_abc456", // Your Google Calendar auth config ID
+ toolkit: "googlecalendar"
+ }
+ ],
+ allowedTools: ["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL", "GOOGLECALENDAR_EVENTS_LIST"]
+});
+
+console.log(`Server created: ${server.id}`);
+console.log(server.id);
+
+// Generate server instance for user
+const instance = await composio.mcp.generate("user-73840", server.id); // Use the user ID for which you created the connected account
+
+console.log("MCP Server URL:", instance.url);
\ No newline at end of file
diff --git a/fern/snippets/mcp/typescript/vercel-client.ts b/fern/snippets/mcp/typescript/vercel-client.ts
new file mode 100644
index 000000000..e8baa7bbe
--- /dev/null
+++ b/fern/snippets/mcp/typescript/vercel-client.ts
@@ -0,0 +1,26 @@
+import { experimental_createMCPClient as createMCPClient } from 'ai';
+import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
+
+// Use the MCP server URL you generated
+const mcpServerUrl = "https://backend.composio.dev/v3/mcp/YOUR_SERVER_ID?include_composio_helper_actions=true&user_id=YOUR_USER_ID";
+
+// Create MCP client
+const mcpClient = await createMCPClient({
+ name: 'composio-mcp-client',
+ transport: new SSEClientTransport(new URL(mcpServerUrl)),
+});
+
+// Get available tools from the MCP server
+const tools = await mcpClient.tools();
+
+// Use with Vercel AI SDK
+import { generateText } from 'ai';
+import { openai } from '@ai-sdk/openai';
+
+const result = await generateText({
+ model: openai('gpt-4-turbo'),
+ tools: tools,
+ prompt: 'Send an email to [email protected] with meeting notes',
+});
+
+console.log(result.text);
\ No newline at end of file