@nais-standard/mcp
v1.0.0
Published
Local MCP gateway for the Network Agent Identity Standard (NAIS). Discover, verify, and call NAIS agents by domain from any MCP client. Run it yourself — one per agent; not a hosted service.
Maintainers
Readme
@nais-standard/mcp
A local MCP gateway for the Network Agent Identity Standard (NAIS). It lets any MCP-capable agent (Claude Code, Claude Desktop, Cursor, …) discover, verify, and call any NAIS agent by domain — with one static server entry instead of configuring each remote agent by hand.
Run it yourself, one per agent. This is a local stdio subprocess, not a hosted service. There is no shared endpoint, no central resolver, and nothing calls home — it reads DNS and verifies card signatures itself (via
@nais-standard/sdk) before your agent touches a remote agent. Do not deploy it as a shared multi-tenant endpoint; that would re-centralize the very thing NAIS decentralizes.
Why a gateway
Most MCP clients can only talk to statically-configured servers — they can't open a new connection to an arbitrary endpoint at runtime. This gateway bridges that: you configure it once, and it resolves + verifies + forwards calls to whatever NAIS agent you name. Verification is enforced inside the gateway, so an agent (or a prompt injection) can never skip it.
Install
Nothing to install globally — your MCP client launches it on demand via npx.
Claude Code
claude mcp add nais -- npx -y @nais-standard/mcpClaude Desktop / Cursor / generic MCP config
{
"mcpServers": {
"nais": {
"command": "npx",
"args": ["-y", "@nais-standard/mcp"],
"env": {
"NAIS_PAYMENT_MODE": "never"
}
}
}
}Restart the client; it spawns the server locally over stdio. Pin a version with
@nais-standard/[email protected] if you prefer. Requires Node.js 18+.
Tools
| Tool | What it does |
|------|--------------|
| nais_resolve(domain) | Discover + verify an agent. Returns { verified, name, tags, mcpEndpoint, payTo, tools }. mcpEndpoint and payTo are present only when the signature verifies. |
| nais_list_tools(domain) | Verify, then return the agent's live, authoritative MCP tools/list. |
| nais_call(domain, tool, arguments) | Verify on every call, then invoke the tool on the agent's MCP endpoint and return the result. |
Example, as an agent would use it: "check the weather in London using weatheragent.nais.id" →
nais_call("weatheragent.nais.id", "forecast", { "location": "London" })The gateway resolves the domain, verifies the signed card against the DNS k=
key, opens the agent's MCP endpoint, calls forecast, and returns the result —
refusing outright if the card can't be verified.
Payment policy
nais_call never spends money by default. Configure via environment:
| Var | Default | Meaning |
|-----|---------|---------|
| NAIS_PAYMENT_MODE | never | never: an HTTP 402 is returned with the payTo/payment details for your approval — nothing is paid. auto: reserved for a future wallet adapter (currently refuses). |
| NAIS_MAX_CALL_USDC | 0 | Per-call cap for a future auto mode. |
Because payTo is only surfaced for a verified card, you can never be steered
into paying an address from a tampered or unsigned card. x402 payments are
irreversible — verify first, always.
Examples
See examples/:
examples/README.md— full install guide (Claude Code, Claude Desktop, Cursor) + configuration + sample prompts.examples/claude-desktop-config.json— ready-to-paste config.examples/agent-loop.mjs— a runnable discover → verify → call demo against the bundled weather agent.
Development
npm install
npm test # gateway logic (offline, real verification) + MCP stdio handshakeThis package depends on the published @nais-standard/sdk.
To develop against an unpublished local checkout of the SDK, link it first —
npm link @nais-standard/sdk (after npm link in the SDK), or temporarily set
"@nais-standard/sdk": "file:../path/to/clients/js". The gateway is a thin layer over the
SDK: keep all verification and canonicalization in @nais-standard/sdk, not here.
Related
@nais-standard/sdk— the verification + resolution library this wraps- spec — protocol specification
