IntentGuard MCP Server
Enables AI agents to submit Ethereum transactions with on-chain outcome protection by wrapping DeFi transactions with enforcement transactions that drop the bundle if balance constraints are violated.
README
IntentGuard MCP Server
Includes a full end-to-end agent simulation test runnable locally in dry-run mode (no chain required).
A Model Context Protocol server that gives AI agents the ability to submit Ethereum transactions with on-chain outcome protection.
IntentGuard wraps any DeFi transaction with two enforcement transactions. If the declared balance constraints are violated at execution time, the transaction is dropped before inclusion — and no gas is consumed.
Architecture
The MCP server has a single, well-defined role: it builds the two protective transactions and validates the signed bundle before submission. It does not build or inspect the underlying DeFi transaction.
Protocol skill / wallet → builds the action transaction
IntentGuard agent skill → extracts and confirms protection constraints
IntentGuard MCP → compiles protection package, validates and submits
On-chain enforcer → allows or rejects execution
The MCP exposes exactly two tools:
| Tool | Role |
|---|---|
prepare_protected_transaction |
Compiler — produces two unsigned enforcement transactions and a nonce layout |
submit_protected_bundle |
Submitter — validates the signed bundle (pre + action + post) and submits to the relay |
Prerequisites
- Node.js >= 22
- Access to the IntentGuard relay (default:
https://sepolia.rpc.intentguard.xyz)
Install & Build
npm install
npm run build
The compiled entrypoint is dist/index.js. It includes a #!/usr/bin/env node shebang and is executable.
Configuration
The server is configured entirely via environment variables.
| Variable | Required | Default | Description |
|---|---|---|---|
INTENTGUARD_CHAIN_ID |
yes | — | EVM chain ID (e.g. 11155111 for Sepolia, 1 for mainnet) |
INTENTGUARD_RPC_URL |
no | https://sepolia.rpc.intentguard.xyz |
IntentGuard relay endpoint |
INTENTGUARD_ENFORCER_TYPE |
no | balance |
Enforcer contract type |
The enforcer contract address is resolved automatically from the relay — no contract address configuration is required.
Connecting to an Agent
Add the server to your agent's MCP configuration. Example for Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"intentguard": {
"command": "node",
"args": ["/absolute/path/to/mcp-server/dist/index.js"],
"env": {
"INTENTGUARD_CHAIN_ID": "11155111"
}
}
}
}
The agent spawns the server as a subprocess over stdio. No port or hosting is required.
Tools
prepare_protected_transaction
Produces two unsigned enforcement transactions that wrap a given action transaction.
Does not receive or build the action transaction. The action transaction is constructed upstream by the wallet or protocol skill.
Input:
userAddress— wallet address that will sign all three transactionsprotectionIntent— structured protections:max_spend— cap outflow of a tokenmin_receive— guarantee minimum inflow of a tokenno_balance_decrease— ensure balance does not decrease
validUntilBlock(optional) — protection expiry block; defaults to current block + 10
Output:
preTx— unsigned pre-enforcement transaction (nonce N)postTx— unsigned post-enforcement transaction (nonce N+2)nonceLayout—{ pre: N, action: N+1, post: N+2 }summary— human-readable protection list and signing instructions
The caller assigns nonceLayout.action to the action transaction and signs all three.
submit_protected_bundle
Validates and submits a fully signed bundle of three transactions.
Input:
signedPreTx— signed pre-enforcement transaction (nonce N)signedUserTx— signed action transaction (nonce N+1, built externally)signedPostTx— signed post-enforcement transaction (nonce N+2)retryUntilBlock(optional) — retry deadline; defaults to current block + 25
Pre-submission validation (failures returned immediately, no submission attempt):
- All three transactions are EIP-1559 (type 2)
- All three are signed by the same address
- Nonces are strictly sequential: N, N+1, N+2
- All three target the same chain ID
Return:
- Constraints satisfied → transaction hash, signer, confirmed nonce layout
- Constraints violated → bundle dropped, no gas paid
Returns the final bundle outcome directly. No separate receipt polling is required.
Testing
npm test
The test suite covers:
- Nonce layout assignment and boundary cases
- Output shape — action transaction is never returned by the MCP
- Default block window behaviour
- All protection types (max_spend, min_receive, no_balance_decrease)
- Input schema validation
- Bundle validation (nonce ordering, signer consistency, chain ID consistency)
- Error paths (network failures, SDK errors, malformed inputs)
- Full end-to-end flow: prepare → sign → submit
End-to-end test (agent simulation)
This repository includes a full end-to-end test that simulates an AI agent using IntentGuard over the MCP protocol.
The script:
- launches the MCP server as a subprocess (stdio transport, exactly as Claude / Cursor do)
- connects as an MCP client
- calls
prepare_protected_transaction - assigns nonce
N+1to the action transaction (built externally, never passed to MCP) - signs all three transactions (
preTx,actionTx,postTx) - optionally submits the bundle
Run locally — no chain required
INTENTGUARD_CHAIN_ID=11155111 npm run agent-e2e:dry
Verifies: MCP connectivity over stdio, nonce assignment (N, N+1, N+2), bundle construction, and transaction signing. The relay is contacted for nonce and block number but no transaction is submitted.
Full execution (Sepolia)
INTENTGUARD_CHAIN_ID=11155111 TEST_PRIVATE_KEY=0x... npm run agent-e2e
Requires a funded Sepolia wallet. Submits the signed bundle to the relay.
What this test simulates
| Role | Responsibility |
|---|---|
| Upstream builder | constructs the action transaction and assigns nonce N+1 |
| IntentGuard agent | calls prepare_protected_transaction |
| Signing agent | signs all three transactions |
| Orchestrator | assembles and submits the bundle |
| MCP server | validates and submits |
This is a full protocol-level test of the IntentGuard execution flow.
Scripts
| Script | Description |
|---|---|
npm run build |
Compile to dist/ |
npm run dev |
Run directly from source with tsx |
npm test |
Run the test suite |
npm run typecheck |
TypeScript type check without emit |
npm run agent-e2e:dry |
Full agent simulation, dry-run (no submission) |
npm run agent-e2e |
Full agent simulation with bundle submission (Sepolia) |
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。