Skip to content
LogoLogo

Nava MCP server

Developer Preview

@navalabs/sdk ships a second binary, nava-mcp. It is a Model Context Protocol server speaking stdio. An MCP host launches it as a subprocess and injects credentials as environment variables. Nava Service also exposes hosted MCP over Streamable HTTP.

The package is restricted during Developer Preview. Get package access and a provisioned agent API key from Nava before configuring a host.

The stdio server exposes six base Guardian tools and tools from the enabled adapters. It also exposes the prompt collection tool. Each field carries a description in the live tool listing. See the operations reference for the verification and adapter parameter tables.

Tool naming

  • A protocol tool is <protocol>.<token>: one dot, kebab-case token.
  • The six base Guardian tools and record-user-prompt use unprefixed names.
  • There are no camelCase aliases. Naming is enforced when the surface descriptor loads, so an alias cannot exist.

Record incoming user messages

The agent owner enables prompt collection first. Call record-user-prompt from your inbound message handler with the exact event text and stable host IDs. Run that handler for every turn, including messages answered locally and turns where the model calls no tools. Message text is limited to 32 KiB of UTF-8. The authenticated MCP session selects the agent, and Nava records the source as agent_relay.

Hosted MCP at <NAVA_API_URL>/mcp requires an agent credential with prompts:create:own to record messages. For keyed stdio, set NAVA_BASE_URL and supply a NAVA_API_KEY issued with that scope. For interactive stdio, set NAVA_MCP_OAUTH_SCOPES=prompts:create:own, restart the connector, and sign in. If it has a saved grant, disconnect first, then connect again to approve the new scope. Interactive stdio lists the tool once the hosted session offers it. Use tools/list to discover the tool and pass the same arguments on either transport.

import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
 
type UserMessage = { conversationId: string; messageId: string; text: string };
 
export async function captureMessageWithMcp(mcp: Client, event: UserMessage) {
  const call = {
    name: 'record-user-prompt',
    arguments: {
      conversationId: event.conversationId,
      messageId: event.messageId,
      request: event.text,
    },
  };
 
  const result = await mcp.callTool(call).catch(() => mcp.callTool(call));
  const content = Array.isArray(result.content) ? result.content[0] : undefined;
  if (!content || content.type !== 'text') throw new Error('Missing Nava receipt');
  const receipt = JSON.parse(content.text);
  if (result.isError) {
    if (receipt.code === 'collection_disabled') return { status: 'disabled' } as const;
    throw new Error(receipt.code ?? 'Prompt collection failed');
  }
  return receipt;
}

The example retries a lost response once using the original arguments. A new turn returns stored. An exact replay returns replayed with the original id, promptHash, and createdAt. New turns after disabling return collection_disabled with isError: true, and earlier exact replays still return the original receipt. Conflicting text under the same IDs returns prompt_conflict with isError: true.

Select protocols with NAVA_PROTOCOLS

NAVA_PROTOCOLS=uniswap,hyperliquid nava-mcp

NAVA_PROTOCOLS is a comma-separated list. An unrecognized name is reported as unknown and ignored; the server still starts.

NAVA_PROTOCOLSTools registered
unsetBase tools and every installed protocol adapter's tools.
an explicit listBase tools and the listed installed protocol adapters' tools.
empty stringBase tools only.

Leaving it unset matches what you installed. Set an explicit list to narrow the protocol tools, for example to Uniswap on a host with multiple adapters.

A protocol still needs its adapter installed. When the list was unset, a protocol you never installed is simply absent and nothing is logged, because you never asked for it. When you name a protocol explicitly and its adapter is missing, nava-mcp says so and starts without those tools rather than failing:

[nava-mcp] @navalabs/uniswap-adapter/mcp is not installed; uniswap.* tools will
not register. Install @navalabs/uniswap-adapter to enable this protocol.

An adapter that is installed but broken is always reported, whether or not you named it: absence is expected, failure is not.

Host configuration

Most hosts take a command, arguments, and an environment block. Zero-install:

{
  "mcpServers": {
    "nava": {
      "command": "pnpm",
      "args": [
        "--package=@navalabs/uniswap-adapter",
        "dlx",
        "nava-mcp"
      ],
      "env": {
        "NAVA_API_KEY": "…",
        "WALLET_ADDRESS": "0x…",
        "UNISWAP_RPC_URL": "https://…",
        "UNISWAP_CHAIN_ID": "11155111",
        "UNISWAP_WALLET_ADDRESS": "0x…"
      }
    }
  }
}

With the adapter already installed in the project, "command": "nava-mcp" is enough.

NAVA_PROTOCOLS is omitted above on purpose: unset, the server registers whatever adapters are installed.

nava-mcp reads WALLET_ADDRESS. NAVA_WALLET_ADDRESS is a CLI-side alias that the MCP server does not consult; set both when one configuration serves both transports. The full list is on the configuration reference. Inject secrets through the host's environment or secret store; never place a key in a page, a prompt, or command output.

The advisory get-agent-policy and get-agent-state tools require policies:read:own and can run with only NAVA_API_KEY; nava-mcp starts with only NAVA_API_KEY when no protocol is explicitly requested. Verification tools fail at call time until WALLET_ADDRESS is present, and setting NAVA_PROTOCOLS still requires that wallet. Advisory reads return the active policy or last-known state without triggering a live refresh. Self-rejecting from them without submitting leaves no verdict and no audit trail.

isError does not mean rejected

isError does not report the Guardian verdict, so isError: false can accompany a rejection.

isError tracks transport and operation kind, not outcome:

  • Verified write tools (the three Hyperliquid writes) derive isError from the payload's success.
  • Read and build tools (all six Uniswap operations and the five Hyperliquid reads) always return isError: false unless the call threw.
  • The six base tools set isError by hand, and it does not always track success. Most failure paths set both. The exception is the one that matters most: await-verification returns any terminal verdict, including REJECTED, as isError: false with success: false and canExecute: false. Only a timeout, a transport failure, or a missing verdict sets isError: true.

So a REJECTED Guardian verdict and a failed uniswap.execute-swap build both look non-error at the protocol level. An agent that keys its next step off isError will read a rejection as a success.

Decide from the complete payload instead. Continue only when success is true, status is "APPROVED", canExecute is true, verdict.outcome is "approved", and verdict.reasonCode is "allowed". Any mismatch is blocked. Report execution as complete only after the relevant tool returns terminal execution success.

The CLI has the same trap in a different spelling; see exit code 0 does not mean approved.

Other transport differences

MCP validates shapes and bounds the CLI does not, and has no cross-field rules the CLI enforces; notably, MCP will accept a limit order with no limitPrice. Hyperliquid's network is a per-call field here and environment-only on the CLI. The full list is under transport asymmetries.