Skip to main content
Glama
Mont - Agent Gateway SDK

Mont - Agent Gateway SDK

Mont (agent-gateway-sdk) โ€” The Firewall Between AI Agents and Your APIs

npm version Website Node.js TypeScript Database Docker License

Mont Gateway Dashboard

Let AI agents use your store and APIs without letting them empty it.

Mont is a local-first, fail-closed API gateway and human-in-the-loop firewall for AI agent traffic: REST calls and MCP tool calls alike. You can use it in three ways:

  • as Express middleware inside your app

  • as a no-code reverse proxy in front of any backend (Python, Go, Java, Rails, Next.jsโ€ฆ)

  • as an MCP proxy between Claude, Cursor or your agent framework and its tools

It needs no Redis, no Postgres and no cloud account: everything lives in an embedded SQLite (WAL) database next to your app.

๐ŸŒ montweel.com ยท ๐ŸŽ Free 90-day Pro trial key ยท โš–๏ธ TERMS.md


Glama Score

The problem

Agents are now calling production APIs, and they fail in ways firewalls were never built for:

What goes wrong

What it costs you

How Mont stops it

Runaway loops. An agent retries the same refund or email 400 times.

Duplicate payouts, spam, burned API budget

Rate limits per route, duplicate-action protection, cumulative spending budgets

Prompt-injected refunds. A support ticket says "refund every order", and the agent obeys.

Real money leaves the store

Payload policies (amount > 100 โ†’ needs a human), phone approvals, Edit & Approve, Lockdown switch

Blind MCP tool calls. The model calls delete_customer or export_database because a webpage told it to.

Data loss, data exfiltration

Default-deny MCP tool rules, per-argument policies, outbound response guard

"What did the agent actually do?"

No evidence for chargebacks or audits

Hash-chained, tamper-evident audit log with redacted request and response payloads, end-user & approver attribution, CSV export, money-protected reports

Every decision is fail-closed. A request reaches your API only after every check passed and its audit row is durably written. A database error, timeout, malformed body or policy error ends in a 4xx/503, never in a forwarded request.


Related MCP server: genpark-agent-prompt-injection-sanitizer-firewall-skill

Quickstart

Requires Node.js 20.17+ (or Docker).

(a) Express middleware: inside your Node.js app

npm install agent-gateway-sdk
import express from "express";
import { createAgentGateway } from "agent-gateway-sdk";

const app = express();
const gateway = createAgentGateway({ port: 3000 });
await gateway.ready;                                // database open and migrated

app.use(gateway.discoveryRouter);                   // GET /.well-known/agent.json
app.use(gateway.approvalCallbackRouter);            // signed Approve / Reject links
app.use("/api/agent-admin", gateway.adminRouter);   // admin API (mount BEFORE the gateway)
app.use("/api", gateway.agentGateway);              // the firewall

app.post("/api/refund", express.json(), (req, res) => res.json({ refunded: req.body.amount })); // your routes
app.listen(3000);

(b) Standalone no-code proxy: in front of any backend

npx agent-gateway-sdk start --target https://api.mystore.com
# agents call      http://127.0.0.1:8080/api/...
# admin console    http://127.0.0.1:3000/agent-admin/   (first-boot setup key is printed in the console)

(c) MCP proxy: between your AI client and its tools

# stdio: put this in your MCP client config as the server "command"
npx agent-gateway-sdk mcp-stdio --data-dir ~/.mont -- npx -y @modelcontextprotocol/server-filesystem /data
# Streamable HTTP (+ legacy HTTP+SSE at /mcp/sse) in front of a remote MCP server
npx agent-gateway-sdk mcp-http --upstream http://127.0.0.1:9000/mcp

Use an absolute --data-dir (/Users/you/.mont, C:\Users\you\.mont) inside client JSON configs. Most MCP clients start the command without a shell, so ~ is not expanded. The MCP Firewall Config Generator builds the wrapped client config, rules.json and a Compose file for you, all in the browser.

Works with local models (LM Studio & Ollama)

Mont wraps the MCP server (or the upstream REST API), not the LLM provider. The model on the other side makes no difference, so the same command works with a local model:

  • LM Studio: Program tab โ†’ Install โ†’ Edit mcp.json (stored at ~/.lmstudio/mcp.json), then use the same mcpServers entry you would give Claude Desktop. Starter: examples/lm-studio-filesystem-guard.

  • Ollama: Ollama itself does not speak MCP; the client that drives it does. Mont works with all of them: ollama launch claude (Claude Code on a local model, via claude mcp add โ€ฆ), ollmcp, Cline, Continue, Open WebUI (through mcpo or mcp-http), or your own Node / Python tool-calling loop. Starter: examples/ollama-mcp-telegram-approval.

