MCP Gateway (AI Agent Tool Bridge)

A bridge exposing internal services (GPU inference, RAG memory, Docker, browser, search, host status) as standardized MCP tools behind one authenticated endpoint.

Evidence tier: Verified | code (private). The gateway runs and serves the tools listed below. The implementation lives in a private repository; the public repository carries the architecture, the tool reference, the design decisions and the measurements. Source access is by request.

View the public repository on GitHub

The public repository contains the full architecture documentation and tool reference. For source code access, contact me.

What this proves

This project proves I can design, deploy and measure an AI gateway with real constraints rather than describe one: one authenticated endpoint over 53 tools, per-principal authorisation that filters the advertised surface, and published numbers for latency, failure rate and guardrail behaviour. The evaluation, the rejected alternatives and the known limitations are in the same repository, which is the part most portfolios leave out.

What exists

Where to read the detail

DocumentWhat it contains
Architecture diagramMermaid flow from agent client to LAN-only service, with the ACL and the socket proxy
Tool referenceAll 53 tools by category, generated from the deployed source
EVALUATION.mdLatency by hop, failure rate, the 20-case guardrail eval, the cost model, and what was not measured
DECISIONS.mdWhy streamable-http, why per-principal ACLs, why only search is cached, and the cost of each choice
Model cardThe models behind the GPU tools, their intended use and their limits
Data cardWhat the memory tools store, what they never store, and how deletion actually works

What Broke / Challenges

A working call reported zero results. Agents read MCP results through an adapter with a fixed details ceiling. When a tool returned more than that ceiling, the transport replaced the payload with a shape-compatible stub, so sc.results || [] evaluated to an empty array. The call had succeeded, the data existed, and the agent reported “nothing found”. It was measured three times before it was believed, and the belief that survived longest was the wrong one: that the memory service was broken.

The fix was a version floor on the adapter, which returns an explicit intermediate_result_too_large error instead of a stub, plus a caller rule: check the omission flag before trusting the shape, and validate a surprising empty with one direct call before blaming a service. The lesson generalised: a truncated result must never be silent, because an empty result produced by truncation is worse than an error, since the agent acts on it.

A pinned dependency that broke every browser tool. camoufox was pinned at 0.5.4 because a rebuild resolved 0.5.5, which fetched browser build 152.0.4-beta.29 while the durable fingerprint profile still pointed at beta.28. Every anti-detect browser tool then failed to launch. The lesson was not “pin versions” in the abstract: the browser artefact is chosen by camoufox’s own CLI, so the pin has to cover that too, and the combination has to be proven in a throwaway container before the image is rebuilt.

A 524 at the edge did not mean the work stopped. A long transcription returned 524 at the fixed edge timeout while the request stayed parked upstream, holding threads and gigabytes of resident memory on the host that also serves the chat model, so the queue behind it stopped draining and even one-second requests began to fail. The fix was operational: probe the queue before posting, keep one request in flight, size each request to the deadline, and on a 524 stop the batch rather than retry into a queue already holding the first copy.

The evaluation harness was wrong three times. It first scored 7 of 10 and then 5 of 20 before it scored 20 of 20. Every correction changed the harness, not the gateway: classifying a refusal by searching text for “error” missed “is not permitted”; treating only isError as a refusal missed the JSON error payloads this gateway actually returns; and two probes expected tools the principal is not granted. That is written into EVALUATION.md, because a green score from a harness nobody checked is not evidence.

What is not claimed

how claims are graded · back to the homepage