mcpField
T
Trentina

Trentina

Local
github.com/crunchtoolsSecurity11Updated today

About Trentina

Trentina is a security gateway between AI agents and their MCP servers, web access, messaging, and LLM providers. It applies layered prompt-injection defenses, policy checks, and per-agent profiles while reducing tool and response context.

Key features

  1. 01Three-layer prompt-injection checks
  2. 02Policy-based checks on outgoing calls
  3. 03Tool filtering and schema compression
  4. 04Per-agent profiles and credentials
  5. 05OAuth authorization for web clients
  6. 06Auditing and defense monitoring

Use cases

  1. 01Inspect untrusted content entering an agent
  2. 02Restrict tools and validate their arguments and results
  3. 03Give different agents separate backends and credentials
  4. 04Connect web clients through OAuth authorization

MCP support

Provides a gateway endpoint per profile for MCP clients, routing requests to configured backends and applying tool policies and defenses. It can also expose Trentina's own content tools.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"crunchtools-trentina": {
"command": "uvx",
"args": [
"mcp-trentina-crunchtools"
]
}
}
}
Run commanduvx mcp-trentina-crunchtools

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypimcp-trentina-crunchtools0.5.0

Tools

13

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
urlstringYesURL to fetch (http:// or https://)

Details

From the project 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, 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: L1 deterministic checks, L2 a local classifier, L3 a quarantined LLM with no tools. Guarded execution judges 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. Parameter guards, response guards and allowlists are evaluated by the gateway, so an agent that ignores its instructions is stopped before the backend sees the call. Parameter Guards · 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. Profiles · Operator

Quick Start

# 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:

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:

{
  "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)
Guarded ExecutionA judge reads calls to listed tools against a policy in plain English
Parameter GuardsPer-tool argument validation
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
HTTP(S) EgressAn agent's outbound request judged and re-originated to a named destination
Deployment HardeningContainer flags, secrets, egress, the startup check
Cockpit PluginLive defense pipeline dashboard
Internal: Gateway DesignOriginal design document, for contributors

Development

uv sync --all-extras
uv run ruff check src tests
uv run mypy src
uv run pytest -v

The container image is built by CI, never locally; see CLAUDE.md. The demo is recorded by demo.yml; its fixtures are in docs/demo/.

License

AGPL-3.0-or-later

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.