MCP Integration

Connect external tools and services to ChatRAG using the Model Context Protocol (MCP). Integrate with Zapier for Gmail, Calendar, Drive, and add custom MCP servers.

What MCP Enables

Tool Execution

Execute actions in external services directly from chat conversations

Data Access

Retrieve information from connected services in real-time

Approval Flows

User approval required before executing sensitive operations

Multi-Step Workflows

Chain multiple tool calls to handle complex tasks

Zapier MCP (Pre-configured)

ChatRAG comes with Zapier MCP already configured! You just need to add your Zapier MCP endpoint URL to start using it.

Setup Steps:

1

Get Your Zapier MCP Endpoint

Visit Zapier and navigate to the MCP integrations section to get your endpoint URL.

Your endpoint will look like:

https://mcp.zapier.com/api/mcp/s/[YOUR-TOKEN]/mcp
2

Configure in ChatRAG

Open the Config UI and add your Zapier MCP endpoint:

npm run config
# Navigate to: MCP → Zapier Configuration
# Paste your endpoint URL
# Click Save

Or set directly in .env.local:

MCP_ZAPIER_ENDPOINT=https://mcp.zapier.com/api/mcp/s/[YOUR-TOKEN]/mcp
3

Enable MCP System

Enable MCP in your configuration:

NEXT_PUBLIC_MCP_SYSTEM_ENABLED=true
NEXT_PUBLIC_MCP_TOOLS_LIST_ENABLED=true
4

Test Your Integration

Restart your dev server and try these queries:

Example queries:

  • "Fetch my last 5 emails"
  • "Check my calendar for tomorrow"
  • "Upload this image to Google Drive"
  • "Draft a reply to the last email"

Pre-configured Zapier Tools

ChatRAG has pattern-based detection for these Zapier MCP tools:

Gmail - Find Email

High Confidence

Search and retrieve emails from Gmail

Example queries:

  • "fetch my last 5 emails"
  • "show recent emails from john@example.com"
  • "check my inbox"

Gmail - Create Draft

Medium Confidence

Create email drafts in Gmail

Example queries:

  • "draft an email to john@example.com"
  • "create a gmail draft about meeting"

Gmail - Reply to Email

High Confidence

Send replies to emails

Example queries:

  • "reply to john's email saying yes"
  • "send a reply to the last email"

Google Calendar - Find Event

Medium Confidence

Search calendar events

Example queries:

  • "check my calendar for Monday"
  • "what's scheduled for tomorrow?"
  • "show my meetings this week"

Google Drive - Upload File

High Confidence

Upload files to Google Drive

Example queries:

  • "upload this image to drive"
  • "save to google drive"

Adding Custom MCP Servers

Beyond Zapier, you can connect any MCP-compatible server to ChatRAG.

Step-by-Step Guide:

1. Open Config UI

npm run config

Navigate to: MCP → Custom Servers

2. Click "Add Server"

Fill in the server details:

FieldDescription
Server NameDisplay name (e.g., "Notion API")
Transport TypeHTTP, SSE, or WebSocket
Endpoint URLYour MCP server endpoint
Auth MethodBearer, API Key, Basic, or None
CredentialsToken/key based on auth method

3. Configure Availability

Choose where the server is available:

  • Chat: Enable in main chat interface
  • Embed: Enable in embedded widget

4. Discover Tools

Click "Discover Tools" to enumerate available tools from the server

5. Test Connection

Use the "Test Connection" button to verify your server is accessible and responding correctly

Configuration Options

YOLO Mode

Auto-approve tool execution without user confirmation

NEXT_PUBLIC_MCP_YOLO_MODE_ENABLED=true

Tools List

Show available MCP tools in the UI

NEXT_PUBLIC_MCP_TOOLS_LIST_ENABLED=true

Custom Servers

Configure multiple custom servers via environment

MCP_CUSTOM_SERVERS=[
  {
    "name": "My Custom Server",
    "transport": "http",
    "endpoint": "https://my-server.com/mcp",
    "auth": "bearer",
    "token": "..."
  }
]

Best Practices

Start with Approval Flow

Keep YOLO mode disabled initially to review tool executions before trusting them

Test Tools Individually

Verify each tool works correctly before combining them in workflows

Monitor Tool Usage

Check logs and approval prompts to understand tool behavior

Secure Credentials

Keep API tokens and auth credentials in environment variables, never in code

Health Monitoring

Use the health check endpoints to monitor MCP server availability

Troubleshooting

Tools not appearing

Solutions:

  • Verify NEXT_PUBLIC_MCP_SYSTEM_ENABLED=true
  • Check that your endpoint URL is correct
  • Click "Discover Tools" in Config UI
  • Check browser console for connection errors

Tool execution fails

Solutions:

  • Verify authentication credentials are correct
  • Check the server health endpoint
  • Review approval prompt for parameter issues
  • Check MCP server logs for errors

Connection timeout

Solutions:

  • Verify the endpoint URL is accessible
  • Check firewall and network settings
  • Ensure the MCP server is running
  • Try increasing timeout settings if needed