Grantd

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

Grantd MCP server: let your AI agent act on a user's behalf across third-party APIs via OAuth.

已驗證STDIO僅桌面開發者工具

概覽

AI 產生的概覽

Grantd 的 MCP 伺服器,讓 AI 代理透過 OAuth 授權,以使用者身分安全呼叫 Gmail、GitHub 等第三方 API。

可以做什麼
列出 broker 支援的第三方供應商。檢查某位終端使用者是否已連結供應商。產生 OAuth 連結,讓使用者完成授權。以使用者身分代理呼叫供應商 API,並在未連結時回傳需授權的結果。
適用情境
當你希望 AI 代理以使用者身分呼叫 Gmail、GitHub 等第三方 API,而不讓存取權杖進入模型或對話時使用。適合自行架設 Grantd broker 並需要 OAuth 授權流程的開發者。
執行需求
需在本機以 Node.js 執行 npm 套件 grantd-mcp,並連線到一個自行架設、正在運作的 Grantd broker。需設定 GRANTD_API_KEY(sk_ 開頭的密鑰)、GRANTD_BASE_URL(broker 位址,預設為本機 8787 埠),可選填 GRANTD_END_USER 作為預設使用者。
安裝前請注意
需要 GRANTD_API_KEY 密鑰,應視同密碼保管。伺服器會代為呼叫第三方 API,可能讀取或變更使用者資料,並涉及 OAuth 授權範圍。broker 自行架設,金鑰保管、TLS 與防護需自行負責;Slack 與 Notion 供應商尚未驗證。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

Grantd

OAuth-for-agents: a dead-simple, MCP-native OAuth token broker that lets AI agents securely act on a user's behalf across third-party APIs (Gmail, Slack, GitHub, Notion…). Tokens are vaulted server-side and never touch the LLM.

Stack: TypeScript · Hono · Postgres · generic OAuth2 driven by a declarative provider registry · envelope encryption (AES-256-GCM, key-versioned) · Postgres advisory locks for refresh concurrency (no Redis). Security model and how to report issues: SECURITY.md.

Security at a glance

Grantd vaults users' OAuth tokens, so security is the product, not a feature. The fundamentals:

  • Tokens encrypted at rest — AES-256-GCM envelope encryption, fresh IV per record, key-versioned, and fail-closed (a missing key refuses to write; it never silently stores plaintext).
  • Tokens never reach the LLM or the caller. The proxy injects the access token at the network boundary and returns only the provider's response — the raw token is never serialized back.
  • API keys hashed at rest (pbkdf2-sha256, peppered); the raw sk_ key is shown once.
  • No SQL injection — every query is a parameterized postgres.js tagged template.
  • Tenant isolation on every query by environment id; Row-Level Security enabled on all tables so a Postgres REST layer (e.g. Supabase/PostgREST) can't read the vault.
  • 256-bit random OAuth state + session tokens; PKCE (S256) where the provider supports it.
  • Durable, Postgres-backed rate limiting — per secret key on auth routes, per IP on public routes.

This is open-source infrastructure you run yourself. Self-hosting responsibilities (key custody, TLS, an edge/WAF for volumetric DoS) and known limitations are documented honestly in SECURITY.md. If you intend to run a hosted, multi-tenant deployment that holds other people's tokens, work through HOSTED-CHECKLIST.md first.

Providers

ProviderStatus
Google (Gmail, Calendar, …)✅ Verified end-to-end, including token refresh
GitHub✅ Verified end-to-end
Slack🧪 Experimental — config present, not yet verified against live OAuth
Notion🧪 Experimental — config present, not yet verified against live OAuth

Adding a provider is data, not code (see src/providers.ts). Help verifying Slack/Notion is welcome.

Quick start (dev)

bash
npm installnpm run keygen            # prints an ENCRYPTION_KEYRING + API_KEY_SALTcp .env.example .env      # then paste keygen output + your DATABASE_URLnpm run migrate           # apply SQL migrationsnpm run dev               # start the broker on :8787

MCP server

Exposes the broker to an AI agent (Claude Code / Cursor / Claude Desktop) as tools: list_providers, check_connection, create_connect_link, and call_provider. The auth-gating wedge: if the agent calls call_provider for a user who isn't connected, it returns an authorization_required result with a connect link instead of failing.

The MCP server is published to npm as grantd-mcp, so you don't need to clone this repo to use it — just point an MCP client at it (you do need a running broker and a secret key). For local development: npm run mcp (needs the broker running); smoke test: npm run mcp:test.

Add to Claude Code:

bash
claude mcp add grantd \  --env GRANTD_API_KEY=sk_... \  --env GRANTD_BASE_URL=https://your-broker.example.com \  --env GRANTD_END_USER=user-123 \  -- npx -y grantd-mcp

Or in a Cursor / Claude Desktop mcpServers config:

json
{  "mcpServers": {    "grantd": {      "command": "npx",      "args": ["-y", "grantd-mcp"],      "env": {        "GRANTD_API_KEY": "sk_...",        "GRANTD_BASE_URL": "https://your-broker.example.com",        "GRANTD_END_USER": "user-123"      }    }  }}

Layout

migrations/   SQL schema (Supabase/Postgres compatible)scripts/      keygen + migrate helperssrc/  config.ts   env loading + validation + keyring parse  crypto.ts   envelope encryption + API-key hashing  db.ts       postgres.js client  providers.ts declarative provider registry (Google, GitHub, Slack, Notion)  oauth.ts    generic OAuth2 client (authorize / exchange / refresh) driven by the registry  server.ts   Hono app + routes (WIP)

來源:README.md,提交 948813e

工具

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

版本歷史

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

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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