Smaller local models (8Bโ€“32B) misfire tool arguments more often than frontier models: wrong paths, invented amounts, a write where a read was meant. A desktop "Allow this tool?" popup helps only while someone is watching the screen. Mont adds:

  • Fail-closed argument rules. It checks params.arguments as body.*: a path regex, amount <= 100, .. traversal. A call that matches nothing is blocked, and a value sent as text ("250") is never coerced into a number.

  • Spending caps and duplicate protection, enforced across sessions through the shared SQLite file.

  • Headless enforcement. It works the same when the model runs behind lms server start, ollama serve or a script with no UI to click.

  • Zero-tunnel phone approvals. Telegram long-polling or Slack Socket Mode, with no public URL or open port. The bot token stays in Mont, out of the model's context.

  • Proof. Every call, allowed or refused, becomes a SHA-256 hash-chained row in SQLite.

Then open the admin console. Gateway Setup walks you through the rest without code:

  • your upstream URL

  • a one-click policy pack (E-commerce, FinTech, CRUD)

  • phone approvals

  • budgets

  • business hours

Try the disaster first: run npm run demo:shopify in a clone of this repo. It shows a prompt-injected support bot refunding every order, first without Mont and then with it.

Copy-paste starters

Starter

What it shows

examples/lm-studio-filesystem-guard

LM Studio mcp.json (macOS/Linux + Windows): reads allowed, secret files blocked, writes need approval, deletes blocked

examples/ollama-mcp-telegram-approval

Ollama MCP clients (ollmcp, ollama launch claude, Cline, Continue) behind mcp-stdio, with zero-tunnel Telegram Approve / Reject and a one-command setup

examples/express-stripe-refund-cap

TypeScript Express app: refunds up to $50 auto-allowed, larger ones held for a human, more than $500 blocked, a $200/hour hard budget, duplicate protection. No Redis.

examples/shopify-refund-demo

The interactive "AI refund disaster" demo


Feature & tier overview

Licenses are offline Ed25519 keys and nothing phones home. Every new install gets an instant 7-day Pro trial, and a free 90-day Pro trial key needs no credit card.

Community (free forever)

Pro

Agency

Fail-closed firewall, reverse proxy, MCP proxy (stdio, Streamable HTTP, legacy SSE)

โœ…

โœ…

โœ…

Route rules, wildcard rules, payload policies, rate limits

โœ…

โœ…

โœ…

Spending Budgets & duplicate-action protection

โœ…

โœ…

โœ…

Approval queue + dashboard approvals, signed approval links

โœ…

โœ…

โœ…

Lockdown / Approval-only switch, business hours, alerts & daily digest

โœ…

โœ…

โœ…

PII & secret scrubber, outbound response guard, CSV export

โœ…

โœ…

โœ…

Shadow (dry-run) rules & Policy Time-Machine replay

โœ…

โœ…

โœ…

Hash-Chained Audit Ledger: every row chained

โœ…

โœ…

โœ…

Compliance audit trail: response capture, custom redaction keys, end-user & approver attribution

โœ…

โœ…

โœ…

Industry compliance templates (Fintech, Retail, Travel, Custom)

โœ…

โœ…

โœ…

Auditor Evidence Pack (attestation report + checksummed JSON bundle)

โ€”

โœ…

โœ…

Hash-Chained Audit Ledger: one-click integrity verification

โ€”

โœ…

โœ…

Zero-Tunnel Telegram / Slack Approve & Reject buttons & Telegram bot commands

โœ… 1 channel: Telegram bot/chat or Slack Socket Mode, on the single workspace

โœ… Telegram and Slack

โœ… Telegram and Slack

Edit & Approve (change a payload before it runs; API and chat)

โ€” (403)

โœ…

โœ…

Compensating rollback webhook on Revoke

โ€”

โœ…

โœ…

Agent discovery manifest (/.well-known/agent.json), unknown-endpoint report, approval idempotency

โœ…

โœ…

โœ…

Credential masking in the admin API & dashboard (Show / Copy for admins)

โœ…

โœ…

โœ…

Multi-Workspace (one install, many client stores)

1 workspace

3 workspaces

25 workspaces (or as licensed)

All-Clients Overview dashboard

โ€”

โ€”

โœ…

Multi-workspace / per-client Telegram chat / Slack channel approval routing

โ€”

โ€” (all workspaces use the main chat)

โœ…

Agent API keys

2

500

500

Team accounts (Admin / Read-only auditor), SSO header trust, Prometheus metrics, 7-day analytics

โ€”

โœ…

โœ…

Price

$0

$30/mo or $250/yr

montweel.com

Activate a key in Gateway Setup โ†’ License & Plan and it takes effect immediately. You can also set MONT_LICENSE_KEY, or pass licenseKey to createAgentGateway(). If a license lapses, paid features switch off cleanly. Workspaces beyond the plan are refused (402), and their traffic is never forwarded unguarded.

