Smartpolicy

io.github.smartpolicy-protocol由 GitHub 帳號 smartpolicy-protocol 發布v0.2.0更新於 Oct 25, 2026

Runtime authorization for AI agents and smart contracts via an immutable on-chain policy registry

已驗證STDIO僅桌面安全與監控AI 與機器學習

概覽

AI 產生的概覽

一個 MCP 伺服器,讓 AI 代理向鏈上策略登錄表查詢某動作是否被允許,並取得短期簽章授權。

可以做什麼
查詢鏈上策略登錄表,判斷某個代理、使用者或合約在指定策略下能否執行某動作,並取得可供合約或後端驗證的短期簽章授權(EIP-712)。在設定了簽發者金鑰時可選擇簽發授權。使用內嵌位元組碼將登錄表與驗證器合約部署到鏈上。可改用自訂的登錄表、驗證器或 EVM RPC 端點,而非預設的公共 Sepolia。
適用情境
適用於建置需要從可更新的共享策略登錄表取得執行期授權決策的 AI 代理或智慧合約,並希望助理在工作流程中檢查權限或取得可驗證授權。專案處於早期且未經稽核,適合實驗與測試網路,而非正式環境的信任基礎。
執行需求
以 npm 套件形式透過 stdio 在本機執行(需要 Node.js)。預設連線公共 Ethereum Sepolia;可透過環境變數覆寫登錄表位址、驗證器位址與 EVM RPC 端點。簽發授權需要選用的簽發者私鑰環境變數。
安裝前請注意
選用的 SMARTPOLICY_ISSUER_KEY 是啟用授權簽發的私鑰,持有者即可簽署授權,應避免放入共用環境。部署合約與寫入策略是會產生費用的鏈上交易,託管 API 被描述為依呼叫計費。專案聲明未經稽核,成熟前僅供內部使用。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

SmartPolicy

Runtime authorization for AI agents and smart contracts.

Define what an agent, a user, or a contract is allowed to do — once, as a policy. Enforce it everywhere: on-chain via a minimal verifier, off-chain via an MCP server and REST API that AI systems consume directly. Update the rules without redeploying anything.

Status (2026-06-12): core contracts live on Ethereum Sepolia (Etherscan-verified, addresses in contracts/deployments/sepolia.json); 54 Foundry tests green; MCP server v0 packaged — npx smartpolicy-mcp runs zero-config against Sepolia, npx smartpolicy-mcp deploy bootstraps any chain from embedded bytecode; AI-consumability proven by unaided fresh-agent execution tests (incl. cold start on an empty chain). NOT audited; internal until mature — no public repo or registry listings yet. Current state, decisions, and how to resume work: PLAN.md.

Why

Every team shipping AI agents hits the same wall: the agent can technically do anything its keys allow, and the only ways to constrain it are hardcoded prompts or redeployed code. Every smart contract team hits the mirror image: access rules baked into the contract at deploy time.

SmartPolicy separates the rule from the enforcement point:

  • A policy lives in the on-chain Registry: members, admins, conditions, expiry, and mutability flags. It is data, not code. Changing a rule is a transaction, not a redeploy.
  • Enforcement happens wherever the action happens:
    • A smart contract inherits one modifier and checks the Registry (free view call).
    • An AI agent (or the service in front of it) asks the MCP server / REST API: "may 0xAgent perform action under policy N?" and receives a short-lived signed grant (EIP-712) that any contract or backend can verify.

What this is NOT

  • Not a token. There is no protocol token, no ICO, no governance theater. Revenue is fees: a small fee on on-chain policy writes, and metered (x402) pay-per-call on the hosted API. Reads and verification are free.
  • Not upgradeable. The core Registry is immutable once deployed. Trust comes from code you can read, not admin keys you have to trust. New protocol versions are new deployments.
  • Not an oracle. SmartPolicy answers "is this allowed?", not "what happened in the world?". Condition values that depend on external facts are attested via signed grants from sources the policy owner chooses.

Architecture (short version)

┌─────────────┐   MCP / REST (x402 metered)   ┌──────────────────┐│  AI agents   │ ────────────────────────────▶ │ SmartPolicy MCP  ││  & services  │ ◀──── signed grants ────────  │ server (TS)      │└─────────────┘                                └────────┬─────────┘                                                        │ reads + grant issuance┌─────────────┐   inherit Gate modifier        ┌────────▼─────────┐│  Protected   │ ────── view calls ──────────▶ │ PolicyRegistry   ││  contracts   │                               │ (Base, immutable)│└─────────────┘                                └──────────────────┘

See ARCHITECTURE.md for the full design and the rationale for every decision (chain, fees, trust model, what was deliberately dropped from v1).

Repository layout

contracts/   Solidity core: PolicyRegistry, PolicyGate, interfaces (Foundry)mcp/         MCP server + REST API (TypeScript, x402 metering)sdk/         TypeScript client SDK (@smartpolicy/sdk) — reads, grants, tx-buildingdocs/        Integration guides (planned)

Lineage

SmartPolicy is a clean rewrite of the strongest ideas from a 2025 prototype ("Smart Policy Protocol", Sepolia): the policy registry, the tiered integration model, and hybrid on-chain + signed-token enforcement. The rewrite deliberately drops the SPOL token/ICO/governance suite, the sports-prediction oracle, the factory contracts, and the upgradeable-proxy trust model, and fixes the known security issues (tx.origin checks, missing reentrancy guards, header-only API auth).

License

Apache-2.0 — see LICENSE.

來源:README.md,提交 534f4e3

工具

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

版本歷史

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

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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