Skip to content
Muhammet Şafak
tr
Cover — Tan the beaver stands at a gate-shaped checkpoint that data blocks from the left flow through; on the right they become padlocked, chained hexagons

McpGuard: a rule-based security proxy for MCP traffic

A proxy between an agent and its MCP servers: scans results for injection, masks PII, enforces access and logs decisions to a hash-chained audit log.

What it does today

Sits between an agent and its MCP servers over stdio (`wrap`) or HTTP (`serve`), scans tool results and resource contents for prompt injection, masks personal data, enforces access by tool, role and dangerous capability combination, pins a server's tool definitions and writes every decision to a hash-chained audit log. Anyone wiring MCP servers into agents can try it by cloning and building the repository; it is not published on npm.

Started
September 2026 — Ongoing

Form

Open-Source

Technologies

TypeScript Node.js MCP YAML OTLP

McpGuard’s injection scan catches 100% of my 700-item corpus with 0.0% false positives. I read that number as a ceiling: the corpus and the ruleset came from the same hands. What it says and what it does not say is the subject of this entry.

A checkpoint between the agent and the MCP server

McpGuard is a security proxy between an MCP client and its servers. Nothing changes in the client or the server; you put wrap (stdio) or serve (HTTP) where the server’s own command was. It scans tool results and resource contents, masks personal data and applies per-tool allow / deny rules. Roles are mapped from the caller’s identity, servers.<name>.roles decides who may reach a server, and dangerous combinations such as “read a file” plus “reach the network” are enforced on every call. Tool definitions are hashed into guardlock.json on first contact; if the list differs later, tools/list and tools/call are refused until lock --accept or a restart. Every decision goes to a hash-chained JSONL audit log holding masked content and a keyed fingerprint of the raw content, never the raw content. serve exposes each server under /mcp/<name> with its own rules, lock entry and connection pool; it defaults to loopback, refuses other addresses without auth.tokens and http.allowed_hosts, and has no TLS.

The starter policy observes (mode: flag): decisions are recorded, nothing is blocked; you measure first, then move to enforce.

The scan is deterministic and limited to a closed list

The first tier uses no model: signature rules, imperative mood, hidden Unicode, decoded payloads, egress beacons and chat-frame injection, in Turkish and English. The score is computed in integers, so the verdict is byte-identical on every platform. Turkish national id, tax number, IBAN, card (checksum-gated), phone and e-mail are masked; pii.profile: health optionally adds institution reference numbers, clinical dates, medicine-pack serials and US SSN/Medicare ids. Names and addresses are not recognised.

Three gates are scanned: tools/call, resources/read and tools/list. prompts/get, sampling/createMessage and elicitation are deliberately not.

What the 100% says

The corpus is 700 labelled items: 300 positives across 12 attack families, 400 negatives. The holdout split separates the operating point, not the rules, so 100% means “every attack family the corpus contains, at ruleset 0.1.0”; I do not know what happens against a phrasing nobody wrote a rule for. A rule engine cannot close the paraphrase gap; my answer is an off-by-default second tier, a local model you run yourself that can only raise a decision. On my machine, gemma4:12b through Ollama called 61 of 64 paraphrased injections an injection and 0 of 60 benign items; that is one model on a small set, not a rate. The default band also sends none of those 64 paraphrases to it: all of them score below flag_at in the rule engine, and 57 score exactly 0. Sending everything is the opt-in band_from: 0.

On latency, the corpus median is 188 bytes and at 1 KB p95 is 0.23 to 0.27 ms. Up to 32 KB p95 stayed under 20 ms in every run; above that it depends on the machine, and at 128 KB it ranged from 32.5 to 202 ms over three runs.

On main today: v0.2.0 is being put together

Alpha. All of this is on main on GitHub; nothing is published on npm, so you clone, run npm install && npm run build and use node packages/cli/dist/main.js. I am assembling v0.2.0: the documentation is in review, the end-to-end acceptance scenario and the plan-end security review are next.

McpGuard chains with AgentFuse: McpGuard sits outermost and injects the session identity, AgentFuse adopts it.

Tags: #ai#mcp#security#prompt-injection#pii
Share:

More Records

All records

A proxy between an agent and its MCP servers that cuts semantic loops, budget overruns and risky tool calls; its default mode only observes.

What it does today

Sits between an agent and its MCP server, sees every tools/call, and stops repeating loops, sessions that exceed a duration or call budget, and tools the policy forbids. Anyone running agents that call tools over MCP can try it with `npm i -g @tunedness/agentfuse` (0.1.0).

Open-Source TypeScript Node.js MCP +2 more
September 2026 — Ongoing

Build notes on serving the documentation of many projects from one multi-tenant server, each with its own MCP endpoint and documents kept on your machine.

What it does today

Makes a project's folder, git repository, Obsidian vault or Notion workspace searchable behind a single MCP endpoint, so an agent reaches the documentation without the data going to a third party. Anyone who can run Docker can host it and manage it from the dashboard.

Open-Source Web TypeScript Node.js Fastify +6 more
August 2026 — September 2026

A CLI that solves a problem repeatedly in isolated sessions and measures how diverse the solution paths are, with JSON and HTML reports. Not on PyPI.

What it does today

Has a model solve the problems of a suite YAML repeatedly in isolated sessions, measures how diverse the solution paths are and how much accuracy drops when a problem is changed on the surface, writes a JSON and HTML report per problem and fails CI on suspected memorization. Engineers choosing a model or checkpoint, or producing fine-tuning data, can clone the repository and install it with uv; it is not on PyPI.

Open-Source Python Typer Pydantic +3 more
November 2026 — Ongoing

Search the site

Start typing to search posts, projects and pages.

Esc to close Powered by Pagefind