Skip to content

Configuration File

ravitemer edited this page Mar 31, 2025 · 1 revision

Configuration File

The servers.json file (default: ~/.config/mcphub/servers.json) contains MCP server configurations.

Basic MCP Server Configuration

{
    "mcpServers": {
        "fetch": {
            "command": "uvx",
            "args": ["mcp-server-fetch"],
            "env": {
                "API_KEY": "",                 // Falls back to process.env.API_KEY
                "SERVER_URL": null,            // Falls back to process.env.SERVER_URL
                "DEBUG": "true"               // Direct value, no fallback
            }
        }
    }
}

MCPHub Additional Features

MCPHub.nvim adds several management keys to each server config:

Server State Management

{
    "mcpServers": {
        "fetch": {
            "command": "uvx",
            "args": ["mcp-server-fetch"],
            "env": {},
            // MCPHub additions:
            "disabled": false,              // Disable entire server
            "disabled_tools": [             // Disable specific tools
                "expensive-tool"
            ],
            "disabled_resources": [         // Disable specific resources
                "resource://fetch/large-data"
            ],
            "disabled_resourceTemplates": [ // Disable resource templates
                "resource://{project}/data",
                "resource://fetch/{type}/{id}"
            ],
            "custom_instructions": {        // Server-specific instructions
                "disabled": false,
                "text": "Instructions for this server"
            }
        }
    }
}

Native Server State

MCPHub also adds a nativeMCPServers key to store state for Lua Native MCP Servers:

{
    "mcpServers": { ... },
    "nativeMCPServers": {
        "neovim": {
            "disabled": false,
            "disabled_tools": [],
            "disabled_resources": [],
            "custom_instructions": {
                "disabled": false,
                "text": ""
            }
        }
    }
}

Usage Notes

  • File is created automatically if not present
  • Users only need to add MCP server-specific config (command, args, env)
  • State management keys can be updated through MCPHub UI
  • Environment variables in env:
    • Empty string ("") falls back to process.env
    • null ignores process.env fallback
    • Direct values are used as provided