Skip to content

MCP Server Configuration

RAPID supports MCP (Model Context Protocol) servers to extend AI agent capabilities with external tools, data sources, and services.

MCP servers provide AI agents with access to:

  • Documentation context - Library and framework documentation
  • Web search - Real-time information retrieval
  • Browser automation - Web scraping and testing
  • Database access - Query and manage databases
  • File system - Read and write files
  • Memory - Persistent knowledge graphs

When initializing a new RAPID project, you can specify which MCP servers to enable:

Terminal window
# Default setup (context7 + tavily)
rapid init
# Specify servers
rapid init --mcp context7,tavily,playwright
# Skip MCP configuration
rapid init --no-mcp

Use the rapid mcp command to manage servers:

Terminal window
# List configured servers
rapid mcp list
# Show available templates
rapid mcp list --templates
# Add a server from template
rapid mcp add playwright
# Add a custom server
rapid mcp add myserver --type remote --url https://api.example.com/mcp
# Enable/disable servers
rapid mcp disable tavily
rapid mcp enable tavily
# Remove a server
rapid mcp remove playwright
# Show server status
rapid mcp status
# Regenerate config files
rapid mcp sync

RAPID includes built-in templates for popular MCP servers:

ServerTypeDescriptionRequired Secrets
context7RemoteDocumentation context for librariesCONTEXT7_API_KEY
tavilyRemoteWeb search and data extractionTAVILY_API_KEY
playwrightStdioBrowser automation and web scrapingNone
githubStdioGitHub operations (PRs, issues)GITHUB_TOKEN
filesystemStdioFile system accessNone
memoryStdioPersistent knowledge graphNone
postgresStdioPostgreSQL database accessDATABASE_URL
slackStdioSlack messagingSLACK_TOKEN
fetchStdioHTTP content retrievalNone
sqliteStdioSQLite database accessNone

RAPID includes a centralized MCP server that provides all agents with project-aware tools. This server runs as a centralized service (not per-agent) so that all agents share the same state—critical for features like the event bus.

The server uses the Streamable HTTP transport (the recommended MCP transport for server-based deployments), enabling efficient bidirectional communication with support for server-sent events (SSE).

flowchart TB
    Claude["Claude Agent"]
    OpenCode["OpenCode Agent"]
    Aider["Aider Agent"]

    subgraph MCPServer["RAPID MCP Server (Centralized)"]
        EventBus["Event Bus"]
        Secrets["Secrets"]
        Filesystem["Filesystem"]
        Context["Context"]
    end

    Claude --> MCPServer
    OpenCode --> MCPServer
    Aider --> MCPServer

The server runs in the RAPID daemon and all agents connect to it via HTTP.

ToolDescription
bus_registerRegister agent with the event bus
bus_sendSend a message to other agents
bus_messagesGet messages from the event bus
bus_agentsList connected agents
secure_execExecute commands in a sandboxed environment
get_secretRetrieve a secret by name
list_secretsList available secret names
read_fileRead a file with path validation
write_fileWrite a file with path validation
list_directoryList directory contents
fetch_urlFetch content from a URL
ResourceDescription
rapid://configCurrent rapid.json configuration
rapid://contextAssembled project context
rapid://statusProject status (files, agents, bus)
PromptDescription
rapid-methodologyRAPID development methodology guide

The RAPID MCP server is automatically configured to run centrally:

rapid.json
{
"mcp": {
"servers": {
"rapid": {
"enabled": true,
"type": "remote",
"url": "http://localhost:${RAPID_MCP_PORT}/mcp"
}
}
}
}

The server starts automatically when you run rapid dev. The port is managed by the RAPID daemon.

You can disable it (not recommended):

{
"mcp": {
"servers": {
"rapid": {
"enabled": false
}
}
}
}

Shared State: All agents connect to the same server, enabling:

  • Event bus messages visible to all agents
  • Consistent secret access
  • Coordinated file operations

