Our own projects jsmcp

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' }
  }
}))
After 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
The finding: orchestration and trimming happen in conversation, even when the two calls could run independently.

with jsmcp

→ list_servers({})
→ list_tools({ server: 'kagi' })
← summarizer schema: { url, summary_type }
→ execute_code({ code, timeoutMs: 90000 })
← [{ url, excerpt }, …]
The same two pages as the example above. Discover the available tools first, then batch the calls and trim their results in code. Only the returned excerpts, or an error row for a failed page, reach the model.

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.

  1. 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 auth handles OAuth for remote ones.

  2. 02

    The agent sees five tools

    list_servers, list_tools, execute_code, fetch_logs and clear_logs. Each server’s tool definitions are looked up when needed, not loaded into every session up front.

  3. 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.memory keeps 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
From the complete config below. Choose with 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"
Separate probes checked with jsmcp 1.9.0 and the default preset below: Kagi is exposed; Chrome is not. The probes don’t make any remote API calls.

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.

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.memory lives 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.

  1. 01 Install

    npm install -g @alesya_h/jsmcp
    Needs Node.js 22.8 or later. Or run it without installing: npx @alesya_h/jsmcp run.
  2. 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_KEY in the environment that starts jsmcp, enable Kagi Search API access, and sign in to Atlassian with jsmcp auth atlassian. The local servers run through npx; Chrome tools also need Chrome and Node.js 22.12 or later.
    • The server-level rules block tool names containing confluence or compass. 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_case normalisation make the exposed tool names easier to call; selectors match those final names. Check them with list_tools.
    • JSON works too. Keep exactly one of config.yaml, config.yml or config.json in $XDG_CONFIG_HOME/jsmcp/ (by default, ~/.config/jsmcp/). String values can read the environment (${NAME}) or a file ({file:path}).
  3. 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 server and 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.