The Model Context Protocol (MCP) gives a language model a standard way to discover and invoke tools. Leaving the decision to invoke one to the model itself is the weak point: prompt injection, indirect jailbreaks and confused-deputy tricks all end with a model asking for a tool nobody meant it to use. NHI Security puts that decision outside the model. Your agent runtime asks the runtime gate before it forwards a tool call, and the gate answers from what NHI Security already knows about the calling agent, the tool and the target, never from the prompt.
The gate is only as good as the runtime that asks it. NHI Security does not sit in the network path between your agent and your MCP server: a runtime that skips the check is not stopped by anything here. A reverse-proxy gateway that asks the gate on the runtime’s behalf exists in the source tree (nhi/packages/mcp-gateway) but is not packaged or deployed as part of the product today.

Why the model is never the boundary

Before answering, the gate asks, among other things:
  1. Is the agent live and not quarantined? And has an operator suspended every agent in the organization?
  2. Is the estate credential it will act with usable (not revoked, expired or compromised)?
  3. Is this agent entitled to this tool? No entitlement, no call. That includes when none was ever declared.
  4. What does the tool actually do? read, write, administrative, or not yet known.
  5. How much does the target matter? A mutating action on a high or critical resource needs a person.
  6. How supervised is the agent? An autonomous agent’s mutating actions need a person, and so do an agent’s whose autonomy nobody has declared.
Five of the fourteen rules deny outright and cannot be switched off; the other nine can at most challenge: say “a person should decide”. The full list is in Runtime gate.

Connecting an MCP server

The MCP connector reads what a server publishes with the protocol’s own handshake (initialize, then tools/list), over streamable HTTP. It records tools and resources, not identities: an MCP server answers whoever authenticates and does not know its callers. The console’s Connect an environment form does not offer MCP; create the connector through the API, with the fields, the stored-token handle and the host allow-list your operator must set described in Connectors → MCP tool servers. The MCP connector has been tested against a simulated server only.
  • authMode: "bearer" sends a token you stored with the connector’s credential (POST /nhi/api/v1/connectors/credential, value name token), referenced by the connector’s credentialsHandle. The connector needs only enough access to list tools, never to invoke them.
  • authMode: "none" is for an unauthenticated development server.

Declaring what a tool does

A tool’s effect is one of read, write, administrative, authenticate or unknown. The connector sets an initial effect from the publisher’s own annotation (readOnlyHint: true becomes read, readOnlyHint: false becomes write) and leaves everything else unknown. A server’s destructiveHint never makes a tool administrative; only a person does. A third-party server’s annotations are a claim, so review them. Set or correct a tool’s effect in the console (Agents → Tools) or with PATCH /nhi/api/v1/tools/{toolId}/effect and {"effect": "administrative", "statement": "Drops tables in the production schema"}. The statement is required for every effect other than unknown, because every finding the rating governs quotes it. The caller also declares an action class on each request, and the gate uses the stricter of that claim and the tool’s recorded effect: a runtime cannot downgrade a mutating tool by calling the action a read.

Entitling an agent to a tool

An agent starts with no tool entitlements, and tool_not_entitled denies every tool it has none for. Declare each one in the console or with POST /nhi/api/v1/tools/entitlements:
Both identifiers are the UUIDs NHI Security assigned, and statement is required. An entitlement is to a tool, not to an action class or a resource: bound what a tool can reach by what the tool itself does, and by an access grant for anything high-impact. These routes, like every NHI Security route except the gate itself, take your TRUSTIVAN session, not a bearer token. See Limitations. Declaring effects and entitlements needs agent:manage.

Asking before every call

When the model asks for a tool, the runtime asks the gate first, with its runtime credential:
The answer carries: Branch on mayProceed. It is derived from the decision by NHI Security, so the runtime and the platform cannot disagree about what a challenge means.
  • allow: forward the call to the MCP server.
  • challenge: do not call the tool. A person decides by approving an access grant in the console; the runtime cannot request one itself. challengeFor names a request already waiting, if somebody has asked. The next check after approval can allow, as long as nothing else still challenges.
  • deny: do not call the tool, and tell the user it was refused. A refusal is still HTTP 200.
Send a requestId so a retry after a network failure returns the decision already made rather than a second one.

Reporting the outcome

After an allowed call, report what happened, once:
Every decision, including every refusal, is kept in the append-only decision log.

Practices worth keeping

  1. Keep provider credentials away from the model. Give the runtime, not the model, whatever credential the MCP server or the provider needs. NHI Security does not issue or broker those credentials; the runtime credential it issues authenticates to NHI Security only.
  2. Rate destructive tools administrative. Then no call to them proceeds without a grant, and a grant needs a second admin: self-approval is refused.
  3. Always send requestId. It makes retries safe.
  4. Keep MCP servers off the public internet, reachable from your agent runtimes and not from wherever a model’s output could point a request.