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 分