@nwire/mcp
v0.7.1
Published
Nwire MCP (Model Context Protocol) server — exposes the kernel's CommandRouter as MCP tools over stdio. AI clients (Claude, Cursor, …) drive nwire commands the same way the CLI and Studio do.
Readme
@nwire/mcp
Model Context Protocol server — exposes the kernel's CommandRouter as MCP tools over stdio.
What it does
Wraps the Nwire kernel's CommandRouter as a Model Context Protocol server. AI clients (Claude Desktop, Cursor, IDE plugins) speak JSON-RPC 2.0 over stdio per the MCP spec; this server routes their tools/list and tools/call to the same command table the CLI and Studio use. One transport, three surfaces.
Install
pnpm add @nwire/mcpQuick start
import { serveMcp } from "@nwire/mcp";
import { createKernel } from "@nwire/kernel";
const kernel = createKernel();
kernel.router.register("dev", devHandler);
kernel.router.register("ls", listHandler);
await serveMcp({ kernel, serverName: "my-app" });
// Process now speaks MCP over stdin/stdout; stderr is for logs.Then point Claude Desktop at the binary in claude_desktop_config.json:
{ "mcpServers": { "my-app": { "command": "node", "args": ["./mcp.js"] } } }API surface
serveMcp({ kernel?, serverName?, serverVersion? })— boot the server on stdio; resolves when stdin closes.JsonRpcRequest/JsonRpcResponse/JsonRpcNotification— exported for callers writing alternative transports (WebSocket, etc.) that reuse dispatch.
When to use
When you want AI assistants to invoke your Nwire commands directly. Pairs naturally with @nwire/cli (same commands) and Studio (same router, browser surface).
Within nwire-app
For developers using this package as part of the Nwire stack — register it via app.use(...) or it auto-wires when you compose createApp({ modules }).
import { createApp } from "@nwire/forge";
const app = createApp({
/* ...config... */
});
// Adapter/plugin wiring happens here when applicable.