Trentina

io.github.crunchtools由 GitHub 帳號 crunchtools 發布v0.5.0更新於 Nov 10, 2026

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

概覽

AI 產生的概覽

本機 MCP 閘道,位於 AI 代理與其後端之間,對流量做提示注入防護並執行維運方策略。

可以做什麼
  • 依設定檔將代理呼叫路由到多個 MCP 後端,支援工具白名單、黑名單與工具固定
  • 在入口以多層檢查、本機分類器與無工具的隔離 LLM 篩檢不可信內容,並提供字面與語意的請求及回應守衛
  • 透過內建內容工具抓取、讀取、列目錄與搜尋網頁內容,具備對外連線守衛與檔案限制
  • 壓縮工具描述與 schema、精簡回應以降低 token 用量
  • 為網頁用戶端提供 OAuth 或靜態 bearer 驗證,並把 LLM 供應商金鑰留在閘道內
  • 記錄呼叫稽核日誌,並允許維運代理提出授權請求由人員核准
適用情境
當助理要連接不可信的 MCP 伺服器、網頁內容或訊息頻道,而你需要在其前面加上注入防護、工具過濾與稽核時使用。也適合需要為不同代理設定獨立後端與憑證的情境。
執行需求
以容器映像(podman)執行,需掛載 profiles YAML,並設定閘道、設定檔路徑及各設定檔 bearer 權杖等環境變數。L3 防護需要一個 LLM 供應商的 API 金鑰(Gemini、OpenRouter、OpenAI、Anthropic 或 Ollama)。用戶端透過 streamable HTTP 並攜帶 Authorization bearer 標頭連線。
安裝前請注意
它會接觸憑證:各設定檔的 bearer 權杖、LLM 供應商 API 金鑰以及後端的 OAuth 授權,需妥善保護設定與環境變數。依你允許的後端與授權,它可代代理寫入、傳送與推送,並會把對外請求與 git 推送重新發往列出的目標。對維運代理提出的授權應謹慎核准。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Trentina,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

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

來源:README.md,提交 8aa0b36

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.5.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分