A paid admin endpoint called without the right plan answers 402 Payment Required with proRequired: true (plus agencyRequired: true for Agency-only features), the feature name and an upgradeUrl, so clients can show an upgrade prompt. The one exception is Edit & Approve: a Community POST /approvals/:id/decide that carries modifiedBody / modifiedQuery (or decision: "EDIT_APPROVE") is refused with 403 Forbidden (feature: "payloadPatching", proRequired: true) and the pending approval is left untouched, so it can still be approved or rejected as is. Turning on both Telegram polling and Slack Socket Mode on Community is refused with 402 (feature: "maxPhoneApprovalChannels"). An invalid or forged key never unlocks anything. Free 90-day trial keys are limited to one per machine and must be activated within 100 days of first install.


How it protects you

1. Rules: default deny, decided per route and per payload

Rule keys are "/api/x" (any method), "POST /api/x" (one method), or wildcards such as "POST /api/*refund*". MCP tools use the pseudo-method MCP ("MCP /api/mcp/tools/refund_order"). A request that matches no rule is blocked.

Mode

Effect

ALLOW

Forward to your API

REQUIRE_APPROVAL

Hold until a human approves (expires after 24 h)

BLOCK

Refuse with 403

SHADOW_BLOCK / SHADOW_APPROVAL

Dry run: forward, but log what the rule would have done

Payload policies inspect body.*, query.* and headers.* with > < >= <= === !== contains in regex exists. The first matching tier wins. Numbers are never coerced ("250" is not 250), and routes whose policies read the body only accept JSON.

"POST /api/refund": {
  "mode": "REQUIRE_APPROVAL",
  "rateLimit": 30,
  "policies": [
    { "name": "small", "when": [{ "field": "body.amount", "op": "<=", "value": 100 }],  "mode": "ALLOW" },
    { "name": "huge",  "when": [{ "field": "body.amount", "op": ">",  "value": 1000 }], "mode": "BLOCK" }
  ],
  "budget": { "field": "body.amount", "max": 300, "windowMinutes": 60, "per": "global", "onExceed": "REQUIRE_APPROVAL" },
  "dedupe": { "fields": ["body.orderId"], "windowMinutes": 1440, "onDuplicate": "BLOCK" }
}
  • Spending budgets cap the total an agent can move on its own. Twenty $90 refunds all pass an "โ‰ค $100" tier; a $300/hour budget stops the fourth. Budgets can be global or per agent, are stored in SQLite, and are race-free under bursts. A missing or text amount counts as over budget.

  • Duplicate protection refuses (or holds) a second action with the same field values while the first is allowed, waiting or done. A rejected attempt doesn't block a legitimate retry.

  • Starter policy packs (E-commerce & Shopify, Stripe & FinTech, Internal CRUD) install in one click.

2. Humans in the loop, from anywhere

  • Approval queue with a payload inspector. You see the redacted body and query, high-risk fields flagged (amount, email, destinationโ€ฆ), the caller's key, IP and User-Agent, and the Agent's Justification: taken from the x-mont-justification header (or the older x-agent-reason), the MCP params._meta["mont/justification"], or a justification / reason / summary field in the payload. Telegram and Slack show it directly above the Approve / Reject buttons.

  • Zero-LLM daily digest. GET /api/agent-admin/audit/digest (or View Daily Digest in the dashboard) gives one plain-English sentence for the last 24 hours: actions processed, risky calls blocked, the estimated dollars prevented (from amount / price), and how many approvals are waiting. It is computed by a local SQLite query; nothing is sent anywhere.

  • Phone approvals:

    • Zero-tunnel (every plan): Telegram inline Approve / Reject buttons via outbound long-polling, or Slack buttons via Socket Mode. No public URL, ngrok or open port. Community runs one of the two (a Telegram bot/chat or a Slack Socket Mode app) for its single workspace; Pro and Agency run both. Every alert also carries an Edit & Approve button; on Community, tapping it only shows the tapper a "requires Mont Pro" notice and changes nothing.

    • Signed links: Slack, Telegram or a custom webhook with HMAC-signed Approve / Reject links. Links open a confirmation page, so chat link previews can't approve anything.

  • Edit & Approve (Pro, Agency, Trial). Lower a hallucinated "amount": 250 to 50, fix an address, change a query parameter, or edit MCP tool arguments, then approve. From the dashboard, or straight from your phone with no tunnel:

    • Slack (Socket Mode): Edit & Approve opens a modal pre-filled with the JSON payload. Invalid JSON, or an edit a rule or spending budget refuses, is shown inline and the modal stays open. On success the request runs and the alert is updated to "Edited & Approved by โ€ฆ".

    • Telegram (polling): Edit & Approve sends a ForceReply prompt with the JSON in a copyable block. Reply to it with the edited JSON (or cancel). Only the approver who tapped, in the authorized chat, can submit; the prompt expires after 10 minutes. On success the alert's buttons are removed and it is marked "Edited & Approved".

    • Payloads too large for a Slack modal (~2,900 characters) or a Telegram message (4,096) get a notice to edit them in the dashboard instead.

    • Fields you didn't touch keep their real values, even the ones shown masked.

    • The rule is re-checked against your edit, and an edit can't push spend past a hard (onExceed: "BLOCK") spending budget.

    • The edited body goes out with a fresh Content-Length.

    • The original and modified payloads are both audited (redacted).

  • Exactly-once decisions. Every approval is decided once. A second decision (or a simultaneous approve + reject from two phones) gets "Action already taken" and changes nothing. Past the 24 h window an action becomes EXPIRED and can no longer be approved.

  • Revoke & Block Caller. On any approved action, this blocks the agent key and/or IP, auto-rejects its queued requests, and (Pro) calls your compensating rollback webhook (HMAC-signed, idempotency key included).

  • Emergency switch.

    • Lockdown refuses every agent request (nothing waiting can be approved).

    • Approval-only holds every write and lets reads through.

    • Flip it from the dashboard, the API or Telegram (/lockdown, /approvalonly, /resume, /status, /pending). Every gateway process sharing the database follows within about 2 seconds.

  • Business hours. Outside your opening hours (time-zone and DST aware), writes wait for a human.

  • Alerts & daily digest. You're told about attack bursts, budgets reached and mode changes, and get a morning summary of money protected vs executed. Each alert is sent once, even across processes.

