List MCP Servers
Retrieve all configured MCP servers and their connection status.MCP Server Configuration
Configure MCP servers in~/.openfang/config.toml:
stdio Transport
Run an MCP server as a subprocess:HTTP Transport
Connect to a remote MCP server over HTTP:SSE Transport
Connect to an MCP server using Server-Sent Events:Tool Discovery
When an MCP server connects, OpenFang automatically:- Discovers tools — Sends
tools/listJSON-RPC request - Prefixes tool names — Adds
mcp_{server}_prefix to avoid conflicts - Registers tools — Makes tools available to agents
- Caches schemas — Stores input schemas for validation
filesystem MCP server’s read_file tool becomes mcp_filesystem_read_file.
Agent MCP Configuration
Agents can configure which MCP servers they use:agent.toml
MCP HTTP Endpoint
OpenFang exposes an MCP HTTP endpoint to allow external MCP clients to use OpenFang tools.POST /mcp
Send JSON-RPC 2.0 requests to interact with OpenFang tools via MCP.Always
"2.0"JSON-RPC method:
tools/list— List available toolstools/call— Execute a toolresources/list— List resources (future)prompts/list— List prompts (future)
Method parameters (varies by method)
Request ID (must match response)
Connection Status
MCP server connections are monitored continuously:- Connected — Server is reachable and tools are available
- Disconnected — Server is unreachable (will retry)
- Failed — Server configuration error
Error Handling
MCP tool calls can fail for various reasons:- Server disconnected — Retry with exponential backoff
- Tool not found — Check tool name and server connection
- Invalid input — Validate against
input_schema - Execution error — Server returned error response
- Timestamp
- Server name
- Tool name
- Error message
- Request/response payload (if debug enabled)
Supported MCP Servers
OpenFang is compatible with all MCP-compliant servers, including:- @modelcontextprotocol/server-filesystem — File operations
- @modelcontextprotocol/server-github — GitHub integration
- @modelcontextprotocol/server-postgres — PostgreSQL queries
- @modelcontextprotocol/server-sqlite — SQLite queries
- @modelcontextprotocol/server-slack — Slack integration
- @modelcontextprotocol/server-gdrive — Google Drive access
- Custom MCP servers — Any MCP-compliant implementation
Best Practices
Use stdio transport for local tools
Use stdio transport for local tools
For tools that run locally (filesystem, git, etc.), use stdio transport:This avoids network overhead and improves performance.
Use HTTP transport for remote services
Use HTTP transport for remote services
For cloud APIs or remote tools, use HTTP transport:
Prefix tool names to avoid conflicts
Prefix tool names to avoid conflicts
OpenFang automatically prefixes MCP tools with
mcp_{server}_, but you can also:- Use unique server names in config
- Filter tools in agent manifests
- Rename tools in server configuration
Monitor MCP server logs
Monitor MCP server logs
Check logs for connection issues:
Set environment variables for secrets
Set environment variables for secrets
Never hardcode API keys in MCP server configs:Then set the env var:
Next Steps
Agents API
Configure agent MCP servers
Skills API
Compare with OpenFang skills
MCP Specification
Learn about MCP protocol
Tool Development
Build custom tools
