Shield

io.github.bolyra由 GitHub 帳號 bolyra 發布v0.1.0更新於 Oct 24, 2026

Stdio MCP auth proxy: wrap any MCP server with per-tool permission enforcement.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

一個本機 stdio 代理,可包裝任意 MCP 伺服器,對工具呼叫實施逐工具權限控管、重放防護與稽核回執。

可以做什麼
將目標 MCP 伺服器以子程序啟動,在轉送前攔截其工具呼叫,無須修改伺服器程式碼。驗證代理憑證,並依權限原則檢查每次工具呼叫,拒絕不符規定的呼叫。支援預設拒絕模式,未設定原則的工具一律被拒絕。學習模式可依伺服器自身的工具清單產生初始 shield.yaml,預設拒絕並採最小權限。將稽核回執輸出至 stderr,並以 nonce 儲存拒絕重放的證明。也可作為函式庫嵌入程式碼使用。
適用情境
當你執行本機 stdio MCP 伺服器(例如在 Claude Desktop 或 Cursor 中),希望限制代理可呼叫的工具、依工具要求憑證,或保留工具呼叫稽核紀錄而不修改伺服器時使用。
執行需求
透過 npm 套件在本機以 stdio 執行,通常以 npx 啟動,需要 Node.js。需要一個要包裝的目標伺服器指令與 shield.yaml 設定檔,學習模式可產生該檔案。未宣告環境變數或請求標頭。
安裝前請注意
它位於代理與被包裝伺服器之間並決定哪些工具呼叫被允許,原則設定錯誤可能攔截需要的工具,或放行本應限制的工具;未設定原則的工具預設放行,除非啟用 defaultDeny。學習模式只賦予 READ_DATA 權限,正式使用前應審查並提高權限。權限位包含財務與代簽類別,對涉及花錢或代為操作的工具有必要仔細核對原則。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

@bolyra/shield

Stdio MCP auth proxy. Wrap any MCP server with per-tool permission enforcement, replay protection, and audit receipts. No code changes to the server.

Quick Start

bash
npx @bolyra/shield --server "npx @modelcontextprotocol/server-filesystem /tmp" --dev

Shield spawns the target server as a child process, intercepts tools/call requests, verifies agent credentials, and enforces tool policies before forwarding.

Config

Create shield.yaml:

yaml
devMode: truedefaultDeny: true
nonce:  store: memory  maxProofAge: 300
receipts:  enabled: true  output: stderr
tools:  read_file:    requireBitmask: 1    # READ_DATA  write_file:    requireBitmask: 2    # WRITE_DATA  delete_file:    requireBitmask: 2    # WRITE_DATA

Then:

bash
npx @bolyra/shield --server "node my-server.js" --config shield.yaml

Default Deny

By default, tools without a policy entry are allowed through (only authentication is checked). Set defaultDeny: true to reject any tools/call for tool names not listed in the tools: map.

Learn Mode

Don't write the config by hand — generate a safe starting point from the server's own tool list:

bash
npx @bolyra/shield --learn --server "node my-server.js"

Learn mode spawns the server, performs the MCP handshake (initialize → notifications/initialized → tools/list, following pagination), then writes shield.yaml (or the --config path) with:

  • defaultDeny: true — anything the server adds later is rejected until you allow it
  • every discovered tool at requireBitmask: 1 (READ_DATA) — the least-privilege floor
  • a _generated provenance block (source command + timestamp)

It never overwrites an existing config file, caps pagination at 50 pages, and times out after 30 seconds. The output is a starting point: review each tool and raise its requireBitmask (e.g. write_file → 2) before production use.

How It Works

Agent ←stdin/stdout→ Shield ←stdin/stdout→ MCP Server                       │                 verifyBundle()                 checkToolPolicy()                 nonceStore.markIfFresh()                 emitReceipt()
  • initialize, tools/list, ping — forwarded without auth
  • tools/call — proof extracted from params._meta.bolyra, verified, policy checked, then forwarded or rejected
  • Receipts emitted to stderr (stdout is the MCP transport)

Permission Bitmask

BitPermission
0READ_DATA
1WRITE_DATA
2FINANCIAL_SMALL
3FINANCIAL_MEDIUM
4FINANCIAL_UNLIMITED
5SIGN_ON_BEHALF
6SUB_DELEGATE
7ACCESS_PII

Shield vs Gateway

ShieldGateway
TransportstdioHTTP
Use caseLocal MCP servers (Claude Desktop, Cursor)Remote/networked MCP servers
How it wrapsSpawns child processReverse proxy
Proof sourceparams._meta.bolyraAuthorization: Bolyra <base64> header
Receiptsstderrstdout/file/webhook

Both use the same verifyBundle() and checkToolPolicy() from @bolyra/mcp.

Library Usage

typescript
import { createShield, loadShieldConfig } from '@bolyra/shield';
const config = loadShieldConfig('./shield.yaml');const { child, stop } = createShield(config);

Links

來源:integrations/shield/README.md,提交 5e9de85

工具

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

版本歷史

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

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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