Mcpolyglot

io.github.ishay60v0.4.3更新於 Oct 4, 2026

Policy-checked, audited agent access to Postgres, MySQL, SQLite, MongoDB and OpenAPI REST APIs.

概覽

AI 產生的概覽

讓助理在政策檢查與稽核下存取 Postgres、MySQL、SQLite、MongoDB 與 OpenAPI REST 資料來源。

功能
Mcpolyglot 是一個本機命令列工具,可產生設定檔、驗證連線、列出工具,並以 stdio 或 Streamable HTTP 方式提供 MCP 伺服器。它會暴露用來查詢與讀取所設定資料庫與 REST API 的工具,並透過每個來源的政策限制資料表、存取層級與上限。在 HTTP 模式下支援多個代理,每個代理有自己的權杖、作用範圍與收窄後的政策,並依權杖記錄稽核用的 agentId。
適用情境
當助理需要在明確的存取規則下查詢你自己的資料庫或 REST API,並希望依代理劃分範圍、保留稽核紀錄時使用。也適合多個代理需要看到同一批來源不同子集的情境。
執行需求
需要 Node.js,透過 npx 執行 npm 套件 @mcpolyglot/cli。需要設定檔(mcpolyglot.config.ts),其中包含各來源的連線資訊與密鑰。HTTP 模式需要以 token 指令建立的 bearer 權杖;agents 需要 bearer 驗證而非 OAuth,在 stdio 下會被忽略。
安裝前請注意
此伺服器會連線到實際的資料庫與 REST API,設定的憑證與密鑰會在執行時解析。政策可以授予寫入權限;每個代理的政策只能收窄來源的政策,未列出的資料表會落到 defaultAccess,因此寫入權限必須明確重新列出。權杖僅以 sha256 雜湊儲存且只列印一次;未知或已撤銷的權杖會回傳 401。沒有熱重載,變更後需要重新啟動。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

@mcpolyglot/cli

The mcpolyglot command-line interface. Scaffolds a config, validates connectivity, lists tools, and serves the MCP server over stdio or Streamable HTTP.

bash
npx @mcpolyglot/cli init       # interactive wizardnpx @mcpolyglot/cli doctor     # validate config, ping sources, list toolsnpx @mcpolyglot/cli tools      # list tools mcpolyglot would exposenpx @mcpolyglot/cli serve      # start the MCP server (stdio)npx @mcpolyglot/cli serve --http --port 7337   # start over Streamable HTTP

Commands

CommandPurpose
initInteractively scaffold an mcpolyglot.config.ts in the current directory.
doctorLoad + validate config, resolve secrets, ping each source, list tools.
toolsPrint every tool mcpolyglot would expose for the current config.
serveStart the server. --http flips to Streamable HTTP with bearer auth.
tokentoken create <agentId> mints a per-agent token; token hash hashes one.

serve --http prints the bearer token, MCP URL, and /healthz URL on stderr. Pin the token in your config (transport.auth.token) for stable deployments; omit it to mint a fresh token on each start.

Multiple agents over HTTP

Give each agent its own token, sources and scopes. Tokens are stored only as sha256 hashes:

bash
mcpolyglot token create analyst       # prints the token once, its hash, and a config snippetecho -n "$TOKEN" | mcpolyglot token hash
ts
agents: [  {    id: 'analyst',    tokens: [{ hash: '<sha256 hex>', label: '2026-09' }],    scopes: ['schema:read', 'tables:read', 'query:raw'],    sources: { 'pg.main': { policy: { tables: { users: 'none' } } } },  },],
  • An agent sees only tools of the sources listed under it, and only tools its scopes fully cover. scopes defaults to, and is capped at, the union of those sources' scopes.
  • A per-agent policy can only narrow the source's policy: per table the most restrictive access wins, deny lists are combined, and caps take the smaller value. An agent can't re-open a table the source hides or gain writes the source doesn't grant. The reverse also holds: a table the agent's policy doesn't list falls to its defaultAccess (at most read), so an agent that should keep a source's write access must list that table as write again. It gets its own connector, so its own DB connection; sources listed without a policy share the main one.
  • The token decides the audit agentId; the x-mcpolyglot-agent header is ignored when agents is set. Unknown or revoked tokens get 401.
  • Rotate: add the new hash, move the client over, set revoked: true on the old one (or delete it), restart serve. There is no hot reload.
  • agents needs bearer auth (not OAuth) and is ignored under stdio (single local user). doctor lists what each agent can and can't use.

Stdio servers must keep stdout clean, so all CLI output goes to stderr.

Docs

MIT licensed.

來源:packages/cli/README.md,提交 0835998

工具

0
工具後設資料尚未被收錄。

版本歷史

1
  1. v0.4.3最新Oct 4, 2026