Trentina

io.github.crunchtoolsPublished by GitHub account crunchtoolsv0.5.0Updated Nov 10, 2026

Secure MCP gateway and quarantine for AI agent traffic — three-layer prompt injection defense

Overview

AI-generated overview

A local MCP gateway that sits between AI agents and their backends, screening traffic for prompt injection and enforcing operator policy.

What you can do
  • Route agent calls to multiple MCP backends through one endpoint per profile, with tool allowlists, denylists and pinning
  • Screen untrusted content at ingress with layered checks, a local classifier and a quarantined LLM, plus literal and semantic request and response guards
  • Fetch, read, list and search web content through built-in content tools with egress guarding and file confinement
  • Compress tool descriptions and schemas and minify responses to cut token use
  • Authenticate web clients via OAuth or static bearer tokens, and keep LLM provider keys inside the gateway
  • Record calls in an audit log and let an operator agent propose grants for a person to approve
When to use it
Use it when an assistant connects to untrusted MCP servers, web content or messaging channels and you want injection defense, tool filtering and an audit trail in front of them. It also suits setups that need per-agent profiles with separate backends and credentials.
Requirements
Runs as a container image (podman) with a profiles YAML mounted and environment variables for the gateway, profile path and per-profile bearer tokens. L3 defense needs an API key for one LLM provider (Gemini, OpenRouter, OpenAI, Anthropic or Ollama). Clients connect over streamable HTTP with an Authorization bearer header.
Before you install
It handles credentials: per-profile bearer tokens, LLM provider API keys and OAuth grants for backends, so protect the config and environment. It can write, send and push on the agent's behalf depending on the backends and grants you allow, and it re-originates outbound requests and git pushes to listed destinations. Approve operator-proposed grants deliberately.

Installation

In SourceWeft

  1. Open Trentina in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

[trentina: a medieval merchant ship anchored offshore while an inspector in a rowboat checks each crate of code before it reaches the harbor gate]

Trentina

Trentina sits between your AI agents and everything they touch: MCP servers, the web, Matrix, LLM providers and alerts. It stops prompt injection at every ingress — or at a trusted boundary you declare — shrinks what reaches the context window, and enforces a policy the agent cannot talk its way past. It is named after the 1377 trentino of Ragusa, where ships anchored offshore for thirty days before anyone came ashore: commerce keeps flowing, and nothing dangerous gets in.