Efficiency: One server process instead of N (one per agent).

Coordination: The server can mediate between agents, preventing conflicts.

Agents can use these tools directly:

Agent: "I'll check what other agents are working on"
→ Uses bus_agents tool
Agent: "Let me notify the team about the API changes"
→ Uses bus_send tool
Agent: "I need the database password"
→ Uses get_secret tool

See the Multi-Agent Guide for detailed event bus usage.

MCP servers are configured in the mcp section:

{
"mcp": {
"configFile": ".mcp.json",
"servers": {
"context7": {
"enabled": true,
"type": "remote",
"url": "https://mcp.context7.com/mcp",
"headers": {
"Context7-API-Key": "${CONTEXT7_API_KEY}"
}
},
"tavily": {
"enabled": true,
"type": "remote",
"url": "https://mcp.tavily.com/mcp",
"headers": {
"Authorization": "Bearer ${TAVILY_API_KEY}"
}
},
"playwright": {
"enabled": true,
"type": "stdio",
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}
}

Remote servers communicate over HTTP:

{
"myserver": {
"type": "remote",
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer ${API_KEY}"
}
}
}

Stdio servers run as local processes:

{
"myserver": {
"type": "stdio",
"command": "npx",
"args": ["@example/mcp-server"],
"env": {
"API_KEY": "${API_KEY}"
}
}
}

Server configurations support variable substitution:

SyntaxDescription
${VAR}Environment variable
${env:VAR}Environment variable from container
${localEnv:VAR}Environment variable from host

RAPID generates two config files from your rapid.json:

Used by Claude Code and other MCP-compatible tools:

{
"mcpServers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"Context7-API-Key": "${CONTEXT7_API_KEY}"
}
}
}
}

Used by OpenCode with its specific format:

{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"context7": {
"type": "remote",
"url": "https://mcp.context7.com/mcp",
"headers": {
"Context7-API-Key": "{env:CONTEXT7_API_KEY}"
}
}
}
}

Most MCP servers require API keys or tokens. Configure these in the secrets.items section:

{
"secrets": {
"provider": "1password",
"vault": "Development",
"items": {
"CONTEXT7_API_KEY": "op://Development/Context7/api-key",
"TAVILY_API_KEY": "op://Development/Tavily/api-key",
"GITHUB_TOKEN": "op://Development/GitHub/pat"
}
}
}
ServerWhere to Get Key
Context7context7.com
Tavilytavily.com
GitHubgithub.com/settings/tokens
Slackapi.slack.com/apps

Once configured, MCP servers are automatically available to your AI agents during rapid dev:

  1. RAPID loads secrets from your secret provider
  2. Generates .mcp.json and opencode.json with resolved references
  3. Sets MCP_CONFIG_FILE environment variable
  4. Launches the agent with MCP servers available
Terminal window
# 1. Initialize project with MCP
rapid init --mcp context7,tavily
# 2. Add your API keys to secrets
# Edit rapid.json secrets.items
# 3. Verify secrets are accessible
rapid secrets verify
# 4. Start development with MCP servers
rapid dev

You can add any MCP-compatible server:

Terminal window
# Add a custom remote server
rapid mcp add myapi \
--type remote \
--url https://api.example.com/mcp \
--header "Authorization=Bearer ${API_KEY}"
# Add a custom stdio server
rapid mcp add mytool \
--type stdio \
--command npx \
--args "@example/mcp-server,--config,./config.json"

If a server doesn’t appear in agent tools:

  1. Check it’s enabled: rapid mcp status
  2. Verify secrets: rapid secrets verify
  3. Regenerate configs: rapid mcp sync

If you get authentication errors:

  1. Verify the API key is correct
  2. Check the header format matches the server’s requirements
  3. Ensure secrets are loaded: rapid secrets list

If a stdio server won’t start:

  1. Check the command is installed: which npx
  2. Verify the package exists
  3. Check for error messages in agent output