AgentKeeper-MCP
Summary: AgentKeeper-MCP is a non-custodial MCP gateway for autonomous AI agents to safely execute onchain transactions, make HTTP 402 micropayments, verify audit proofs, and check multi-chain balances without exposing private keys.
Execute onchain transactions (
keeper_execute_tx): Send transactions via a guarded relay with gas optimization, idempotency keys, and MEV protection, keeping private keys isolated from the agent context.Autonomous HTTP 402 micropayments (
keeper_x402_settle): Sign EIP-712 payment permits to settle paywalled resource challenges under a bounded spend limit (Arc Mainnet / USDC).Cryptographic audit verification (
keeper_audit_verify): Validate Merkle inclusion proofs, execution receipts, and block anchoring for agent transactions before triggering dependent actions.Multi-chain balance inspection (
keeper_agent_balance): Query live treasury balances, spent budget, and remaining limits across chains such as Base, Arbitrum, Ethereum, and Creditcoin.Deterministic, budget-bounded execution: All tools enforce typed schemas, parameter bounds, gas ceilings, and pre-flight validation to make agent behavior reproducible and safe.
Enables onchain interactions on Ethereum Mainnet via KeeperHub, including transaction execution, x402 micro-payment settlement, and cryptographic audit verification.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AgentKeeper-MCP settle the HTTP 402 micro-payment for the latest API request"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AgentKeeper-MCP
A deterministic, non-custodial Model Context Protocol (MCP) execution gateway for autonomous AI agents on Arc Mainnet with native USDC gas settlement and HTTP 402 micro-payments.
Arc Mainnet Workflow Walkthrough (local, no broadcast):
python3 scripts/demo_arc_mainnet.py| Instant MCP Demo:make demo| Arc verifier:contracts/X402Receipt.sol(deployed & verified on Arc Testnet:0x589fE98EDB63F3e158DdE791C5144369fAeC4cE5)

