Documentation Index
Fetch the complete documentation index at: https://mintlify.com/antinomyhq/forge/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Model Context Protocol (MCP) allows AI agents to communicate with external tools and services. This implementation follows Anthropic’s Model Context Protocol design, enabling powerful integrations with web browsers, APIs, and custom services.
Configuration
Using the CLI
The recommended way to configure MCP servers is through Forge’s CLI commands:
# List all configured MCP servers
forge mcp list
# Add a new server interactively
forge mcp add
# Add a server using JSON format
forge mcp add-json
# Get details about a specific server
forge mcp get
# Remove a server
forge mcp remove
Manual Configuration
You can also manually create or edit .mcp.json configuration files. MCP configurations are read from two locations in order of precedence:
- Local configuration (project-specific):
.mcp.json in your project directory
- User configuration (user-specific):
~/.config/forge/.mcp.json
Configuration Structure
{
"mcpServers": {
"server_name": {
"command": "command_to_execute",
"args": ["arg1", "arg2"],
"env": { "ENV_VAR": "value" }
},
"another_server": {
"url": "http://localhost:3000/events"
}
}
}
Configuration Examples
Command-based Server
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/files"],
"env": {
"NODE_ENV": "production"
}
}
}
}
HTTP-based Server
{
"mcpServers": {
"api_server": {
"url": "https://api.example.com/mcp"
}
}
}
Browser Automation
{
"mcpServers": {
"puppeteer": {
"command": "node",
"args": ["/path/to/mcp-server-puppeteer/build/index.js"],
"env": {
"BROWSER_PATH": "/usr/bin/chromium"
}
}
}
}
Server Lifecycle
Connection Initialization
When Forge starts or when the MCP configuration changes:
The configuration is read from both user and local scopes
Configurations are merged with local settings taking precedence
Each enabled server is connected concurrently
Retrieves the list of available tools from each server
Generates unique tool names prefixed with mcp_{server_name}_tool_
Makes these tools available to AI agents
MCP server tool lists are cached based on configuration hash
Cache is automatically invalidated when configuration changes
Use forge mcp reload to manually refresh the cache
If a server fails to connect:
The error is logged but doesn’t prevent other servers from connecting
Failed servers are tracked and their errors are available via forge mcp list
You can retry by reloading the MCP configuration
Use Cases
Web Browser Automation
Enable agents to control a web browser for testing, scraping, or automation tasks.
{
"mcpServers": {
"browser": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}
External API Interactions
Connect to REST APIs or other web services.
{
"mcpServers": {
"github_api": {
"command": "node",
"args": ["/path/to/github-mcp-server/index.js"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
Database Access
Allow agents to query databases for information.
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_CONNECTION_STRING": "postgresql://user:pass@localhost:5432/db"
}
}
}
}
Multi-Agent Workflows
MCP tools can be used as part of multi-agent workflows, allowing specialized agents to interact with external systems:
# Agent can use MCP tools automatically
forge "Use the browser tool to navigate to example.com and extract the page title"
Security Considerations
- MCP servers run with the same permissions as Forge
- Only configure servers from trusted sources
- Be cautious with environment variables containing sensitive data
- Consider using local configuration for project-specific servers
- Review server capabilities before enabling them
Troubleshooting
Server Not Connecting
- Check that the command and arguments are correct
- Verify environment variables are set properly
- Use
forge mcp list to see error details
- Check server logs if available
- Ensure the server connected successfully
- Verify the server implements the MCP protocol correctly
- Try reloading with
forge mcp reload
- Reduce the number of concurrent MCP servers
- Check if servers are responding slowly
- Consider disabling unused servers
Advanced Configuration
Disabling a Server
To temporarily disable a server without removing it, add a disabled field:
{
"mcpServers": {
"server_name": {
"command": "...",
"disabled": true
}
}
}
Environment Variable Expansion
Environment variables in the env section use standard shell syntax:
{
"mcpServers": {
"api_server": {
"command": "node",
"args": ["server.js"],
"env": {
"API_KEY": "${MY_API_KEY}",
"DEBUG": "true"
}
}
}
}