programmatic-mcp
A meta MCP server that orchestrates other MCP servers by lazily connecting to them and exposing their tools as JavaScript libraries. It allows users to execute JavaScript code that programmatically interacts with multiple MCP servers within a unified environment.
README
programmatic-mcp
A meta MCP server that:
- lists MCP servers available in a preset
- connects to preset servers on startup
- exposes approved server tools to
execute_code()as JavaScript libraries - stores
consoleoutput separately through log tools
Config is read from $XDG_CONFIG_HOME/programmatic-mcp/config.json. If XDG_CONFIG_HOME is not set, it falls back to ~/.config/programmatic-mcp/config.json.
Run
node src/index.js
node src/index.js my-preset
The only optional argument is the preset name. If omitted, default is used.
Config
servers uses the same local or remote format as OpenCode MCP config.
presets decides which servers are visible and which tools from each server are allowed.
Server names must be valid JavaScript identifiers because execute_code() exposes them directly as globals.
Example:
{
"servers": {
"math": {
"type": "local",
"command": ["node", "/absolute/path/to/math-server.js"]
},
"docs": {
"type": "remote",
"url": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer {env:DOCS_TOKEN}"
}
}
},
"presets": {
"default": {
"servers": {
"math": {
"tools": ["add", "multiply"]
},
"docs": {
"tools": ["search", "fetch_page"]
}
}
},
"math-only": ["math"]
}
}
Accepted preset forms:
"preset": ["server-a", "server-b"]"preset": { "servers": { "server-a": true } }"preset": { "servers": { "server-a": { "tools": ["tool1"] } } }
Tool rules:
true, omittedtools, or"*"means all tools from that servertools: ["name"]restricts access to the listed toolsfalseorenabled: falseremoves that server from the preset
OpenCode-style {env:NAME} and {file:path} substitutions are supported.
Exposed Tools
list_serverslist_toolsexecute_codefetch_logsclear_logs
Behavior
- preset servers are started when
programmatic-mcpstarts list_servers()returns which servers started successfully and any startup errorslist_tools(server)returns only the tools allowed for that server in the presetexecute_code(code)does not manage server lifecycle; it can only use servers that are already startedconsole.log,console.info,console.warn, andconsole.errorinsideexecute_code()are stored forfetch_logs()fetch_logs()drains the log buffer on read
execute_code
execute_code runs JavaScript as the body of an async function.
Started servers are injected as globals. Each allowed MCP tool becomes a function on that server object. Prefer underscore aliases when available.
Example:
return await math.add({ a: 2, b: 5 });
If the MCP tool returns structuredContent, that is what the JavaScript call resolves to. So the example above can return:
{
"sum": 7
}
If a tool name is not a valid JavaScript identifier, prefer its underscore alias:
return await math.tool_name({ value: 1 });
The original tool name still works with bracket access:
return await math["tool-name"]({ value: 1 });
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.