The Problem: Why Agents Break Onchain
If you give an autonomous agent direct access to an RPC or raw private key, three critical failures happen:
Context Credential Leaks: The moment an execution errors out, the model includes raw private keys or RPC URLs in its chat history or debug prompts.
Nonce Collisions & Gas Drain: High-frequency agents retry transactions without tracking mempool states, burning capital on stuck nonces during fee spikes.
The Paywall Dead-End: When an agent queries paid data services returning
HTTP 402 Payment Required, it has no standardized way to sign a micro-payment and continue execution. On Arc Mainnet, where USDC is the native gas asset, agents need a native settlement mechanism that manages USDC spending ceilings deterministically.
Related MCP server: @arispay/payagent-mcp
The Solution: Guarded Gateway Architecture
AgentKeeper sits as a local middleware between the agent runtime and blockchain networks. Private keys stay isolated in local memory, while the agent interacts solely through typed, bounded tools:
┌────────────────────────────────────────────────────────┐
│ Autonomous Agent Client (Host / IDE / Daemon) │
└──────────────────────────┬─────────────────────────────┘
│ (stdio / FastMCP)
▼
┌────────────────────────────────────────────────────────┐
│ AgentKeeper-MCP │
│ │
│ [1] keeper_execute_tx ───► Local Key Sandbox │
│ [2] keeper_x402_settle ───► EIP-712 Spend Budget │
│ [3] keeper_audit_verify ───► Merkle Proof Engine │
│ [4] keeper_agent_balance ───► Multi-Chain Balances │
│ [5] keeper_creditcoin_settle ► Attestcoin L1 Escrow │
└──────────────┬───────────────────────────┬─────────────┘
│ │
▼ ▼
Circle Arc Mainnet x402 Paywalled APIs
(Chain ID 5042 / Native USDC) (Per-token Data Feeds)Core Capabilities
1. Non-Custodial Key Sandbox (keeper_execute_tx)
Validates target contracts, calldata schemas, and gas parameters before signing.
Implements an in-memory FIFO idempotency cache (
cap = 1024, Keccak256 deduplication) to prevent duplicate execution during network latency.Supports deterministic pre-flight simulation (
dry_run=True) without state mutation or network broadcast.Never passes raw cryptographic keys to the LLM context.
2. Workflow Planning & Dry-Run Composition (keeper_plan_workflow)
Composes multi-step agent workflows across execution, micropayments, and settlements into a single verified plan.
Pre-flight validates all step schemas and calculates aggregate gas, native value, and USDC budget requirements.
Bounded to a maximum of 16 steps per workflow to eliminate non-deterministic loop reinterpretation.
3. Autonomous HTTP 402 Micropayments (keeper_x402_settle)
Signs an EIP-712
Permit(payer, payee, amount, nonce, deadline)under a per-permit random 256-bit nonce, capped by a cumulative spend limit (MAX_AUTONOMOUS_PAYMENT_USDC).The permit is bound to a verifying contract you deploy:
contracts/X402Receipt.sol. The address comes fromARC_X402_VERIFIER(EIP-55 checksum). If it is unset or invalid the tool fails closed and returns an error; there is no default address.The response includes a
permitobject (payer, payee, amount, nonce as a decimal string, deadline, chainId, verifyingContract). Together withsignatureit is exactly whatX402Receipt.settle(...)needs, so the output is redeemable on-chain by anyone (a test does this end to end on an in-memory EVM). Both demos (make demo,scripts/demo_arc_mainnet.py) needARC_X402_VERIFIERset for their x402 step; without it they print the fail-closed error.Defaults to Arc Mainnet (chain 5042). Other tools' chain defaults are unchanged;
keeper_x402_settlerequests for any other chain currently fail closed because no verifier is configured for them.
Arc x402 Receipt Verifier
contracts/X402Receipt.sol is a small (68 lines, Solidity ^0.8.20, no dependencies) non-custodial receipt registry. settle(payer, payee, amount, nonce, deadline, signature) verifies the payer's EIP-712 signature (domain: name, version, chainId, verifyingContract = address(this)), rejects expired deadlines and reused (payer, nonce) pairs, rejects non-canonical (high-s) signatures, records the nonce and emits Settled(payer, payee, amount, nonce).
It holds no funds and moves none: nothing is payable, it makes no token calls, and it has no owner, admin or upgrade path. It is a signed-receipt registry, not a payment rail. Only EOA signers are supported (
ecrecover, no EIP-1271).Compiled with
--evm-version paris(noPUSH0) because Arc's opcode support has not been verified here.Tested in-process (solc + eth-tester): valid signature accepted; wrong signer, tampered fields, expired deadline, replayed nonce, wrong chainId, wrong verifying contract, high-s twin and malformed signatures rejected. These tests do not exercise Arc itself.
# 1. Dry run (default): compile, print the unsigned deployment tx, gas and USDC cost estimate. No key is read.
python3 scripts/deploy_arc_verifier.py
# 2. Deploy (operator, funded wallet, own shell). Reads AGENT_PRIVATE_KEY from the environment only.
export AGENT_PRIVATE_KEY=0x...
python3 scripts/deploy_arc_verifier.py --broadcast
export ARC_X402_VERIFIER=<deployed address> # placeholder: set to the address the script prints
# 3. One live settle() call against the deployed verifier (dry run by default; --broadcast sends).
python3 scripts/broadcast_live_arc_tx.py
python3 scripts/broadcast_live_arc_tx.py --broadcastStatus:
Arc Testnet (Deployed & Live Verified):
Contract Address:
0x589fE98EDB63F3e158DdE791C5144369fAeC4cE5Deployment Tx:
0x56b6eea5b7f3408af6b961e62c85cfa0cc80076ce03dcd39e0803c577530e46c(Block 66163738, 435,859 gas)Live
settle()Receipt Tx:0x04ce874ecd72e5918f93d84d09f3484704c5345580620ce300914292b6f12720(Block 66163775, 54,331 gas)
Arc Mainnet: Contract, tests, and deployment scripts verified. Mainnet broadcast pending operator-funded gas wallet.
4. Merkle Audit Trail (keeper_audit_verify)
Builds cryptographic inclusion proofs for all relay actions using a flat array Merkle heap.
Allows agents to independently audit state proofs before triggering downstream dependent actions.
5. Multi-Chain Budgeting (keeper_agent_balance)
Real-time multi-chain RPC balance queries across Base, Arbitrum, Ethereum, and Creditcoin.
6. Creditcoin 3.0 Attestcoin Intent Settlement (keeper_creditcoin_settle)
Creditcoin 3.0 is a decentralized Layer 1 EVM consensus network designed for real-world asset (RWA) lending and cross-chain settlement. Under the Attestcoin Protocol, cross-chain data and transaction receipts are attested without relying on centralized oracles or vulnerable multi-sig bridges.
AgentKeeper-MCP implements an autonomous Attestcoin Cross-Chain Solver Escrow Gateway:
Collateral Escrow on Creditcoin L1: The agent locks CTC escrow collateral for a target intent ID with an authorized solver address via
register_escrow(intent_id, solver_address, amount_ctc).Off-Chain / Cross-Chain Execution: An external solver executes the requested task (e.g. token swap, liquidity provisioning, or paywalled data query) on an external EVM chain (Arbitrum, Base, Mantle, or Arc).
Dynamic Oracle Root Anchoring: The Attestcoin protocol validates the transaction's block header against on-chain consensus.
CreditcoinSettlementManagerqueries the source-chain JSON-RPC to confirm that the candidate Merkle root matches the mined block'sreceiptsRoot,stateRoot, ortransactionsRootunder a deny-by-default security policy.Flat Merkle Tree Inclusion Proof ($\mathcal{O}(\log N)$): The solver generates an Attestcoin inclusion proof constructed via
FlatMerkleTree. The tree validates that the leaf payload (intent_id:source_chain:source_tx_hash:expected_recipient) is mathematically contained in the attested Merkle root without recursive stack overhead. Proof depth is strictly bounded to $\le 64$.Atomic CTC Escrow Reimbursement: Upon cryptographic proof validity and solver address verification, the locked CTC collateral is immediately released to the solver. Bounded ring-buffer state storage (
MAX_INTENTS_CAPACITY = 2048) prevents memory leaks and state exhaustion attacks.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Autonomous Agent│ │ AgentKeeper │ │ Creditcoin 3.0 │
│ (LLM Client) │ │ MCP Gateway │ │ EVM L1 Escrow │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
│ 1. Request Solver Task │ │
│────────────────────────►│ 2. Lock CTC Collateral │
│ │────────────────────────►│
│ │ │
│ │ │ ──┐
│ │ │ │ External Solver
│ │ │ │ executes on Base/Arb
│ │ │ ◄─┘
│ │ │
│ │ 3. Attestcoin Proof │
│ │ (Receipt + Branch) │
│ │◄────────────────────────│
│ │ │
│ │ 4. FlatMerkleTree │
│ │ O(log N) Verify │
│ │ ──┐ │
│ │ │ Deny-by-default │
│ │ ◄─┘ Oracle Check │
│ │ │
│ │ 5. Release CTC Escrow │
│ │────────────────────────►│
│ │ │
│ 6. Validated Receipt │ │
│◄────────────────────────│ │Internal Safety & Static-Analysis Checklist
AgentKeeper-MCP maintains an internal engineering checklist, organized loosely along the section structure of the ISO 9001 quality-management standard for convenience, but this is a self-administered script, not a third-party or accredited certification. The checklist covers:
Checklist Area (internal script label) | Metric & Standard Enforced | Verification Status |
Area 4: Context & Infrastructure | Multi-chain config (Arc, Base, Arb, Mantle, CTC), FastMCP stdio server |
|
Area 5: Leadership & Quality | Internal quality notes ( |
|
Area 6: Planning & Risk | Internal risk register ( |
|
Area 7: Support & Qualification | Typed Pydantic schemas, Ruff static analysis, Python 3.12 pinned runtime |
|
Area 8: Operation & V&V | Traceability notes ( |
|
Area 9: Performance Evaluation | Dynamic oracle anchoring verification, Arc Mainnet live query, GitHub Actions CI |
|
Area 10: Continual Improvement | Hypothesis property fuzz engine (5,000 iterations), automated checklist script |
|
Run the internal checklist script locally (its own console output still prints "ISO/DIS 9001:2026" and "Clause" labels internally; that is the script's own legacy naming, not a claim of certification):
make audit-iso9001Quick Setup
1. Add to Claude Desktop or Antigravity Config
Add this entry to your mcp_config.json:
{
"mcpServers": {
"agent-keeper": {
"command": "python3",
"args": ["-m", "agent_keeper.server"]
}
}
}2. Local Installation & Verification
git clone https://github.com/Ishant5436/agent-keeper-mcp.git
cd agent-keeper-mcp
# Setup environment
uv venv --python python3.12
source .venv/bin/activate
pip install -e . pytest hypothesis "web3[tester]" py-solc-x
# Run test suite (contract tests compile with solc from PATH, or download 0.8.20 via py-solc-x)
pytestTest Coverage & Reliability
make test (or pytest) runs 137 tests at this commit, all passing. That includes the x402 fail-closed tests and the X402Receipt.sol contract tests, which compile the contract and run it on an in-memory EVM. The contract tests need web3[tester] and py-solc-x (dev dependencies; contracts extra in pyproject.toml).
Deterministic Invariants: Bounded retry loops, minimum 2 runtime assertions per function, zero dynamic heap allocations on execution path.
Security Constraints: Enforces parameter bounds and rejects transactions exceeding pre-set gas ceilings.
Upstream Production Integration
AgentKeeper-MCP is designed as the canonical agent execution layer for KeeperHub (the open-source workflow automation platform for autonomous agents):
KeeperHub PR #2547:
feat(plugins): #2310 add Agent Gateway pluginImplements
AgentGatewayPlugin(src/plugins/agent-gateway.ts) providing native KeeperHub action nodes for EVM transaction execution, HTTP 402 micro-payment settlement, and Creditcoin Attestcoin solver claims.KeeperHub core maintainer (
suisuss) confirmed the issue reference and PR linkage are correct, and that an unrelated CI check failure on their side is not attributable to this contribution:"check-issue-link is red on our side. #2310 is filed correctly and your reference is right... not a defect in your work, and there is nothing to refile or chase. I will come back here once the issue has a verdict." This is a maintainer acknowledgment that the submission is filed correctly and awaiting a merge verdict, not a statement that the plugin itself has been reviewed or approved.
Byte-identical plugin discovery (
pnpm discover-plugins) and clean TypeScript compilation (tsc --noEmit).
DoraHacks BUIDL Profile #48196: https://dorahacks.io/buidl/48196
License
MIT License. Free for developers and autonomous agent operators.
Available Tools
4 toolskeeper_agent_balanceA
Inspect the AI agent's live multi-chain onchain treasury balances, spent budget, and remaining limits.
Inputs: address. Returns: object
keeper_audit_verifyC
Cryptographically verify the Merkle proof, inclusion block, and execution receipt of an agent transaction.
Inputs: task_id, tx_hash, chain_id. Returns: object
keeper_execute_txC
Execute an onchain transaction through KeeperHub's MEV-protected relay with automated gas optimization.
Inputs: target_address (required), chain_id, value_wei, calldata_hex, +2 more. Returns: object
keeper_x402_settleB
Autonomously settle an HTTP 402 Payment Required challenge using EIP-712 payment permits.
Inputs: amount_usdc (required), resource_url (required), recipient_address (required), token_address. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct operation: verifying proofs, settling payment challenges, checking balances, and executing transactions. There is no meaningful overlap between any two tools.
All tools share the keeper_ prefix and use snake_case, which keeps the set coherent. However, the verb/noun order is not perfectly consistent: execute_tx is verb-first while audit_verify and x402_settle are verb-last, and agent_balance has no explicit action verb.
Four tools is a well-scoped set for an agent treasury/execution keeper. Each tool serves a distinct core capability without unnecessary bloat or obvious triviality.
The set covers a coherent workflow: check balances, execute transactions, settle payment challenges, and verify audit proofs. Minor gaps exist such as transaction history or simulation, but these are not blocking for the stated purpose.
Maintenance
Related MCP Connectors
Machine-payable API infrastructure for autonomous agents. Per-call x402 settlement in USDC.
Marketplace and payment rail for AI agents: list, buy and settle with signed receipts.
Monetization and execution gateway for autonomous AI agents on Base Mainnet
Attribution and settlement infrastructure for AI agent content access over HTTP 402 and MCP.
Related MCP Servers
- AlicenseAqualityAmaintenanceA budget-bound x402 payment wallet for AI agents: it autonomously pays HTTP 402 payment-gated URLs across every major chain (EVM, Solana, and many non-EVM families). Self-custodial and backendless, your key, your RPC, with spend caps enforced before any on-chain send.810MIT

@arispay/payagent-mcpofficial
AlicenseAqualityBmaintenanceEnables AI agents to call paid APIs and settle HTTP 402 payment challenges with USDC on Base, without private keys ever being involved.7444 npmMIT- AlicenseNot gradedqualityDmaintenanceEnables AI agents to execute on-chain transactions through policy validation, KeeperHub orchestration, and tamper-evident evidence recording.MIT
- AlicenseNot gradedqualityCmaintenanceEnables pay-per-call access control for AI agents using HTTP 402 and on-chain settlement, allowing microtransactions for API usage.82 PyPIMIT