MCP Integration
MCP Integration
Doforu supports the Model Context Protocol (MCP), allowing you to plug external tools and services into your local AI coding assistant seamlessly. Through MCP, the Agent can invoke external capabilities such as database queries, web searches, and browser automation.
What Is MCP
MCP is an open protocol that standardizes communication between AI assistants and external tools. Any server that implements MCP can be discovered and used by Doforu, while your sensitive data and credentials stay local.
Configuration File
MCP is configured via mcp.json:
{
"mcpServers": {
"time": {
"transport": "stdio",
"command": "node",
"args": ["./mcp-servers/time-server/index.js"]
},
"similarweb": {
"transport": "stdio",
"command": "node",
"args": ["mcp-servers/similarweb-server.js"],
"env": {
"API_KEY": "your-api-key"
},
"disabled": false,
"timeout": 5000
}
}
}
Field Reference
| Field | Type | Description |
|-------|------|-------------|
| transport | string | Communication type: stdio, http, or sse |
| command | string | stdio only, the executable command |
| args | string[] | stdio only, command arguments |
| env | object | stdio only, environment variables |
| cwd | string | stdio optional, working directory |
| url | string | http/sse only, server URL |
| headers | object | http/sse only, custom request headers |
| disabled | boolean | Whether to disable the server (default false) |
| timeout | number | Connection and call timeout in ms (default 2000) |
Configuration File Locations
Doforu searches for mcp.json in the following priority (first existing file wins):
- CLI flag:
--mcp-config /path/to/mcp.json - Environment variable:
MCP_CONFIG_PATH=/path/to/mcp.json - User config:
~/.doforu/mcp.json(recommended for desktop app users) - Project config:
mcp.jsonin the current working directory
Tip: Desktop users should place
mcp.jsonin~/.doforu/mcp.jsonso it won't be overwritten accidentally by project code.
Multi-Client Compatibility
In addition to its own configuration, Doforu can detect and import settings from other popular MCP clients:
| Client | Config File Path |
|--------|------------------|
| Cursor (project) | .cursor/mcp.json |
| Cursor (global) | ~/.cursor/mcp.json |
| Claude Desktop | ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)%APPDATA%\Claude\claude_desktop_config.json (Windows) |
In the Settings page, you can switch the configuration source with one click and import MCP servers from Cursor or Claude Desktop into Doforu.
Environment Variable Interpolation
mcp.json supports the ${ENV_VAR} syntax to reference environment variables:
{
"mcpServers": {
"github": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
Special variables ${HOME} and ${USERPROFILE} are automatically mapped to the current user's home directory for cross-platform compatibility.
stdio Path Resolution
For stdio servers, Doforu automatically resolves paths inside args:
- Absolute paths: normalized and used directly
- Relative paths: resolved against the
backenddirectory (or theBACKEND_DIRenvironment variable when running inside Electron) - If the resolved path does not exist, the original value is passed through unchanged
Disabling and Enabling Servers
You can temporarily disable an MCP server by setting disabled: true without removing its configuration:
{
"mcpServers": {
"experimental-server": {
"transport": "stdio",
"command": "node",
"args": ["./experimental.js"],
"disabled": true
}
}
}
Disabled servers are skipped during startup and consume no resources.
Reloading MCP Configuration
After modifying mcp.json, you can apply the changes via:
- Settings page: Settings → MCP → saving the config triggers an automatic reload
- API endpoint:
POST /api/mcp/reload
During reload, Doforu will:
- Close existing MCP connections
- Read the latest configuration
- Reconnect all enabled servers
- Fetch the available tool list and register it with the Agent
Troubleshooting
If an MCP server fails to connect, check the logs for the specific cause:
ENOENT/not found: the command or script path does not existtimeout/ETIMEDOUT: connection timed out; try increasing thetimeoutvalue- Other errors: look for
connect_failedevents from theMCPmodule in Doforu logs
A server that fails to connect is skipped and does not affect other servers or the Agent's normal operation.