3. MCP tool-call firewall

Every JSON-RPC tools/call gets the same rules, payload policies (on params.arguments as body.*), budgets, approvals and audit trail.

"MCP /api/mcp/tools/search_orders": { "mode": "ALLOW" },
"MCP /api/mcp/tools/refund_order":  { "mode": "REQUIRE_APPROVAL",
  "policies": [{ "when": [{ "field": "body.amount", "op": "<=", "value": 100 }], "mode": "ALLOW" }] },
"MCP /api/mcp/tools/*delete*":      { "mode": "BLOCK" }
  • Unlisted tools are blocked. HTTP rules such as /api/* never apply to MCP tools.

  • Refusals come back as tool results with isError: true, so the model can read why.

  • A call that needs approval is held open until a human decides. If the wait times out or the agent disconnects, the call expires and can never run later.

  • Transports:

    • stdio: mcp-stdio

    • Streamable HTTP: mcp-http

    • legacy HTTP+SSE for older clients: GET /mcp/sse + POST /mcp/messages?sessionId=โ€ฆ

  • Programmatic use: createMcpHttpProxy(gateway, { upstreamUrl }), startMcpStdioProxy(gateway, { command, args }), or gateway.mcp.check(...).

4. Data protection in both directions

  • Deep PII & secret scrubber. Nothing is stored in SQLite or sent to Slack, Telegram or webhooks without passing through it. It walks every level of nested JSON.

    • Always removed: auth headers, cookies, passwords, tokens, API keys (Stripe, GitHub, Slack, AWS, OpenAI/Anthropic, JWTโ€ฆ) and Luhn-valid card numbers.

    • Masked by default: emails and phone numbers.

    • Your own keys: add field names to audit.redactKeys (or Settings โ†’ Audit & PII Redaction). They match the whole key, ignoring case, _, - and ., so credit_card also catches creditCard, but key does not catch monkey.

    • Rules still evaluate the real values, and approved requests replay from an AES-256-GCM encrypted original.

  • Outbound response guard (opt-in). Mont inspects what your API or MCP tool sends back before the agent sees it.

    • Bulk dumps: a JSON array longer than your limit (e.g. 1,000 customer rows) is withheld with 502 Response Policy Violation, or truncated.

    • Secrets: they are scrubbed in-flight, or the response is withheld.

    • It works in proxy mode, middleware mode and on every MCP transport.

5. Proof: a tamper-evident audit ledger

  • Cryptographic hash chain. Every audit row is chained with SHA-256: row_hash = SHA-256(prev_hash + id, timestamp, caller, route, decision, redacted request, โ€ฆ, end user, approver, redacted response).

    • Verify Audit Ledger (Pro; Audit Logs page, or GET /audit/verify) re-hashes the chain and pinpoints any edited, deleted, inserted or truncated row.

    • Retention pruning keeps the chain verifiable.

    • Several gateway processes can share one database safely.

    • The daily digest carries the chain head, giving you an off-box copy.

    • Ledgers sealed by older versions still verify after upgrading.

  • Request and response capture. Each audit row keeps the redacted request (body, query, headers). With audit.capturePayloads on (the default), it also keeps the redacted upstream response: status, content type and body, up to 64 KB. That includes the response to an approved, replayed request.

    • The response is sealed into the same hash chain. A row waits (up to 45 s) for its response before it is sealed.

    • Bodies are redacted before they are truncated, so a large payload cannot leak a secret by being cut mid-object.

    • Redaction runs after the response has gone out, so it adds no latency.

    • Event streams, and binary or compressed bodies, are noted but not stored. So are responses over 1 MB.

  • End-user attribution (end_user). Agents name the human they act for in the SSO user header (x-forwarded-user by default).

    • Verified when the request also carries the SSO shared secret (x-gateway-sso-secret, with Trust identity proxy headers on). This means your identity proxy vouched for the user.

    • Unverified (agent-claimed) otherwise. The dashboard badges the two differently, the CSV marks them verified or agent-claimed, and the flag is part of the hash.

    • It is recorded only; it never grants access.

  • Approver attribution (approved_by). The admin who released a held action is recorded on its APPROVED row: the signed-in account, or the SSO identity once the shared secret has checked out. The end user follows the action from its queued row to that decision row.

  • Row details. Expand any row in Audit Logs to see the redacted request and response, the end user and approver, and the row's ledger hash (GET /logs/:id).

  • Filters. Audit logs filter by status, method, path (contains or exact), request / approval id (#736 from Telegram), user agent, date range, shadow hits (shadow=1) and unknown endpoints (unknown=1: calls that matched no rule and were refused by default deny, with their payload, so you can see what agents are trying to reach). The CSV export uses the same filters.

  • Industry compliance templates. Pick a preset in Settings โ†’ Audit & PII Redaction, or call POST /compliance/apply-template.

    Template

    Frameworks

    Adds redaction for

    Suggested approval rules

    Fintech & Banking

    PCI-DSS, SOC2

    cvv, pan, iban, swift, routing_number, account_number, ifsc, tax_id, ssnโ€ฆ

    transfers, payouts, refunds, deletes

    Retail & E-Commerce

    GDPR, CCPA

    card_number, billing_address, shipping_address, phone_number, gift_card_code, dobโ€ฆ

    refunds, price changes, discounts, customer deletes

    Travel & Hospitality

    GDPR, PCI-DSS

    passport_number, pnr, ticket_number, visa_number, national_id, frequent_flyer_idโ€ฆ

    cancellations, booking changes, ticket issuance

    Custom

    your tags (SOC2, HIPAA, ISO 27001โ€ฆ)

    your keys

    none

    • Templates only ever add. Their keys are merged into audit.redactKeys, and nothing is removed.

    • With includeRules: true, their REQUIRE_APPROVAL rules are added to the selected workspace, but never over a rule you already have. A route you explicitly block stays blocked.

  • Auditor Evidence Pack (Pro; Export Auditor Pack on the Audit Logs page, or GET /audit/export-pack?format=report|json&from&to&agentName&endUser). It is one download for your auditor:

    • Attestation report (.md): audit scope, a live ledger-integrity certificate (pass/fail, rows verified, genesis and latest hash), the policy and redaction snapshot (secrets omitted), summary metrics per agent and per verified vs agent-claimed end user, and the scoped transaction table.

    • JSON evidence bundle (.json): the same data with every row and full hashes, plus bundleSha256. That is the SHA-256 of JSON.stringify({ metadata, ledgerVerification, policySnapshot, summary, logs }), so anyone can confirm the file was not changed after download. It is a checksum, not a signature. For proof against the gateway itself, compare the ledger head hash with the one in the daily digest.

  • Money protected shows how much agents tried to move and were stopped, next to what was executed.

  • CSV export for accounting and chargeback disputes (formula-injection safe).

  • Shadow rules & Policy Time-Machine. Try a policy as SHADOW_* on live traffic, or click Test Rules Against History. The last N real requests are replayed through your rules, including rate limits, budgets and duplicate protection, and you see exactly which ones would now be blocked, held or rate-limited.

6. Agencies: many client stores, one install (Agency)

Each workspace has its own rules, budgets, upstream URL, emergency switch, business hours, approval chat or Slack channel, and mws_โ€ฆ API key. That key is required by default, so one client's agent can never act on another client's store.

Agents select a workspace with

Example

Path prefix

POST /api/w/acme/refund (forwarded upstream as /api/refund)

Header

x-mont-workspace: acme

Bearer key

Authorization: Bearer mws_โ€ฆ

  • Dashboard: a Workspace Switcher in the top bar (Pro and Agency) and, on Agency, an All Clients Overview (GET /workspaces/overview) with mode, money protected, refusals, waiting approvals and shadow hits per client.

  • Approvals per client (Agency): each client's approvals go to its own Telegram chat or Slack channel, a button tapped in the wrong chat is refused, and a client's chat can run bot commands for that client only. On Pro, every workspace's approvals go to the main chat / channel.

  • Key rotation: POST /workspaces/:slug/rotate-key issues a new mws_โ€ฆ key and retires the old one.

  • MCP: mcp-http --workspace <slug>, /w/<slug>/mcp, or mcp-stdio --workspace <slug>.

7. Access control & identity

  • Agent API keys. Create agk_โ€ฆ keys in Settings โ†’ Agent Keys (2 on Community, 500 on Pro). Agents send them as x-agent-key or Authorization: Bearer agk_โ€ฆ. The raw key is shown once; only its SHA-256 is stored. Every audit row, budget (per: "agent") and blocklist entry is tied to the key.

  • Caller blocklist. Agent keys and IPs blocked from Revoke & Block Caller are listed under GET /blocked-callers and can be unblocked there.

  • Team accounts (Pro). The owner account is created on first boot with the setup key. Add Admin and Read-only auditor users, reset passwords and change roles in the Team tab. Auditors can read everything but change nothing.

  • Static tokens. ADMIN_TOKEN / VIEWER_TOKEN for CI/CD and read-only automation.

  • SSO (Pro). Trust x-forwarded-user / x-forwarded-role from an identity proxy that also sends the shared x-gateway-sso-secret (see Behind an SSO / OAuth2 proxy).

  • Credential masking. Bot tokens, webhook URLs, signing secrets and the SSO shared secret are always masked in GET /setup and GET /config, even for admins. Read-only users don't see webhook URLs at all. Saving a form that still holds the masked values keeps the stored secrets. Admins can reveal or copy one credential at a time with GET /secrets/:field (allow-listed fields only, never cached). The Auditor Evidence Pack never contains a credential.

  • Agent discovery. GET /.well-known/agent.json publishes the endpoints agents may call (ALLOW and REQUIRE_APPROVAL rules), their descriptions and rate limits. Blocked routes are not listed.

8. Observability

  • Analytics (GET /logs/analytics?window=24h|1w): decisions over time, pending approvals and top agents. The 7-day window is Pro; Community falls back to 24 h.

  • Prometheus metrics (Pro): GET /metrics on the admin API. Scrapers can authenticate with Authorization: Bearer <VIEWER_TOKEN>.

  • Test notifications: POST /setup/test-notification checks your Telegram / Slack / webhook settings.


Deploy with Docker

The official image is ghcr.io/montweel/agent-gateway (linux/amd64 and linux/arm64). Tags: latest, <major>.<minor> (e.g. 2.2) and the exact version (e.g. 2.2.0).

Copy docker-compose.yml next to your other services, then:

docker compose up -d

docker-compose.yml runs the standalone proxy with these defaults:

  • the agent-facing proxy on :8080 (8080:8080)

  • the admin console on 127.0.0.1:3000 only (127.0.0.1:3000:3000)

  • data in the named volume mont-data, mounted at /data: the SQLite WAL database, rules, config and audit log. It survives restarts and upgrades.

  • the license install anchor in the named volume mont-anchor, mounted at /home/node/.montweel

  • a non-root user, a read-only root filesystem and no Linux capabilities

  • a health check on GET /api/agent-admin/auth/status (admin port), which returns 200 once the database is ready

To run it next to existing containers:

  1. Join their network (see the commented networks: block).

  2. Set your API with UPSTREAM_URL: "http://your-api:4000" in environment:, or in the console under Gateway Setup. If you set UPSTREAM_URL, it is applied on every start and overrides the console value.

On first boot, docker compose logs mont shows the setup key, or you can set SETUP_TOKEN.

Upgrade: docker compose pull && docker compose up -d. Your data stays in the volumes.

Without Compose:

docker run -d --name mont --restart unless-stopped \
  -p 8080:8080 -p 127.0.0.1:3000:3000 \
  -v mont-data:/data -v mont-anchor:/home/node/.montweel \
  -e UPSTREAM_URL=http://your-api:4000 \
  ghcr.io/montweel/agent-gateway:latest

To build locally, uncomment build: . in docker-compose.yml and run docker compose up -d --build, or run docker build -t agent-gateway:dev ..

The image is a multi-stage build on Node 22 (Debian bookworm-slim, glibc, for the native sqlite3 driver). It runs node /app/dist/cli.js start --data-dir /data under tini. In the container these are set: HOST=0.0.0.0, PORT=8080, ADMIN_HOST=0.0.0.0, ADMIN_PORT=3000, NODE_ENV=production. Limit exposure with the published ports, not these variables.

Releases: pushing a v* git tag (for example v2.1.0) runs .github/workflows/docker.yml. It publishes 2.1.0, 2.1 and latest to GHCR using the built-in GITHUB_TOKEN. You can also start it by hand from the Actions tab (Run workflow). Publishing a GitHub Release then runs publish.yml (npm, with provenance) and mcp-registry.yml. The second publishes server.json to the Official MCP Registry as io.github.montweel/agent-gateway-sdk, using GitHub OIDC with no secrets. npm version patch|minor|major keeps server.json in step with package.json automatically.

Other hosts: Mont runs anywhere Node does: AWS ECS/EC2, Render, Fly.io, Railway, Kubernetes or a VPS. Mount a persistent volume for the data folder.

Behind an SSO / OAuth2 proxy (Pro):

  1. Enable Trust identity proxy headers in Settings.

  2. Have the proxy send x-forwarded-user, x-forwarded-role and the generated x-gateway-sso-secret.

  3. Keep the admin listener on a private interface.


Configuration

Variable

Purpose

Default

PORT / HOST

Agent-facing listen port / bind address (0.0.0.0 in containers)

8080 (CLI) / 127.0.0.1

ADMIN_PORT / ADMIN_HOST

Admin API + dashboard listener

3000 / 127.0.0.1

UPSTREAM_URL

(start) upstream API to protect, same as --target; saved to config.json on every start

unset (Setup tab value)

TRUST_PROXY

true behind exactly one reverse proxy (client IPs from X-Forwarded-For)

off

CORS_ORIGINS

Browser origins allowed to call the admin API

dev: http://localhost:5173

SETUP_TOKEN

First-boot setup key (create the owner from another machine)

random, printed at startup

ADMIN_TOKEN / VIEWER_TOKEN

Static tokens for CI/CD and read-only automation

unset

MONT_LICENSE_KEY

MONT-V2.โ€ฆ Pro / Agency key (or a v1 MONT-โ€ฆ Pro key)

unset

MONT_AGENT_KEY

(mcp-stdio) the local client's agk_โ€ฆ agent key or mws_โ€ฆ workspace key

unset

Audit settings (config.json, or Settings โ†’ Audit & PII Redaction):

"audit": {
  "capturePayloads": true,
  "redactKeys": ["password", "token", "authorization", "credit_card", "ssn", "secret", "key"],
  "activeTemplate": "fintech",
  "complianceFrameworks": ["PCI-DSS", "SOC2"]
}

SDK options (createAgentGateway({...})):

  • port

  • rulesPath, configPath, dbPath

  • adminPort, adminHost

  • adminToken, viewerToken, setupToken

  • dbOperationTimeoutMs

  • licenseKey, licenseAnchorFile

  • telegramApiBase, slackApiBase

Admin API (all under /api/agent-admin, scoped with x-mont-workspace):

Area

Endpoints

Auth & team

auth/status, auth/setup, auth/login, auth/logout, auth/change-password, users, users/:id, users/:id/reset-password

Rules & approvals

rules, approvals, approvals/counts, approvals/:id/decide, approvals/:id/revoke, blocked-callers, blocked-callers/:id

Agent keys

agent-keys, agent-keys/:id

Logs & ledger

logs, logs/:id, logs/analytics, logs/export.csv, audit/verify, audit/head, audit/digest, audit/export-pack, simulate/history

Compliance

compliance/templates, compliance/apply-template

Protection & alerts

protection/summary, emergency, guards/usage, alerts/digest

Settings & setup

config, setup, setup/presets, setup/presets/:id/apply, setup/test-notification, secrets/:field

Workspaces

workspaces, workspaces/overview, workspaces/:slug, workspaces/:slug/rotate-key

License & metrics

license, metrics

CLI (npx agent-gateway-sdk <command>, also installed as mont-gateway):

Command

Key options

start

--target <url>, --port, --host, --admin-port, --admin-host, --data-dir

mcp-http

--upstream <url> (required), --port (8090), --host, --path (/mcp), --wait-seconds (300), --workspace <slug>, --admin-port, --admin-host, --data-dir

mcp-stdio

--wait-seconds, --admin-port (skipped if busy), --no-admin, --data-dir (share it between sessions to share rules and approvals), --workspace <slug>, then -- <server command>

--version, help

Signing license keys (needs your Ed25519 private key; never leaves your machine):

npm run keygen -- sign --tier=AGENCY --org="Acme Automation" --max-workspaces=20 --days=365
npm run keygen -- verify MONT-V2.eyJ2Ijoy...

Development

npm install && npm --prefix dashboard install
npm run typecheck      # gateway + tools
npm test               # 10 files, 103 tests: fail-closed chaos, v1.2, v1.3 shop kit, v2.0 enterprise, owner UX,
                       # audit trail, compliance, secret masking, license gating, Community phone approvals
npm run check:server-json   # server.json (MCP Registry) matches package.json
npm run build:all      # dist/ + dashboard/dist/
npm run dev            # gateway with reload; dashboard: npm --prefix dashboard run dev

Tests run real gateways on temporary folders with a throwaway license key pair, and never touch your ~/.montweel install anchor.


Glama

Mont - Agent Gateway SDK MCP server - quality and maintenance score on Glama


Search keywords

ai-agents ยท agent-gateway ยท api-firewall ยท mcp ยท mcp-proxy ยท human-in-the-loop ยท prompt-injection ยท ai-safety ยท rate-limiter ยท spending-limits ยท audit-log ยท tamper-evident ยท reverse-proxy ยท sqlite ยท local-first ยท zero-infrastructure ยท multi-tenant ยท shopify ยท stripe ยท nodejs ยท typescript ยท express-middleware


The Mont Agent Gateway SDK is provided strictly "AS IS" without warranty of any kind or SLA. By downloading, installing, deploying, or using this software, you agree to the complete terms, disclaimers, and liability limitations in TERMS.md.

Website: https://montweel.com ยท Support: support@montweel.com

Available Tools

9 tools
add_observationsAdd ObservationsA
Idempotent

Add new observations to existing entities in the knowledge graph

Inputs: observations (required). Returns: results

create_entitiesCreate EntitiesA
Idempotent

Create multiple new entities in the knowledge graph. An entity whose name already exists, or repeats an earlier entity in the same call, is skipped and its observations are not added; the result lists the skipped names in skipped. Use add_observations to add observations to an existing entity.

Inputs: entities (required). Returns: skipped, entities

create_relationsCreate RelationsA
Idempotent

Create multiple new relations between entities in the knowledge graph. Relations should be in active voice

Inputs: relations (required). Returns: relations

delete_entitiesDelete EntitiesA
DestructiveIdempotent

Delete whole entities from the knowledge graph, together with every relation that points to or from them and all their observations. Use it only to remove an entity entirely; to remove a link between two entities and keep both, use delete_relations, and to remove facts from an entity, use delete_observations. Cannot be undone.

Inputs: entityNames (required). Returns: message, success

delete_observationsDelete ObservationsB
DestructiveIdempotent

Delete specific observations from entities in the knowledge graph

Inputs: deletions (required). Returns: message, success

delete_relationsDelete RelationsA
DestructiveIdempotent

Delete specific relations (from, to, relationType) from the knowledge graph and keep the entities they connect. Each relation must match an existing one exactly on all three fields; if unsure, call open_nodes (or search_nodes) first to read the stored relationType. Use it to remove a link between two entities; to remove an entity itself, use delete_entities. Cannot be undone.

Inputs: relations (required). Returns: message, success

open_nodesOpen NodesA
Read-onlyIdempotent

Retrieve specific entities by their exact names, with every relation that touches one of them. Use this when you already know the names (from the conversation, or from an earlier search_nodes or read_graph result); it is the cheapest way to read entities you can name. Prefer search_nodes when you only have a keyword or part of a name. Names that do not exist are skipped.

Inputs: names (required), observationLimit. Returns: entities, relations

read_graphRead GraphA
Read-onlyIdempotent

Read the entire knowledge graph: every entity with its observations, and every relation. The result grows with the graph, so use this only when you need everything; prefer search_nodes to find entities by keyword and open_nodes to read entities whose names you know.

Inputs: entityTypes, observationLimit. Returns: entities, relations

search_nodesSearch NodesA
Read-onlyIdempotent

Search the knowledge graph for entities whose name, type or observations contain the query (case-insensitive). Use this when you have a keyword, a topic or part of a name but not the exact entity names. Prefer open_nodes when you already know the exact names, and use read_graph only when you need the whole graph. Returns the matching entities and every relation that touches one of them.

Inputs: query (required), limit, observationLimit. Returns: entities, relations

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    A4/5.0

    Scored across 9 tools

    Disambiguation5/5

    The three delete tools are explicitly scoped by target (entities vs. relations vs. observations) and each description cross-references the others for the alternative case. The three read tools (read_graph, search_nodes, open_nodes) are likewise separated by intent: whole graph, keyword search, exact-name lookup, with guidance on when to prefer each. create_entities/create_relations/add_observations each target a distinct graph primitive.

    Naming Consistency5/5

    All nine tools follow a clean verb_noun snake_case pattern (create_entities, delete_observations, search_nodes, open_nodes), grouped symmetrically across create/delete/read. No mixing of casing or naming styles.

    Tool Count5/5

    Nine tools map one-to-one onto the knowledge graph primitives (entity, relation, observation) times the operations actually supported, with no filler or redundant variants. The count sits comfortably in the well-scoped 3-15 range.

    Completeness4/5

    Create and delete are fully covered for entities, relations, and observations, plus three read paths, so most agent workflows terminate successfully. However, there is no update/rename operation for an entity's name or type and no way to edit a relation's type in place โ€” agents must delete and recreate, which is a workaroundable but real gap.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Security, cost, and health governance proxy for MCP infrastructure. Enforces YAML-configurable security policies (blocklists, rate limits, token budgets), tracks real token costs via tiktoken, monitors server health with live JSON-RPC probes. Features OAuth 2.1/OIDC with RBAC, web dashboard, payload normalization, semantic shell AST analysis, mTLS, and a formal STRIDE threat model.
      4
      604 npm
      4
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables autonomous agents and MCP-compatible clients to route inputs through a deterministic firewall that flags and sanitizes prompt injection, jailbreaks, system prompt exfiltration, and tool hijacking. It supports JSON-RPC stdio integration for tools like Claude Desktop, Cursor, and multi-agent frameworks.
      7
      -
    • A
      license
      B
      quality
      B
      maintenance
      Local proxy in front of the stdio MCP servers of Claude Code and Cursor: reads pass, writes wait for a person's approval, and destructive tools stay hidden until allowed. Tool definitions are pinned, and every call leaves a signed, hash-chained receipt.
      12
      1
      Apache 2.0