MCP Gateway
Deterministic firewall between AI agents and enterprise infrastructure
MCP Gateway
The Nexus MCP Gateway acts as a deterministic firewall between your probabilistic AI agents and your mission-critical infrastructure. It performs deep packet inspection on every JSON-RPC tool call before it reaches your backend.
Zero-LLM latency
Unlike prompt-based guardrails that rely on a secondary LLM to evaluate safety, the Nexus Gateway evaluates execution payloads against compiled Network Policy Language (NPL) rules entirely in-memory.
| Metric | Value |
|---|---|
| p50 latency | ~160 ms |
| p99 latency | < 201 ms |
| Token cost | 0 |
Policies compile from the open npl-spec repository. View open-source spec →
Inspection pipeline
flowchart TD
A[JSON-RPC request] --> B{Valid RPC 2.0?}
B -->|no| X[BLOCK: MCP_MALFORMED_RPC]
B -->|yes| C{Server whitelisted?}
C -->|no| X2[BLOCK: MCP_SERVER_NOT_WHITELISTED]
C -->|yes| D{Method blocked?}
D -->|yes| X3[BLOCK: MCP_METHOD_BLOCKED]
D -->|no| E{Destructive op?}
E -->|yes| X4[BLOCK: MCP_DESTRUCTIVE_OP_BLOCKED]
E -->|no| F{NPL policy}
F -->|deny| X5[BLOCK + audit]
F -->|require_human| H[Approval queue]
F -->|allow| G[Forward to backend]Decision types
| Decision | Behavior |
|---|---|
allow | Forward to backend (or mock in simulation mode) |
deny | Block with stable reasonCode, audit before agent sees error |
require_human_approval | Queue for operator review, block until resolved |
Inspect an MCP call
curl -X POST "https://api.hardalion.com/api/v1/mcp/gateway/inspect" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agt_prod_f8a92b",
"execution_id": "exec_01hxyz",
"server_id": "enterprise-db",
"tool_name": "query_ledger",
"execution_mode": "production",
"request": {
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "query_ledger",
"arguments": { "account_id": "ACC-4421" }
}
}
}'Scope required: agents:execute.
Connecting a LangChain agent
Wrap your tools with the Nexus SDK and provide your AgentIAM passport:
import { NexusGateway } from '@hardalion/sdk'
import { myEnterpriseTools } from './tools'
const securedTools = NexusGateway.wrap(
{ invoke: myEnterpriseTools.invoke.bind(myEnterpriseTools) },
{
tenantId: 'ten_acme',
agentId: 'agt_prod_f8a92b',
apiKey: process.env.HARDALION_API_KEY,
baseUrl: 'https://api.hardalion.com',
policy: 'hardalion://nato-prou-strict-financial@1.0.0',
},
)
// Pass securedTools to your LangChain or CrewAI instance.Execution modes
| Mode | Behavior |
|---|---|
production | Inspect and forward allowed calls to real backends |
simulation | Inspect and return mock responses (no backend contact) |
shadow | Evaluate policies, log counterfactual blocks, do not enforce (see Shadow mode) |
Policy pinning
Pin immutable policy versions with registry URIs:
hardalion://nato-prou-strict-financial@1.0.0View bundled policies: NPL reference policies.
Gateway policies
Per-tenant MCP gateway policies configure:
- Trusted server whitelist
- Blocked methods and tools
- Destructive operation denial
- Data exfiltration heuristics
Configure via the Nexus console or tenant API.
OAuth 2.1 for remote MCP
Nexus is the authorization server for remote MCP servers. Agents do not carry static MCP keys. After inspect allows a call, the gateway mints a short-lived JWT whose aud is only that MCP server (mcp://{serverId}). Client-presented bearer tokens are rejected (MCP_TOKEN_PASSTHROUGH).
Discovery:
GET https://api.hardalion.com/.well-known/oauth-authorization-serverRegister a client for an existing agent (agents:manage):
POST https://api.hardalion.com/oauth/registerMint a token (client_credentials or authorization code after AgentIAM proof):
POST https://api.hardalion.com/oauth/tokenAccess tokens last at most 15 minutes. Set oauthMode: "mcp_as" on the gateway policy (or NEXUS_REQUIRE_MCP_OAUTH=true later) so production forwards include access_token bound to the target server.
Spawn a governed agent
Customers build the agent on Nexus. Voice, tools, AgentIAM, and MCP OAuth are issued together. A third-party "human agent" platform is not required for this path.
curl -X POST "https://api.hardalion.com/api/v1/agents/spawn" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Sofia",
"system_prompt": "Help the treasury desk reconcile cash.",
"persona": { "tone": "warm", "language": "English" },
"allowed_tools": ["query_ledger"],
"mcp_audiences": ["mcp://core-banking"]
}'Scope required: agents:manage. The MCP client_secret is returned once.