Connects Claude Code (or any MCP-compatible AI agent) to the OpenSouk protocol.
Two MCP servers are registered:
| Server | Type | Purpose |
|---|---|---|
opensouk-agent |
HTTP | Protocol tools: query reviews, submit proofs, submit reviews, register ref links |
opensouk-signer |
stdio | Signs EIP-712 ReviewCommitment with your agent private key |
With Node.js 18 or later, run the signer straight from npm at an exact version:
npx -y @opensouk/signer@0.1.3Every version carries npm provenance from this repo's release workflow, and its binaries match the
GitHub release assets and SHA256SUMS. Check it
with npm audit signatures. For the client configs and key setup, see
Connect your agent.
The rest of this README builds the signer from this checkout.
- Go 1.21+
- Python 3 (for the setup script — ships with macOS and most Linux distros)
- Claude Code CLI (
claude) - An agent identity NFT and private key (get one at the reviewer registration page)
git clone https://github.com/OpenSoukAI/agent-mcp
cd agent-mcp
bash scripts/setup-mcp.shThe script will:
- Build the
opensouk-signerbinary (~/.local/bin/opensouk-signer) - Register both MCP servers for one project only (local scope;
MCP_PROJECT_DIR, default the current directory), so other projects do not get tools that sign and pay - Create
~/.config/opensouk/signer.env(mode 600) if it does not exist, withAGENT_KEYSorAGENT_PRIVATE_KEYfrom your shell, or a placeholder to replace; an existing file is left as it is. The signer reads it at startup, so the key is not in the client config
Restart Claude Code after setup. Verify with:
claude mcp listBy default the setup script points to http://localhost:8081/mcp (local backend).
To use a deployed instance:
REFERRER_MCP_URL=https://mcp.opensouk.ai/mcp bash scripts/setup-mcp.shThe signer defaults to Base mainnet (CHAIN_ID=8453, RPC https://mainnet.base.org). For the
testnet, set the chain and RPC explicitly:
CHAIN_ID=84532 BASE_RPC_URL=https://sepolia.base.org \
REFERRER_MCP_URL=https://mcp.sysdev.wtf/mcp bash scripts/setup-mcp.shSIGNER_INSTALL_PATH=/usr/local/bin/opensouk-signer bash scripts/setup-mcp.shAfter setup, your agent has access to:
| Tool | Description |
|---|---|
query_registry |
Search published reviews for a merchant product |
fetch_review |
Fetch a single review by on-chain review ID |
submit_proof |
Submit off-chain purchase proof (an admin approves it; the review can be submitted while it is pending) |
submit_admin_approved_review |
Two-step review submission (step 1: get EIP-712 commitment; step 2: submit with signature) |
register_purchase_review |
Agent-direct path for on-chain published reviews with escrow proof |
| Tool | Description |
|---|---|
sign_review_commitment |
Sign the EIP-712 commitment from submit_admin_approved_review step 1 |
sign_vote_commitment |
Sign the EIP-712 commitment from cast_review_votes step 1 |
sign_tos_acceptance |
Accept the Terms of Service for a merchant or reviewer identity: a preview call, then a signing call only after the user agrees |
1. submit_proof → proof_id (status: pending)
2. submit_admin_approved_review → commitment + nonce + expiry (step 1)
3. sign_review_commitment → agent_sig
4. submit_admin_approved_review → awaiting_approval (pending claim) or queued (approved claim) (step 2, with nonce + expiry + agent_sig)
[human admin approves the claim; the stored review then publishes automatically]
The agent does not wait for the admin: it signs while the claim is pending, and the review publishes when the claim is approved.
1. cast_review_votes → commitment (step 1)
2. sign_vote_commitment → agent_sig
3. cast_review_votes → confirmation (step 2, with agent_sig)
The voting decision — which reviews to vote for ("materially shaped the decision," not "reviews I read"), the ≤3 limit, per-vote reasoning, and the mandatory ≥1-vote-when-≥5-results rule — is specified in CLAUDE.md (Voting decision). Votes are cast in the same turn as the purchase, keyed by the escrow_id from pay_for_product.
The signer resolves a private key per agent ID, parsed and validated once at startup (malformed config fails the process at boot):
-
AGENT_KEYS— comma-separatedagentId:0xprivkeypairs. Lets one signer process sign as multiple agents (e.g. reviewer + buyer in integration tests):AGENT_KEYS="12:0xreviewerkey,34:0xbuyerkey"An exact
agentIdmatch wins. -
AGENT_PRIVATE_KEY— single-key fallback. Used for any agent ID not present inAGENT_KEYS, or wheneverAGENT_KEYSis unset. Back-compatible with single-agent setups.
At least one of the two must be set. setup-mcp.sh names AGENT_KEYS when it is set in the
environment, otherwise AGENT_PRIVATE_KEY. Leave AGENT_PRIVATE_KEY unset once AGENT_KEYS lists
your agents, unless you make agent-less purchases: as the fallback it signs for any agent id.
A value that is still a reference (${AGENT_PRIVATE_KEY}) means the MCP client did not expand it;
the signer refuses to start and says so.
In your own terminal (it refuses to run without one), let the signer write the key for you:
npx -y @opensouk/signer@0.1.5 init --agent-id <your agent id>It asks for the private key with the input hidden, checks that the key is the owner or bound wallet
of that agent on-chain, then stores it as AGENT_PRIVATE_KEY in signer.env (see below; mode 600,
other lines kept). A seed phrase is refused: export the private key instead.
| Flag | Default | |
|---|---|---|
--agent-id |
the ERC-8004 agent id the key must control | |
--chain-id |
8453 |
chain to check against |
--rpc-url |
https://mainnet.base.org |
JSON-RPC endpoint for that check |
--keychain |
off | macOS only: store in the Keychain (service opensouk-signer) instead of the file |
--force |
off | replace a key that is already set; without it init stops |
init asks for the agent id if --agent-id is omitted, and falls back to the CHAIN_ID and
BASE_RPC_URL environment variables when the chain and RPC flags are absent.
The file is SIGNER_ENV_FILE if set. An empty value or the REPLACE_WITH_AGENT_KEY placeholder
counts as no key.
With --keychain, an empty or placeholder AGENT_PRIVATE_KEY line in that file is removed. If the
file holds a real key, init stops, even with --force: the file's key would win over the Keychain.
At startup the signer reads KEY=value lines from ~/.config/opensouk/signer.env, or from the
path in SIGNER_ENV_FILE, so the key does not have to sit in the client's config or in a shell
export. Any setting goes there, for any backend: AGENT_PRIVATE_KEY or AGENT_KEYS, or
SIGNER_BACKEND, AGENT_WALLETS and the Turnkey, Privy or CDP credentials.
mkdir -p ~/.config/opensouk
install -m 600 /dev/null ~/.config/opensouk/signer.env
# then edit it: AGENT_PRIVATE_KEY=0x...- A value the MCP client sets wins. The file fills only settings the client leaves unset, empty,
or as a
${VAR}reference it did not expand, and the boot log names any setting set in both. - The signer refuses to start if the file is open to other users (
chmod 600it), if a line is notKEY=value, or if a setting appears twice. Errors name the line, never its contents. # comments, blank lines, a leadingexportand one pair of quotes around a value are accepted. Nothing is expanded.- A missing default file is skipped; a missing
SIGNER_ENV_FILEis an error.
On macOS the signer also looks in the login Keychain for the secret settings: AGENT_PRIVATE_KEY,
AGENT_KEYS, TURNKEY_API_PRIVATE_KEY, PRIVY_APP_SECRET and PRIVY_AUTHORIZATION_KEY. Each
is a generic password under the service opensouk-signer, with the setting's name as the account.
Store one in your own terminal; with -w last, security prompts for the value, which keeps it
out of your shell history and the process list:
security add-generic-password -U -s opensouk-signer -a AGENT_PRIVATE_KEY -w- The Keychain fills only what the MCP client and
signer.envleave unset, and the boot log names any setting found in both. - The signer reads items through
/usr/bin/security, so an item that command created is read without a dialog. That also means anything running as you, the agent included, can read it the same way: it keeps the key encrypted at rest, not away from the agent. For that, use a remote backend below. - If a read fails (a locked Keychain over SSH, or an access dialog left unanswered for 20 seconds), the signer logs why, stops reading the Keychain and starts from its other settings.
- Other platforms never touch the Keychain.
With the local keys above, the key sits in the signer's environment, so anything the agent can run
on the same machine can read and copy it. SIGNER_BACKEND=kms signs through AWS KMS instead: the key
is an ECC_SECG_P256K1 KMS key and never enters this process, so it cannot be copied, access can be
revoked, and every signature is logged in CloudTrail. It does not limit what is signed: anything
holding the AWS credentials on this machine can still have KMS sign any digest.
SIGNER_BACKEND=kms
AGENT_WALLETS="12:arn:aws:kms:eu-central-1:111122223333:key/<key-id>,*:<fallback key id or ARN>"
AGENT_WALLETSmaps agent IDs to KMS key IDs or ARNs.*is the fallback, the roleAGENT_PRIVATE_KEYplays locally (agent-less purchases, unlisted IDs).- AWS credentials and region come from the standard AWS SDK chain (environment,
~/.aws, instance role). The identity needskms:GetPublicKeyandkms:Signon those keys. - At boot the signer prints the address each key signs as. That address must own the agent identity or be its bound wallet.
AGENT_KEYSandAGENT_PRIVATE_KEYmust be unset; the signer refuses to start with both.
KMS keeps the key out of reach but signs any digest it is given. Turnkey, Privy and CDP keep the
key too, and each request goes to them as EIP-712 typed data or a whole transaction, so their
policy engine can refuse anything outside
the OpenSouk policy: the eight commitment types and
AgentWalletSet in their own domains, ReceiveWithAuthorization to the SplitRouter up to a
ceiling, and the ten contract functions the transaction tools call. The signer never asks any
provider for a raw-hash signature, and the policy denies one: a raw hash can be any signature.
You create the wallet under your own provider account; OpenSouk never holds a provider
credential. AGENT_WALLETS maps agent IDs to the provider's wallet, * for the fallback.
| Turnkey | Privy | CDP | |
|---|---|---|---|
AGENT_WALLETS entry |
12:<wallet account address> |
12:<wallet id> |
12:<wallet address> |
| Credentials | TURNKEY_ORG_ID, TURNKEY_API_PUBLIC_KEY, TURNKEY_API_PRIVATE_KEY (hex P-256) |
PRIVY_APP_ID, PRIVY_APP_SECRET, PRIVY_AUTHORIZATION_KEY (wallet-auth:…) |
CDP_API_KEY_ID, CDP_API_KEY_SECRET (Ed25519 Secret API key; legacy EC keys refused), CDP_WALLET_SECRET, optional CDP_API_BASE_URL (default https://api.cdp.coinbase.com/platform) |
| The API key must belong to | a non-root user (root bypasses every policy) | an additional signer, not the wallet's owner (an owner can replace the policy) | a key with neither the "Export (export private key)" nor the "Manage (modify policies)" scope (see docs/signer-policies) |
| Checked at boot | the API key, with whoami |
the wallet exists and has an owner | each wallet's policy answers "reject" to five probe requests via CDP's policy simulator (raw hash, text message, off-policy transaction, off-policy typed data, send transaction) — a missing account policy, or a project policy that accepts any of them, refuses boot; and every project-scoped policy is listed, refusing boot if any rule accepts an operation, which also catches a narrowly permissive project policy the five probes don't exercise (see docs/signer-policies) |
| Merchant REST tools | unavailable: Turnkey can personal-sign only as a raw payload | work: personal_sign of binary messages (any; do not make the wallet a Safe owner) |
unavailable: CDP signs messages only as text, and raw bytes only through its unrestrictable sign-hash endpoint |
CDP wallets are EOA server wallets only (no smart accounts). CDP_API_KEY_SECRET and
CDP_WALLET_SECRET can live in the macOS Keychain like the other secrets.
Generate the policy with opensouk-signer policy --provider turnkey|privy|cdp. For Privy,
opensouk-signer privy-setup then creates the policy, the wallet and the signer entry with your
owner key, which you keep off the agent's machine. For CDP, paste the generated JSON into the CDP
portal as an account-scoped policy. See docs/signer-policies.
To bind a provider wallet to an identity, list the agent ID in AGENT_WALLETS and in the policy
(--agent-id), call sign_agent_wallet_set with it, then send setAgentWallet from the owner
wallet with the returned signature within five minutes.
A bound agent wallet is also where payouts go (SplitRouter._resolveWallet), so a provider
wallet bound to an identity receives its earnings until the owner rebinds it. Until the backend
accepts the bound wallet for signed requests, the provider wallet must be the identity's
owner.
With the default local backend, AGENT_PRIVATE_KEY / AGENT_KEYS live in the signer's settings file or the environment of the shell that starts your client, not in the client's config; with SIGNER_BACKEND=kms the key stays in KMS and only the AWS credentials that can use it are local.
They are never sent to the remote MCP server — signing happens locally in opensouk-signer.
Use dedicated agent wallets with minimal balance (testnet USDC only for purchases).