[Demo: a request crosses Trentina's auth, policy, defense and minify stages; then, in a terminal, a 135-tool list is served as 6 tools, a recipe page with an injection in its comments is refused and then answered through redact, and a send to an outside address is refused while a draft goes through]

Why Trentina

  1. Security. Untrusted content crosses three independent layers at every ingress to the trust boundary, which can be federated with other instances: L1 deterministic checks, L2 a local classifier, L3 a quarantined LLM with no tools. Semantic request guards judge what goes out against a rule you write in English. What is and is not defended is in Coverage. Defense Pipeline · Benchmark · OWASP mapping

  2. Token savings. Hidden tools, short names, compacted schemas, compressed descriptions and minified responses: 52% fewer response bytes on production traffic. Compression · Tool Filtering

  3. Determinism. Literal request guards, literal response guards and allowlists are evaluated by the gateway, so an agent that ignores its instructions is stopped before the backend sees the call. Literal Request Guards · Literal Response Guards

  4. Authentication. Trentina is the OAuth authorization server for web clients such as claude.ai: dynamic client registration, a provisioned client, external issuers or a static bearer, chosen per profile. Authentication

  5. Architectural flexibility. A personal assistant, a coding agent and a swarm each get their own profile, with their own backends, defense mode and credentials — and an operator agent configures all of it through tools, with no shell; the five grants only a person should agree to, it proposes and you approve. Profiles · Operator · Approvals

Quick Start

bash
# The container image is the distribution: the L2 model, the parsers and# their process isolation ship in it. There is no PyPI package.podman run -d -p 127.0.0.1:8019:8019 \    -v ./profiles.yaml:/config/profiles.yaml:ro,Z \    -e TRENTINA_GATEWAY_ENABLED=true \    -e TRENTINA_PROFILES_PATH=/config/profiles.yaml \    -e TRENTINA_PROFILE_MYAGENT_TOKEN=your-token \    -e OPENROUTER_API_KEY=your-key -e TRENTINA_MODEL_PROVIDER=openrouter \    quay.io/crunchtools/trentina \    --transport streamable-http --host 0.0.0.0 --port 8019

L3 needs a key for one LLM provider. Any of Gemini, OpenRouter, OpenAI, Anthropic or Ollama works. A minimal profiles.yaml:

yaml
profiles:  myagent:    auth:      bearer_token_env: TRENTINA_PROFILE_MYAGENT_TOKEN    backends:      web:        url: "internal://web"         # Trentina's own content tools        tools_allow: ["*"]      gmail:        url: "http://gws-personal:8000/mcp"        tools_allow:                  # it may read and draft; you send          - search_gmail_messages          - get_gmail_message_content          - draft_gmail_message    defense:      enforcement: block

Then point Claude Code at it:

json
{  "mcpServers": {    "trentina": {      "type": "streamable-http",      "url": "http://localhost:8019/gateway/myagent/mcp",      "headers": { "Authorization": "Bearer your-token" }    }  }}

Documentation

DocumentDescription
MCP GatewayOne endpoint per profile: routing, tool names, circuit breakers
Per-Agent ProfilesProfile schema, modes, minifying, roles, multi-agent setup
Operator ProfileThe agent that installs and runs the gateway
ConfigurationEvery environment variable
AuthenticationStatic bearer, OAuth proxy with DCR or a provisioned client, delegated issuers
Backend OAuthEach profile signs in to OAuth-only backends with its own grant
Defense PipelineL1/L2/L3, modes, coverage and known gaps
BenchmarkDetection rates per layer and per L3 provider
CorporaEvery attack and benign set the defense is measured on
Prompt PacksThe judge's prompts tuned per model
Content Toolsfetch, read, dir, content, search, with an egress guard and file confinement
BlocklistA refused source stays refused
Tool FilteringAllowlists, denylists, glob patterns
Tool PinningA new or changed tool is held until approved
Tool DiscoveryFind/call or per-session loading for clients without tool search
Description CompressionDescription compression and schema compaction
Token RoutingResponse minifying (implemented); delegation (proposed)
Semantic Request GuardsA judge reads calls to listed tools against a policy in plain English
Semantic Response GuardsA judge reads listed tools' responses against a policy before delivery
Literal Request GuardsPer-tool argument validation
Literal Response GuardsPer-tool result validation
Audit LogCall recording, stats, monitoring
LLM Key ProxyingProvider keys kept inside the gateway
Matrix BridgeE2EE termination and two-way judging
Channel BridgesMore than one upstream per agent (RCS, ...) and the bridge wire contract
Matrix Reverse ProxyMatrix for agents on an isolated network
Client EgressA CONNECT tunnel to listed hosts for the agent's own client
Git TransportClone, fetch and push to listed repositories and branches
Stdio BackendsFront a stdio-only MCP server the host runs behind a socket
Stability tiersWhich features may change shape in a minor release, and how you are told
ApprovalsThe six grants an operator proposes and a person agrees to
FederationShare a profile with a second gateway: its tools mounted over a trusted link, scanned once
HTTP(S) EgressAn agent's outbound request judged and re-originated to a named destination
Deployment HardeningContainer flags, secrets, egress, the startup check
ProxiesEvery perimeter route as config under proxies:, the forward type, and route plugins
PluginsWrite, test, install and name your own transform plugins
Cockpit PluginLive defense pipeline dashboard
Internal: Gateway DesignOriginal design document, for contributors

Development

bash
pre-commit install          # wires the commit and push checks

CONTRIBUTING.md is the page for a person: the three commands, what each costs, and what an exit code means. The host needs only git, podman, pre-commit and gh — every check runs from python-sdlc, the same image CI runs. The demo is recorded by demo.yml; its fixtures are in docs/demo/.

License

AGPL-3.0-or-later

Source: README.md at commit 8aa0b36

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.5.0LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts