npm @smartpolicy/mcpstdioApache-2.0updated 1mo ago
Runtime authorization for AI agents and smart contracts.
Was kannst du mit smartpolicy machen?
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-mcpruns zero-config against Sepolia,npx smartpolicy-mcp deploybootstraps 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
0xAgentperformactionunder policyN?" 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-building
docs/ 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.
Installation
smartpolicy zu deinem Client hinzufΓΌgen. WΓ€hl den, den du nutzt.
claude mcp add mcp -- npx -y @smartpolicy/mcpcodex mcp add mcp -- npx -y @smartpolicy/mcpamp mcp add mcp -- npx -y @smartpolicy/mcp{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@smartpolicy/mcp"
]
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@smartpolicy/mcp"
]
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
code --add-mcp '{"name":"mcp","command":"npx","args":["-y","@smartpolicy/mcp"]}'Or add the block manually to `.vscode/mcp.json` under `servers`.
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@smartpolicy/mcp"
]
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@smartpolicy/mcp"
]
}
}
}Add to `cline_mcp_settings.json` via the MCP Servers panel.
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@smartpolicy/mcp"
]
}
}
}Add to `~/.gemini/settings.json`.
{
"mcpServers": {
"mcp": {
"type": "local",
"command": "npx",
"args": [
"-y",
"@smartpolicy/mcp"
],
"tools": [
"*"
]
}
}
}Add to `~/.copilot/mcp-config.json`, or run `/mcp add` inside the CLI.
{
"context_servers": {
"mcp": {
"command": {
"path": "npx",
"args": [
"-y",
"@smartpolicy/mcp"
]
}
}
}
}Add to your Zed `settings.json`.
npx -y @smartpolicy/mcpRun `goose configure`, choose **Add Extension β Command-line Extension**, and paste this command.
Score
39 / 100
UnvollstΓ€ndig
- Dokumentation25/25
- Pflege16/25
- Vertrauen16/20
- Funktionsumfang0/15
- Installation12/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 51 days ago
- Has a release history
- Repository is not archived
- Licensed Apache-2.0
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 0 tool(s) documented
- Provides prompt templates
- Provides resources
- 12 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint β no local install
Versionsverlauf
| Versionen | VerΓΆffentlicht |
|---|---|
| 0.2.0Aktuell | 6. Juli 2026 |
| 0.1.1 | 5. Juli 2026 |