Overview
Model Context Protocol (MCP) enables you to connect external servers that expose tools, resources, and prompts to your AI. This lets the AI call custom functions, access data sources, and follow structured workflows specific to your needs.Quick Start
Enable MCP inchat.config.ts:
Configuration
In chat.config.ts
Enable the integration:chat.config.ts
Environment Variables
Required (must be exactly 44 characters, base64-encoded 32 bytes):Creating Connectors
Add MCP server connectors from the Connectors settings page.- Go to Settings → Connectors
- Click “New Connector”
- Fill in the connector details:
- Name: A friendly name for your connector (e.g., “My Database Tool”)
- URL: The server endpoint (HTTP or SSE)
- Type: Choose
httporsse(Server-Sent Events) - OAuth Credentials (optional): If the server requires OAuth, provide the client ID and secret
Connection Types
HTTP Traditional request-response connections. The AI can call tools and fetch resources on demand. SSE (Server-Sent Events) Persistent streaming connections. Useful for servers that push updates or maintain state.OAuth Authorization
Some MCP servers require OAuth authorization. If a server supports dynamic client registration, the connector setup handles it automatically. For servers requiring pre-configured credentials:- Provide your OAuth client ID and secret during connector creation
- On first connection, you may be asked to authorize access
- Tokens are securely encrypted and stored in the database
How It Works
When you connect an MCP server:- The connector establishes a connection to the server at the URL you provided
- The server exposes tools, resources, and prompts to your AI
- During chat, the AI can call any of these tools as needed
- The server processes the request and returns the result
MCP_ENCRYPTION_KEY before being stored in the database.
Managing Connectors
From the Connectors settings page you can:- View all connected servers and their status
- Enable/Disable individual connectors without deleting them
- Update connector settings (name, URL, type, OAuth credentials)
- Delete connectors (removes the connection and all associated data)
- Disconnect OAuth sessions if authentication fails
Troubleshooting
Connection Failed- Verify the server URL is correct and accessible from your deployment
- Check that the server supports the connection type you selected (HTTP vs SSE)
- For Vercel deployments, ensure the server is publicly accessible (no local URLs)
- Verify your OAuth client ID and secret are correct
- Confirm the redirect URI is whitelisted on the server:
https://yourdomain.com/api/mcp/oauth/callback - Check that you authorized the requested scopes
- Verify the connector status is “connected” in the Connectors page
- Some servers may require additional configuration to expose tools
- Try disconnecting and reconnecting the server
Advanced Configuration
Encryption Security
TheMCP_ENCRYPTION_KEY protects:
- Server URLs
- OAuth client secrets
- OAuth tokens
- Any credentials stored in the connector
Using with Chat
MCP tools are automatically available in chat conversations. The AI:- Sees all tools from connected MCP servers
- Calls them based on the conversation context
- Receives and processes results in real-time