> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agent.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

> Connect Agent.ai tools to ChatGPT, Claude, Cursor, and other AI assistants.

## **Connect Agent.ai to Your AI Assistant**

> Use your Agent.ai tools with ChatGPT, Claude, Cursor, and other MCP-compatible applications

## What is MCP?

Model Context Protocol (MCP) allows AI assistants like ChatGPT and Claude to access your Agent.ai tools, agents, and actions. Once connected, you can ask your AI assistant to use any of your Agent.ai capabilities directly in conversation.

## Connection Methods

### ✨ Secure Sign-In (Recommended)

The easiest way to connect is using our secure sign-in method. Simply add Agent.ai to your AI assistant, and you'll sign in with your Agent.ai account - no API tokens needed!

**Server URL:** `https://mcp.agent.ai/mcp`

**Benefits:**

* ✅ Most secure - just sign in with your Agent.ai account
* ✅ Works with ChatGPT, Claude, Cursor, and other modern MCP clients
* ✅ No API tokens to copy or manage
* ✅ Automatic access to all your agents and tools

***

## Setup Instructions

Choose your AI assistant below for step-by-step instructions:

<Tabs>
  <Tab title="ChatGPT">
    ### Step 1: Open ChatGPT Settings

    Click on your profile icon in ChatGPT and select **Settings** from the dropdown menu.

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/chatgpt/chatgpt_step1.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=aeea20bf88170321b06c13a69761029c" alt="ChatGPT Settings" width="1370" height="1206" data-path="images/mcp/chatgpt/chatgpt_step1.jpg" />

    ***

    ### Step 2: Navigate to Apps & Connectors

    Go to the **Apps & Connectors** section and click on **Advanced Settings** to enable Developer mode.

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/chatgpt/chatgpt_step2.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=f596ed4105e4b861f557ef666f841509" alt="ChatGPT Apps & Connectors" width="1380" height="1212" data-path="images/mcp/chatgpt/chatgpt_step2.jpg" />

    ***

    ### Step 3: Enable Developer Mode

    Toggle on Developer mode to access connector features.

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/chatgpt/chatgpt_step3.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=8e67c22898eea5678497639a96ad1138" alt="ChatGPT Developer Mode" width="1366" height="1208" data-path="images/mcp/chatgpt/chatgpt_step3.jpg" />

    ***

    ### Step 4: Create New Connector

    Once in Developer Mode, click **Create (new connector)** in the top right of the "Apps and Connectors" section.

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/chatgpt/chatgpt_step4.0.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=1fa51f3d12a78dc052b378535ccb9e5b" alt="ChatGPT Create Button" width="1372" height="1214" data-path="images/mcp/chatgpt/chatgpt_step4.0.jpg" />

    Enter **Agent.ai Tools** as the name and paste this URL:

    ```
    https://mcp.agent.ai/mcp
    ```

    Select **OAuth** for authentication and click **Create**. You'll be taken to sign in with your Agent.ai account.

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/chatgpt/chatgpt_step4.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=cc11cb2147507caecd0f7ef047e56246" alt="ChatGPT Create Connector" width="902" height="1310" data-path="images/mcp/chatgpt/chatgpt_step4.jpg" />

    ***

    ### Step 5: Start Using Agent.ai

    Click the **"+"** icon in ChatGPT, select **"More"** from the dropdown, then select your Agent.ai connector.

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/chatgpt/chatgpt_step5.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=7cd2250cbfcbc79edc88c2ad7b0f0d66" alt="ChatGPT Use Connector" width="1360" height="1144" data-path="images/mcp/chatgpt/chatgpt_step5.jpg" />

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/chatgpt/chatgpt_step5.1.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=54df2490eebae585594fc8681b47b35b" alt="ChatGPT Select Agent.ai" width="1394" height="494" data-path="images/mcp/chatgpt/chatgpt_step5.1.jpg" />

    <Check>
      **You're all set!** All your Agent.ai tools and agents are now available in ChatGPT. Try asking ChatGPT to use one of your agents or actions!
    </Check>
  </Tab>

  <Tab title="Claude">
    ### Step 1: Open Claude Settings

    In [Claude](https://claude.ai), go to **Settings** → **Connectors** section, then click **"Add custom connector"**.

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/claude/claude.step1.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=90d4c358987bfb442bf29058179afdca" alt="Claude Settings" width="2438" height="1778" data-path="images/mcp/claude/claude.step1.jpg" />

    ***

    ### Step 2: Enter Name and URL

    Enter **Agent.ai Tools** as the name and paste this URL:

    ```
    https://mcp.agent.ai/mcp
    ```

    Click **"Add"** and you'll be taken to sign in with your Agent.ai account.

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/claude/claude.step2.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=feb07dc34a9095ce217872890caa6b9e" alt="Claude Add Connector" width="1088" height="926" data-path="images/mcp/claude/claude.step2.jpg" />

    ***

    ### Step 3: Enable and Start Chatting

    Click the **Tools icon** in Claude, toggle on your Agent.ai connector, and start using your tools!

    <img src="https://mintcdn.com/agentai/G4nQBlJJdQEu3WdT/images/mcp/claude/claude.step3.jpg?fit=max&auto=format&n=G4nQBlJJdQEu3WdT&q=85&s=54f5233695248f75dc5c9cdbc7fd8d87" alt="Claude Enable and Chat" width="1438" height="1274" data-path="images/mcp/claude/claude.step3.jpg" />

    <Check>
      **You're all set!** All your Agent.ai tools and agents are now available in Claude. Just mention your agents or ask Claude to use specific tools!
    </Check>
  </Tab>

  <Tab title="Cursor IDE">
    ### Setting Up in Cursor

    1. Open Cursor Settings
    2. Navigate to **MCP** or **Model Context Protocol** section
    3. Add a new MCP server with this configuration:

    ```json theme={null}
    {
      "agentai": {
        "url": "https://mcp.agent.ai/mcp"
      }
    }
    ```

    4. Restart Cursor
    5. You'll be prompted to sign in with your Agent.ai account

    <Check>
      **You're all set!** Your Agent.ai tools will appear in Cursor's AI assistant features.
    </Check>
  </Tab>
</Tabs>

***

## Security & Privacy

* ✅ Secure sign-in with your Agent.ai account
* ✅ AI assistants will always ask your permission before using tools
* ✅ You can approve tools once or for the entire conversation
* ✅ All communication is encrypted

***

## Troubleshooting

### Connection Issues

**"Can't connect" or "Authentication failed"**

* Make sure you're using the correct URL: `https://mcp.agent.ai/mcp`
* Try clearing your browser cache and signing in again
* Ensure you're logged into Agent.ai in your browser

**"No tools available"**

* Make sure you're signed in to Agent.ai
* Try disconnecting and reconnecting the Agent.ai connector

**AI assistant isn't using my tools**

* Make sure you've enabled the Agent.ai connector/tools in your conversation
* Try specifically mentioning the tool or agent by name

Still having issues? Contact our support team for help.

***

## Testing Your Connection

You can test your Agent.ai MCP server using the [Cloudflare MCP Playground](https://playground.ai.cloudflare.com/):

1. Visit [https://playground.ai.cloudflare.com/](https://playground.ai.cloudflare.com/)
2. Enter your MCP server URL: `https://mcp.agent.ai/mcp`
3. Click "Connect" and sign in with your Agent.ai account
4. The playground will list all your available tools
5. Test individual tools by selecting them and providing inputs

This is a great way to verify everything is working before using it with your AI assistant.

***

<Accordion title="Legacy Connection Methods (Alternative Options)">
  ### HTTP over SSE (Legacy)

  This method uses an API token instead of signing in. It still works but is not recommended for new setups.

  **For Claude Desktop:**

  1. Get your API token from the [integrations page](https://agent.ai/user/integrations)
  2. Open Claude Desktop Settings → Developer → Edit Config
  3. Add this configuration:

  ```json theme={null}
  {
    "mcpServers": {
      "agentai": {
        "command": "npx",
        "args": [
          "-y",
          "@modelcontextprotocol/server-sse",
          "https://mcp.agent.ai/YOUR_API_TOKEN_HERE/sse"
        ]
      }
    }
  }
  ```

  4. Replace `YOUR_API_TOKEN_HERE` with your actual API token
  5. Restart Claude Desktop

  ### Standard I/O (Legacy)

  This is the original connection method using our NPM package.

  1. Get your API token from the [integrations page](https://agent.ai/user/integrations)
  2. Open Claude Desktop Settings → Developer → Edit Config
  3. Add this configuration:

  ```json theme={null}
  {
    "mcpServers": {
      "agentai": {
        "command": "npx",
        "args": ["-y", "@agentai/mcp-server"],
        "env": {
          "API_TOKEN": "YOUR_API_TOKEN_HERE"
        }
      }
    }
  }
  ```

  4. Replace `YOUR_API_TOKEN_HERE` with your actual API token
  5. Restart Claude Desktop

  **Troubleshooting Legacy Methods:**

  * **"Connection refused"**: Verify your API token is correct and hasn't expired
  * **"Authentication failed"**: Get a fresh token from the [integrations page](https://agent.ai/user/integrations)
  * **NPM errors**: Ensure you have Node.js installed and npx is available
</Accordion>

***

<Accordion title="For Developers & Advanced Users">
  ## Technical Details

  ### Server Configuration

  Agent.ai's MCP server implements secure authentication with automatic client registration.

  **Endpoints:**

  * MCP Server: `https://mcp.agent.ai/mcp`
  * OAuth Discovery: `https://mcp.agent.ai/.well-known/oauth-authorization-server`
  * Health Check: `https://mcp.agent.ai/health`

  ### Authentication Flow

  1. Client discovers OAuth endpoints via `.well-known/oauth-authorization-server`
  2. Client automatically registers using Dynamic Client Registration (DCR)
  3. User is redirected to authenticate with their Agent.ai account
  4. Authorization code is exchanged for an access token
  5. Client uses Bearer token for MCP requests

  ### Security Features

  * OAuth 2.1 with PKCE (Proof Key for Code Exchange)
  * JWT access tokens validated against Auth0
  * Automatic token refresh for long-lived sessions
  * Dynamic client registration (no pre-configuration needed)

  ### Available Tools

  All your Agent.ai agents and tools are automatically available through the MCP server, including:

  * Action Tools: Core Agent.ai capabilities
  * Team Agents: Shared within your organization
  * Private Agents: Your personal agents
  * Public Agents: Community agents you've added

  ### Protocol Support

  The server supports multiple MCP protocol versions:

  * 2024-11-05
  * 2025-03-26

  Version negotiation happens automatically during client initialization.

  ### Integration Example

  For custom MCP clients:

  ```javascript theme={null}
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';

  const client = new Client({
    name: 'my-mcp-client',
    version: '1.0.0',
  }, {
    capabilities: {}
  });

  // Connect with OAuth support
  await client.connect('https://mcp.agent.ai/mcp');

  // List available tools
  const tools = await client.request({
    method: 'tools/list'
  }, ListToolsResultSchema);

  // Call a tool
  const result = await client.request({
    method: 'tools/call',
    params: {
      name: 'tool-name',
      arguments: { /* tool arguments */ }
    }
  }, CallToolResultSchema);
  ```

  ### NPM Package

  The legacy NPM package is available at:
  [https://www.npmjs.com/package/@agentai/mcp-server](https://www.npmjs.com/package/@agentai/mcp-server)

  Note: New integrations should use the OAuth method instead of the NPM package.
</Accordion>

***

For additional help or to report issues, please contact our support team.
