
Tctc Mcp
io.github.kofujimura由 GitHub 帳號 kofujimura 發布v0.3.3更新於 Nov 3, 2026
ERC-7303 token-controlled roles for AI agents: grant, check, and revoke permissions on-chain
概覽
把 ERC-7303 的代幣控制角色提供給 AI 代理,讓代理查詢自身鏈上權限,並由發行方授予或撤銷權限。
- 可以做什麼
- 列出已設定的角色及其控制代幣
- 查詢某帳戶是否持有角色,附上即時餘額證據,並在連線開始時評估全部角色
- 檢視任意 ERC-7303 合約,無需事先設定即可發現其角色結構
- 把 ERC-8004 代理編號解析為擁有者、代理 URI、代理錢包與代幣綁定帳戶
- 透過鑄造控制代幣授予角色(可設定到期時間),並透過銷毀代幣撤銷角色
- 適用情境
- 適合需要代理在執行操作前自行核對鏈上權限的情境,也適合人類主體想用代幣鑄造與銷毀來發放及收回代理能力、而不依賴權限伺服器的情境。
- 執行需求
- 透過 npx 從 npm 套件 tctc-mcp 在本機執行,需提供 JSON 設定檔。唯讀模式只需含 RPC 端點的設定;管理模式另需在環境變數 TCTC_ADMIN_PRIVATE_KEY 中提供發行方金鑰。需要能連線至以太坊 RPC 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Tctc Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
tctc-mcp
An MCP server exposing ERC-7303 (Token-Controlled Token Circulation) roles to AI agents: agents check their own on-chain permissions, and human principals grant/revoke them by minting/burning control tokens — no permission server required.
Status: v0.3.4 — adds timed roles with gasless auto-expiry (below),
on top of v0.2's IERC7303 auto-discovery; published on npm
(tctc-mcp), unit-tested
and verified end-to-end against the Sepolia demo deployment (grant →
check → revoke → check, and grant-for-75s → auto-expiry, through a
real MCP client).
Demo (60 seconds)
[Watch the 60-second demo video]
A human grants an AI agent a minting permission; the agent verifies it on-chain and mints an NFT. The human burns the role token — and the agent instantly loses the capability. Live on Sepolia, no permission server involved.
Quick start
The package is published on npm, so no clone or build is needed — npx
fetches and runs it directly:
Or in a project-scoped .mcp.json:
A fuller registration example is in
examples/claude.mcp.json. The admin private
key is only ever read from the TCTC_ADMIN_PRIVATE_KEY environment
variable; configs containing anything that looks like a private key are
rejected at startup.
Using tctc-mcp from your own app
The only supported entry point is the tctc-mcp bin — spawn it via
npx --no-install tctc-mcp (or node_modules/.bin/tctc-mcp). Never
reference the package's dist/ files directly: they are internal,
their layout is unversioned, and the package's exports field refuses
deep imports. A minimal MCP-SDK client example (the pattern for a web
backend) is in
examples/client-stdio.mjs; the release
pipeline verifies the packed bin end-to-end
(scripts/verify-pack.mjs).
Web application starter
Want to see tctc-mcp protecting a real API route?
tctc-openai-starter
is a standalone Next.js starter that verifies wallet ownership with
Sign-In with Ethereum, checks the configured role through tctc-mcp,
and calls OpenAI only when the on-chain gate grants access.
Use it as a GitHub template.
Token-gating any MCP server: tctc-gate
The reverse direction lives in this repo too:
tctc-gate (npm) is a
transparent stdio proxy that puts an ERC-7303 role check in front of any
existing MCP server, unmodified — deny comes back with a grant URL that
opens the dashboard pre-filled. tctc-mcp lets agents ask about roles;
tctc-gate enforces them at the boundary:
Tools
* registered only when the config has an identity section.
Subjects can be given as a raw address, as an ERC-8004 agentId
(resolved to its ERC-6551 Token Bound Account, the recommended binding
target), or omitted to use the config's self.
IERC7303 auto-discovery (v0.2)
ERC-7303 now defines an introspection interface
(ethereum/ERCs#1872, merged
2026-07-11): compliant contracts expose hasRole, control-token getters,
configuration events, and ERC-165 detection (interfaceId 0x4ee69337).
tctc-mcp uses it two ways:
-
targetroles — a role config names only the target contract; the server reads which control tokens gate the role from the contract itself, and the verdict is the target's ownhasRole()answer: -
discover_roles— introspect any address at run time, with no role configuration at all. Non-compliant contracts reportsupportsIERC7303: false; staticcontrolTokensconfigs remain the fallback for pre-IERC7303 deployments.
Working example: examples/config.sepolia.discovery.json
(secret-free, public RPC), verified live by scripts/e2e-discovery.mjs.
Timed roles: gasless auto-expiry (v0.3)
Delegation to an agent is usually short-term — "mint for one hour",
"act for the duration of this task". With an expiring control token
(ExpiringControlTokens),
balanceOf() returns 0 once the holder's expiry passes, so the role
revokes by itself, with no transaction — even if the principal
forgets, goes offline, or loses keys. The ERC-7303 target contract
needs no changes at all (the Sepolia expiry demo target is a
byte-for-byte copy of TCTCDemoToken).
-
Granting: a role whose grant template has
$expiresAtrequires an expiry —grant_rolewithexpiresInSeconds: 3600is "grant MINTER_ROLE for one hour": -
Checking:
check_roleevidence reportsexpiresAt(unix seconds) when the control token exposes it, so an agent can self-report "this permission expires in 5 minutes". -
Kill switch unchanged: expiry is a fail-safe, not a replacement —
revoke_role(issuer burn) still revokes immediately within the validity window.
Working example: the TIMED_MINTER_ROLE in
examples/config.sepolia.json, verified
live by scripts/e2e-expiry.mjs (grant for 75 s → watch it expire with
no further transaction).
Human dashboard
Live: https://tctc-mcp.vercel.app/ — while tctc-mcp exposes ERC-7303
roles to AI agents, the TCTC Dashboard exposes the same
on-chain state to the humans who manage them: inspect any IERC7303 target,
watch hasRole verdicts and per-control-token balanceOf evidence live,
grant/revoke as the issuer (with timed grants and countdowns for expiring
control tokens), and deploy new control-token collections straight from a
browser wallet. Two clients of one source of truth: the chain. See
dashboard/README.md for details and try-it links.
Not just for AI-agent delegation: any ERC-7303 contract works, so the dashboard doubles as a general-purpose on-chain permission manager — issue certificate collections, grant and revoke roles, and audit who holds what, all from a browser wallet.
Documents
- docs/CONCEPT.md — background and rationale: TCTC as the authorization layer for AI agents, its relationship to ERC-8004 (Trustless Agents) and ERC-6551 (Token Bound Accounts), recommended ERC-7303 spec updates, and the adoption strategy.
- docs/MCP_SERVER_SPEC.md — v1 design specification (architecture, config, tools, security, roadmap).
- docs/ERC_DRAFT_EXPIRABLE_1155.md —
working draft of a planned ERC, "Expirable ERC-1155 Tokens": the
standard behind the timed roles above (per-holder expiry, time-aware
balanceOf,expiresAt/ExpiryUpdated, interface ID0x300e616b). Not yet submitted to ethereum/ERCs; feedback welcome. - docs/TEST_REPORT.md — v1 test report: 24 unit tests and the live Sepolia E2E (on-chain kill-switch cycle through a real MCP client).
- examples/config.sepolia.json —
concrete config for the Sepolia demo deployment (primary roles,
static bindings) and the TCTC repo's
MyComplexTokensample (COMPLEX_*roles, resolved via IERC7303targetdiscovery). - examples/config.sepolia.agent.json — secret-free agent-side config for the same demo deployment (public RPC, no API keys); the one used in the Quick start above.
- examples/config.sepolia.discovery.json — IERC7303 auto-discovery variant: no control tokens configured, the target contract explains its own role structure.
- examples/contracts/ — sources of the demo
contracts deployed on Sepolia (
AgentControlTokens,TCTCDemoToken,ERC7303,IERC7303).
Demo deployment (Sepolia, Etherscan-verified)
AgentControlTokens(soulbound, issuer-burnable ERC-1155):0x12342A7F0190B3AF3F4b47546D34006EDA54eE0BTCTCDemoToken(ERC-721 + ERC-7303 target, implements theIERC7303introspection interface —hasRole, control-token getters, ERC-165 detectable via interfaceId0x4ee69337):0x4C0a78803D47154B9C6F42EC4AEbab2D1C94c97DExpiringControlTokens(soulbound, issuer-burnable ERC-1155 with per-holder expiry; time-awarebalanceOf— the basis of timed roles):0xb5abB6c060ed287e8B25aD121c8B46eE404fF09b- Expiry demo target (unmodified
TCTCDemoTokenbytecode bound to the expiring control tokens):0x3eAb11DE9655817A2e2977A486d9D33eBD10c9Ce
Development
Related
- Human dashboard (this repo,
dashboard/): https://tctc-mcp.vercel.app/ - npm package: https://www.npmjs.com/package/tctc-mcp
tctc-gate— token-gate any existing MCP server, no modification: https://www.npmjs.com/package/tctc-gatetctc-openai-starter— Next.js starter for token-gated OpenAI access.- Agent skill (teaches agents to use TCTC safely; install with
npx skills add kofujimura/tctc-skills): https://github.com/kofujimura/tctc-skills - TCTC reference implementation: https://github.com/kofujimura/TCTC
來源:README.md,提交 47baaf8
工具
0版本歷史
1- v0.3.3最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。