Our own projects jsmcp
by Plainweave Systems
Your MCP tools, as a JavaScript API for agents.
jsmcp is an MCP server that sits in front of your other MCP servers. Instead of calling tools one at a time and reading every result, the agent writes a few lines of JavaScript: call, filter, loop, and return only what it needs.
- Open source, MIT
- Node.js 22.8+
- Any MCP client that runs stdio servers
execute_code · compare two docs
const urls = [
'https://nodejs.org/api/permissions.html',
'https://docs.deno.com/runtime/fundamentals/security/',
]
return await Promise.all(urls.map(async (url) => {
try {
const { result } = await kagi.summarizer({
url, summary_type: 'takeaway',
})
return { url, excerpt: result.slice(0, 1200) }
} catch {
return { url, error: 'Summary unavailable' }
}
}))
list_servers and list_tools for
kagi, summarise two documentation pages in parallel.
Kagi returns { result: string }; this script returns at
most 1,200 characters per page and keeps an individual failure from
discarding the other result. Set timeoutMs: 90000 on
the execute_code call to allow time for the remote
summaries. It works with the default or work profile in the
config below.
The problem
Every tool call is a round trip through the model.
In many clients, an agent with several MCP servers starts each session carrying every tool’s definition. Each call then goes out, and its whole result comes back into the context before the model decides the next step. That’s fine for one lookup. For a search, a dozen fetches and a comparison, it’s slow, expensive and easy to lose track of.
one tool at a time
→ kagi_summarizer({ url: nodeDocs,
summary_type: 'takeaway' })
← full Node.js summary
→ kagi_summarizer({ url: denoDocs,
summary_type: 'takeaway' })
← full Deno summary
… the model handles each result
before asking for the next one
with jsmcp
→ list_servers({})
→ list_tools({ server: 'kagi' })
← summarizer schema: { url, summary_type }
→ execute_code({ code, timeoutMs: 90000 })
← [{ url, excerpt }, …]
How it works
Five tools in front, your servers behind.
jsmcp is an ordinary MCP server, so it works with the agent you already use. There’s no new agent framework to build on and no hosted sandbox to send your data to: scripts run on your own machine, next to the servers they call.
-
01
Point it at your servers
One config lists your MCP servers, local or remote, with entries in the same shape as Claude Code or OpenCode. jsmcp starts them, and
jsmcp authhandles OAuth for remote ones. -
02
The agent sees five tools
list_servers,list_tools,execute_code,fetch_logsandclear_logs. Each server’s tool definitions are looked up when needed, not loaded into every session up front. -
03
It writes JavaScript
Each allowed tool becomes an async function on its server’s object. Results arrive already unwrapped, console output is kept apart from the return value, and
jsmcp.memorykeeps JSON between calls in a session.
Decide what each agent is offered.
Search the web by default, add Atlassian lookups for work, or choose a separate profile for browser automation. Each profile selects whole servers or individual tools by name, glob or regular expression.
Omitted servers stay enabled: set a server to
false to exclude it. A server-level
blocked_tools rule applies first, and no preset can
turn those tools back on.
config.yaml · preset excerpt
presets:
default:
atlassian: false
kagi: [search_fetch, summarizer]
chrome: false
work:
atlassian:
- search
- fetch
- {glob: "get_*"}
- {glob: "lookup_*"}
- {glob: "search_*"}
kagi: [search_fetch, summarizer]
chrome: false
browser:
atlassian: false
kagi: false
chrome: true
jsmcp run --profile work, or connect to
the daemon with jsmcp client --profile browser.
Presets filter the agent’s view; they don’t prevent the daemon
from starting enabled servers.
Scripts can’t reach past their tools.
Each script runs in its own worker thread, in a fresh JavaScript
environment with nothing from Node.js in it: no
process, require, fetch or
eval. It can call the tools its preset allows and
nothing else, and only JSON crosses between the script and jsmcp.
A runaway script is stopped at its timeout or at 512 MB of memory,
and the daemon and every other agent carry on.
The MCP servers you configure still run with your permissions. If their tools could do damage, sandbox them with bubblewrap or a container.
inside execute_code · default profile
typeof process // "undefined"
typeof require // "undefined"
typeof fetch // "undefined"
eval("1 + 1")
// Error: Code generation from strings disallowed
kagi.summarizer.constructor("return process")()
// Error: Code generation from strings disallowed
JSON.parse = () => {}
// Error: Cannot assign to read only property
typeof kagi.summarizer // "function"
typeof chrome // "undefined"
One daemon, many sessions
Start your servers once, share them everywhere.
Run jsmcp run as a plain stdio server, or run one
daemon that keeps your servers and their OAuth sessions warm for
every agent and client on the machine.
-
Daemon
jsmcp serverStarts every enabled server once and serves profiles over WebSocket and HTTP, on localhost and behind an API key.
-
Client bridge
jsmcp clientA stdio MCP server for any client, forwarding to the daemon. A session id keeps logs and memory across reconnects.
-
HTTP API
POST /api/callThe same five tools as JSON over HTTP, for scripts and agent harnesses that don’t speak MCP.
-
Pi extension
extensions/piAsks before running scripts, once or until Pi restarts, and refuses a script if the servers or tools changed since the agent last looked.
Also: jsmcp status for server health and
jsmcp restart. The repository has a systemd user service
for the daemon.
Is it for you
A small tool, with a clear trade-off.
A good fit when
- You use a coding agent with several MCP servers, and tasks chain calls: search, then fetch, then compare.
- Tool results are large and the agent only needs a little of each.
- Several agents or clients should share one server config and one set of OAuth logins.
- You want a reviewed allowlist of tools for each profile.
Probably not when
- You want to host tools for other people’s agents: it isn’t built for multi-tenant use.
- Most of your work is single lookups. A direct tool call is simpler.
What it doesn’t do
-
Keep memory across restarts:
jsmcp.memorylives in the process. - Start or stop servers from a script. Scripts use the servers that are already running.
-
Support every Claude Code config field yet, such as
headersHelper.
Get started
Running in three steps.
-
01 Install
npm install -g @alesya_h/jsmcpNeeds Node.js 22.8 or later. Or run it without installing: npx @alesya_h/jsmcp run. -
02 Set up servers & profiles
~/.config/jsmcp/config.yaml
jsmcp: auto_strip_tool_prefixes: true normalize_tool_names: true servers: atlassian: type: remote url: https://mcp.atlassian.com/v1/mcp blocked_tools: - {glob: "*confluence*"} - {glob: "*compass*"} kagi: type: local command: [npx, -y, better-kagi-mcp@1.0.0] environment: KAGI_API_KEY: "${KAGI_API_KEY}" chrome: type: local command: - npx - -y - chrome-devtools-mcp@1.12.0 - --no-usage-statistics presets: default: atlassian: false kagi: [search_fetch, summarizer] chrome: false work: atlassian: - search - fetch - {glob: "get_*"} - {glob: "lookup_*"} - {glob: "search_*"} kagi: [search_fetch, summarizer] chrome: false browser: atlassian: false kagi: false chrome: true-
Set
KAGI_API_KEYin the environment that starts jsmcp, enable Kagi Search API access, and sign in to Atlassian withjsmcp auth atlassian. The local servers run throughnpx; Chrome tools also need Chrome and Node.js 22.12 or later. -
The server-level rules block tool names containing
confluenceorcompass. They don’t limit what a generic search or fetch tool can retrieve. Review tool capabilities and account permissions; the browser profile permits browser actions. -
Server names become JavaScript globals. Prefix stripping and
snake_casenormalisation make the exposed tool names easier to call; selectors match those final names. Check them withlist_tools. -
JSON works too. Keep exactly one of
config.yaml,config.ymlorconfig.jsonin$XDG_CONFIG_HOME/jsmcp/(by default,~/.config/jsmcp/). String values can read the environment (${NAME}) or a file ({file:path}).
-
Set
-
03 Add it to your agent
your MCP client’s config
{ "mcpServers": { "jsmcp": { "command": "jsmcp", "args": ["run", "--profile", "work"] } } }Most clients accept an entry like this. It selects the work profile above. To share one daemon between clients, start jsmcp serverand change the arguments to["client", "--profile", "work"]. Use"default"for web search only, or"browser"for Chrome automation only.
Made by Plainweave Systems
Questions, bugs, or a workflow to automate?
We build and maintain jsmcp, and use it in our own work. Bug reports and questions are welcome on GitHub. If you’d like help connecting agents to your own systems, safely, that’s the kind of work we do.