Mont - Agent Gateway SDK
Manage a persistent knowledge graph of entities, observations, and relations.
Create entities with names, types, and observations; duplicate entities are skipped.
Create active-voice relations between existing entities; duplicate relations are skipped.
Add observations to existing entities; duplicate observations are not added.
Delete whole entities along with their relations and observations.
Delete specific observations or specific relations while keeping entities intact.
Read the entire graph, optionally filtered by entity type or limited observations per entity.
Search entities by keyword across names, types, and observations.
Open specific entities by exact name and retrieve all relations touching them.
Mont (agent-gateway-sdk) โ The Firewall Between AI Agents and Your APIs

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
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 ( |
Blind MCP tool calls. The model calls | 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-sdkimport 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/mcpUse 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 samemcpServersentry 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, viaclaude mcp add โฆ),ollmcp, Cline, Continue, Open WebUI (throughmcpoormcp-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.argumentsasbody.*: 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 serveor 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 |
LM Studio | |
Ollama MCP clients ( | |
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. | |
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) | โ ( | โ | โ |
Compensating rollback webhook on Revoke | โ | โ | โ |
Agent discovery manifest ( | โ | โ | โ |
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 |
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 |
| Forward to your API |
| Hold until a human approves (expires after 24 h) |
| Refuse with 403 |
| 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 thex-mont-justificationheader (or the olderx-agent-reason), the MCPparams._meta["mont/justification"], or ajustification/reason/summaryfield 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 (fromamount/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": 250to50, 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
ForceReplyprompt with the JSON in a copyable block. Reply to it with the edited JSON (orcancel). 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
EXPIREDand 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-stdioStreamable HTTP:
mcp-httplegacy HTTP+SSE for older clients:
GET /mcp/sse+POST /mcp/messages?sessionId=โฆ
Programmatic use:
createMcpHttpProxy(gateway, { upstreamUrl }),startMcpStdioProxy(gateway, { command, args }), orgateway.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., socredit_cardalso catchescreditCard, butkeydoes not catchmonkey.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.capturePayloadson (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-userby 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
verifiedoragent-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 itsAPPROVEDrow: 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 (
#736from 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, theirREQUIRE_APPROVALrules 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, plusbundleSha256. That is the SHA-256 ofJSON.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 |
|
Header |
|
Bearer key |
|
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-keyissues a newmws_โฆkey and retires the old one.MCP:
mcp-http --workspace <slug>,/w/<slug>/mcp, ormcp-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 asx-agent-keyorAuthorization: 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-callersand 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_TOKENfor CI/CD and read-only automation.SSO (Pro). Trust
x-forwarded-user/x-forwarded-rolefrom an identity proxy that also sends the sharedx-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 /setupandGET /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 withGET /secrets/:field(allow-listed fields only, never cached). The Auditor Evidence Pack never contains a credential.Agent discovery.
GET /.well-known/agent.jsonpublishes the endpoints agents may call (ALLOWandREQUIRE_APPROVALrules), 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 /metricson the admin API. Scrapers can authenticate withAuthorization: Bearer <VIEWER_TOKEN>.Test notifications:
POST /setup/test-notificationchecks 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 -ddocker-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/.montweela 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:
Join their network (see the commented
networks:block).Set your API with
UPSTREAM_URL: "http://your-api:4000"inenvironment:, or in the console under Gateway Setup. If you setUPSTREAM_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:latestTo 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):
Enable Trust identity proxy headers in Settings.
Have the proxy send
x-forwarded-user,x-forwarded-roleand the generatedx-gateway-sso-secret.Keep the admin listener on a private interface.
Configuration
Variable | Purpose | Default |
| Agent-facing listen port / bind address ( |
|
| Admin API + dashboard listener |
|
| ( | unset (Setup tab value) |
|
| off |
| Browser origins allowed to call the admin API | dev: |
| First-boot setup key (create the owner from another machine) | random, printed at startup |
| Static tokens for CI/CD and read-only automation | unset |
|
| unset |
| ( | 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({...})):
portrulesPath,configPath,dbPathadminPort,adminHostadminToken,viewerToken,setupTokendbOperationTimeoutMslicenseKey,licenseAnchorFiletelegramApiBase,slackApiBase
Admin API (all under /api/agent-admin, scoped with x-mont-workspace):
Area | Endpoints |
Auth & team |
|
Rules & approvals |
|
Agent keys |
|
Logs & ledger |
|
Compliance |
|
Protection & alerts |
|
Settings & setup |
|
Workspaces |
|
License & metrics |
|
CLI (npx agent-gateway-sdk <command>, also installed as mont-gateway):
Command | Key options |
|
|
|
|
|
|
|
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 devTests run real gateways on temporary folders with a throwaway license key pair, and never touch your ~/.montweel install anchor.
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
Legal & Terms of Use
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 toolsadd_observationsAdd ObservationsAIdempotent
Add new observations to existing entities in the knowledge graph
Inputs: observations (required). Returns: results
create_entitiesCreate EntitiesAIdempotent
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 RelationsAIdempotent
Create multiple new relations between entities in the knowledge graph. Relations should be in active voice
Inputs: relations (required). Returns: relations
delete_entitiesDelete EntitiesADestructiveIdempotent
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 ObservationsBDestructiveIdempotent
Delete specific observations from entities in the knowledge graph
Inputs: deletions (required). Returns: message, success
delete_relationsDelete RelationsADestructiveIdempotent
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 NodesARead-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 GraphARead-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 NodesARead-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
Scored across 9 tools
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.
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.
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.
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
Related MCP Connectors
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
Real-time MCP & A2A prompt-injection, jailbreak, and tool-schema poisoning firewall for AI agents.
Autonomous agent guardrails, bash sandboxing, MCP rugpull diffing & prompt firewalls.
Related MCP Servers
- AlicenseAqualityDmaintenanceSecurity, 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.4604 npm4MIT
- FlicenseNot gradedqualityBmaintenanceEnables 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-
- AlicenseBqualityBmaintenanceLocal 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.121Apache 2.0
- AlicenseAqualityBmaintenanceZero-dependency local MCP firewall, secret shield, and stdio inspector for Cursor, Claude Code, and Claude Desktop.44679 npmMIT