Bounded N/M MCP tools
Connect agents to versioned local N/M tools with strict protocol negotiation, hostile-client validation, bounded carriers and byte-identical Core/stdio behavior.
Public npm installation
Connect the local MCP server
Configure a client that supports local stdio MCP servers. Local tools inspect and run supplied N/M source; this package is not an AI model or a hosted chat service.
Requires Node.js 20 or newer. Release checks use Node.js 22.23.1.
npm package 0.7.0 targets N/M language 0.2.0. An untagged install selects the default latest channel; use @0.7.0 to reproduce this release. The distribution channel does not change the language's preview maturity status. The VS Code extension has a separate distribution version.
npm install --global @nm-lang/mcpTo pin this release:
npm install --global @nm-lang/mcp@0.7.0MCP client configuration for a pinned package version
{
"mcpServers": {
"nm": {
"command": "npx",
"args": [
"-y",
"@nm-lang/mcp@0.7.0"
]
}
}
}Examples run on a local simulator. Installation does not establish physical QPU access or make every capability stable.
Personal, educational and commercial use is free. QuantumSoftware retains rights to its package code; modification and redistribution require separate permission. Your N/M programs and results remain yours. Read LICENSE.txt in the installed package.
Test reports
Version 0.3.0 and later include nm_test for named tests, property checks and snapshots with Test Explorer report 0.1. It accepts supplied code and workspace modules, preserves explicit feature permissions, and returns source locations and hashes without the source body. The optional uri is only an identity label. Failed checks, no checks, or execution errors set isError.
Test execution limits
Before execution, nm_test conservatively limits expanded checks to 1,000, weighted statements to 4,096, dense-state work to 16,777,216 units and snapshots to five qubits. The work estimate includes branches, loops, automatic uncompute, sampling, noise trajectories, training and gradients. Reports omit visualization timelines and measurement state histories; lesson-specific hidden challenge checks are skipped. A check never reached because main returned cannot count as passed.
Explain work before running
In @nm-lang/mcp 0.3.0 and later, nm_test accepts dryRun: true to return a separate nm-mcp-work-budget 0.1 estimate without simulation. Normal test responses also include budget. The report explains statements, checks, canonical parameters, training, gradient, sampling and noise factors. estimate.complete: false identifies a partial count stopped at a structural limit. This heuristic does not guarantee runtime or memory; invalid source returns diagnostics without a budget. Test Explorer report 0.1 is unchanged.
Cancellation and deadlines
The worker host, cancellation and startup limits described here require @nm-lang/mcp 0.3.0 or later. The standalone stdio binary runs tool calls in isolated Node workers. Startup flags --timeout-ms (default 15000, maximum 30000), --max-concurrency (default 2, maximum 4) and --max-queue (default 8, maximum 32) bound admitted work. The deadline includes queue and worker startup time. notifications/cancelled with params.requestId terminates that request and returns NM-MCP-009; timeout returns NM-MCP-010. Notifications have no response. Numeric/string IDs are distinct; duplicate active IDs are rejected with id: null. Responses can arrive out of order. EOF drains admitted work; signals terminate workers. The synchronous Core handler does not implement deadlines.
Versioned bounded MCP tool contract
The Core handler and standalone newline-delimited stdio server share JSON-RPC responses. Version 0.3.0 and later negotiate the MCP protocol before exposing eight local N/M tools.
Versioned tool schemas
Every tool publishes a JSON Schema 2020-12 object with required fields, no unknown properties, bounded scalar ranges, behavior annotations, and explicit contract and schema versions. Runtime validation also measures UTF-8 bytes.
Protocol lifecycle
Hosted sessions fail closed before initialize, reject unsupported protocol versions and duplicate initialization, accept the initialized notification, and return stable JSON-RPC plus NM-MCP error evidence.
Local execution boundary
Tools do not access networks, credentials, repositories, or arbitrary files. Parse, simulation, training, export, optimization, examples, and curated package discovery run only against request data and bundled registries.
Carrier limits
Oversized input lines are discarded before JSON dispatch. Code, query, structured tool data, and complete responses have independent fail-closed budgets; output overflow becomes NM-MCP-007 instead of a truncated carrier.
Shared capability visibility
Preview: Usable preview, not a stable compatibility promise; review the listed limitations before production use. Experimental contracts may change without the stable deprecation promise. New sessions enable the default language profile; other features require opt-in. Saved settings are preserved.
Local simulator result
Local or synthetic execution only; this result is not evidence of physical-device performance or quantum advantage. Requires an explicit provider/device path and retained backend provenance; simulator output never upgrades to hardware evidence.
JSON-RPC / stdio
npm run nm:mcp
{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2025-06-18" } }nm_parsenm_runnm_trainnm_exportnm_import_irnm_optimizenm_examplesnm_testnm_capabilitiesNM-MCP-001NM-MCP-002NM-MCP-003NM-MCP-004NM-MCP-005NM-MCP-006NM-MCP-007NM-MCP-008NM-MCP-009NM-MCP-010The local contract covers newline-delimited stdio and versioned tool schemas. Remote transports, prompts/resources, sampling, server-side persistence, secrets, arbitrary filesystem access, and third-party MCP client certification remain outside this candidate.