loading…
Search for a command to run...
loading…
Modular MCP - Modular tool access for reducing context overhead
Modular MCP - Modular tool access for reducing context overhead
License CI GitHub Release DeepWiki
A Model Context Protocol (MCP) proxy server that enables efficient management of large tool collections across multiple MCP servers by grouping them and loading tool schemas on-demand.
Traditional MCP setups can overwhelm LLM context when dealing with numerous tools from multiple servers. Modular MCP solves this by:
Create a configuration file (e.g., modular-mcp.json) for the upstream MCP servers you want to manage. This uses the standard MCP server configuration format, with one addition: a description field for each server.
Here's an example using Context7 and Playwright MCP servers:
{
+ "$schema": "https://raw.githubusercontent.com/d-kimuson/modular-mcp/refs/heads/main/config-schema.json",
"mcpServers": {
"context7": {
+ "description": "Use when you need to search library documentation.",
- "type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"],
"env": {}
},
"playwright": {
+ "description": "Use when you need to control or automate web browsers.",
- "type": "stdio",
"command": "npx",
"args": ["-y", "@playwright/mcp@latest"],
"env": {}
}
}
}
The description field is the only extension to the standard MCP configuration. It helps the LLM understand each tool group's purpose without loading detailed tool schemas.
Note: The type field defaults to "stdio" if not specified. For stdio type servers, you can omit the type field for cleaner configuration.
Modular MCP supports environment variable interpolation in configuration files, allowing you to avoid committing sensitive information like API keys and tokens to version control.
Supported syntax:
${VAR} - Braced variable referenceNote: Only the ${VAR} syntax is supported. The $VAR syntax (without braces) is intentionally not supported to avoid conflicts with values that legitimately contain dollar signs (e.g., tokens like token$abc123).
Where interpolation is supported:
stdio servers: args array elements and env object valueshttp/sse servers: url string and headers object valuesExample:
{
"mcpServers": {
"my-server": {
"description": "Example server with environment variables",
"command": "node",
"args": ["${HOME}/.local/bin/server.js", "--config=${XDG_CONFIG_HOME}/app/config.json"],
"env": {
"API_KEY": "${MY_API_KEY}",
"LOG_DIR": "${HOME}/logs"
}
},
"api-server": {
"description": "HTTP server with authentication",
"type": "http",
"url": "https://api.example.com",
"headers": {
"Authorization": "Bearer ${API_TOKEN}"
}
}
}
}
Important notes:
${UNDEFINED_VAR}) will be preservedRegister Modular MCP in your MCP client configuration (e.g., .mcp.json for Claude Code):
{
"mcpServers": {
"modular-mcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@kimuson/modular-mcp", "modular-mcp.json"],
"env": {}
}
}
}
When Modular MCP starts, it registers only two tools to the LLM:
get-modular-tools: Retrieves tool name and schemas for a specific groupcall-modular-tool: Executes a tool from a specific groupThe get-modular-tools tool description includes information about available groups, like this:
modular-mcp manages multiple MCP servers as organized groups, providing only the necessary group's tool descriptions to the LLM on demand instead of overwhelming it with all tool descriptions at once.
Use this tool to retrieve available tools in a specific group, then use call-modular-tool to execute them.
Available groups:
- context7: Use when you need to search library documentation.
- playwright: Use when you need to control or automate web browsers.
This description is passed to the LLM as part of the system prompt, allowing it to discover available groups without making any tool calls.
The LLM can now load and use tools on a per-group basis:
get-modular-tools with group="playwright"call-modular-tool to execute specific tools like browser_navigateFor example, to automate a web browser:
get-modular-tools(group="playwright")
→ Returns all playwright tool schemas
call-modular-tool(group="playwright", name="browser_navigate", args={"url": "https://example.com"})
→ Executes the navigation through the playwright MCP server
This workflow keeps context usage minimal while providing access to all tools when needed.
If you already have a standard MCP configuration file (e.g., .mcp.json), you can easily migrate it to Modular MCP format using the built-in migration command.
Run the migration command with your existing MCP configuration file:
npx -y @kimuson/modular-mcp migrate <mcp-config-file-path>
For example, if you have a .mcp.json file:
npx -y @kimuson/modular-mcp migrate .mcp.json
The migration command will:
modular-mcp.json file with the migrated configuration (defaults to modular-mcp.json in the current directory, or use -o to specify a custom path)modular-mcp.json fileModular MCP supports OAuth-based authentication for remote MCP servers using both sse and http transports.
Modular MCP includes an experimental OAuth client that implements the MCP Authorization specification:
{
"mcpServers": {
"linear-server": {
"description": "Use when you want to check Linear tickets, etc.",
"type": "sse",
"url": "https://mcp.linear.app/sse"
}
}
}
On first connection, your browser will open for OAuth authentication. Tokens are stored locally in ~/.modular-mcp/oauth-servers/ and reused automatically.
Note: This feature is experimental. If you encounter issues, use the fallback method below.
For compatibility with all OAuth servers, you can use mcp-remote via stdio transport:
{
"mcpServers": {
"linear-server": {
"description": "Use when you want to check Linear tickets, etc.",
"type": "stdio",
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp.linear.app/sse"]
}
}
}
This approach delegates OAuth handling to the mcp-remote client and is recommended if the experimental OAuth support doesn't work for your server.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"modular-mcp": {
"command": "npx",
"args": [
"-y",
"@kimuson/modular-mcp"
]
}
}
}Web content fetching and conversion for efficient LLM usage.
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also