ResilientDB MCP Server
Enables interaction with ResilientDB blockchain through smart contract operations, GraphQL queries, and key-value storage operations.
README
ResilientDB MCP Server
A Model Context Protocol (MCP) server for interacting with ResilientDB, a high-performance blockchain platform. This server allows Large Language Models (LLMs) like Claude to interact with ResilientDB through smart contract operations and GraphQL queries.
Overview
This MCP server bridges the gap between AI agents (like Claude Desktop) and ResilientDB by providing a standardized interface for:
- Smart Contract Operations: Compile, deploy, and execute smart contracts using ResContract CLI
- GraphQL Operations: Create accounts, manage transactions, and query data
- Key-Value Operations: Store and retrieve data using ResilientDB's key-value store
Features
Smart Contract Operations
compileContract: Compile smart contracts using ResContract CLIdeployContract: Deploy compiled contracts to the ResilientDB blockchainexecuteContract: Execute contract methods (read/write operations)getContractState: Retrieve the current state of a deployed contract
GraphQL Operations
createAccount: Create new accounts in ResilientDBgetTransaction: Retrieve transaction details by IDpostTransaction: Post new transactions to the blockchainupdateTransaction: Update existing transactions
Key-Value Operations
get: Retrieve values by keyset: Store key-value pairs
Installation
Prerequisites
- Python 3.11 or higher
- ResilientDB instance running (see ResilientDB Installation)
- ResContract CLI installed (for smart contract operations)
- Access to ResilientDB GraphQL endpoint
Local Installation
- Clone the repository:
git clone https://github.com/rahulkanagaraj786/ResilientDB-MCP.git
cd ResilientDB-MCP
- Install dependencies:
pip install -r requirements.txt
- Configure environment variables:
cp .env.example .env
# Edit .env with your ResilientDB configuration
- Update
.envfile with your settings:
RESILIENTDB_GRAPHQL_URL=http://localhost:9000/graphql
RESCONTRACT_CLI_PATH=rescontract
Docker Installation
- Build the Docker image:
docker build -t mcp/resilientdb -f Dockerfile .
- Run the container:
docker run -i --rm mcp/resilientdb
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
RESILIENTDB_GRAPHQL_URL |
GraphQL endpoint URL | http://localhost:9000/graphql |
RESCONTRACT_CLI_PATH |
Path to ResContract CLI executable | rescontract |
RESILIENTDB_API_KEY |
Optional API key for authentication | None |
RESILIENTDB_AUTH_TOKEN |
Optional auth token | None |
REQUEST_TIMEOUT |
Request timeout in seconds | 30 |
TRANSACTION_POLL_INTERVAL |
Polling interval for transactions | 1.0 |
MAX_POLL_ATTEMPTS |
Maximum polling attempts | 30 |
Usage with Claude Desktop
Add the MCP server to your Claude Desktop configuration:
- Open Claude Desktop settings
- Edit the MCP servers configuration file (usually
claude_desktop.json) - Add the following configuration:
For Local Installation:
{
"mcpServers": {
"resilientdb": {
"command": "python",
"args": ["/path/to/ResilientDB-MCP/server.py"],
"env": {
"RESILIENTDB_GRAPHQL_URL": "http://localhost:9000/graphql",
"RESCONTRACT_CLI_PATH": "rescontract"
}
}
}
}
For Docker Installation:
{
"mcpServers": {
"resilientdb": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/resilientdb"]
}
}
}
- Restart Claude Desktop
Available Tools
createAccount
Create a new account in ResilientDB.
Parameters:
accountId(optional): Account ID. If not provided, server will generate one.
Example:
{
"accountId": "my-account-123"
}
compileContract
Compile a smart contract using ResContract CLI.
Parameters:
contractPath(required): Path to the contract fileoutputDir(optional): Output directory for compiled contract
Example:
{
"contractPath": "/path/to/contract.sol",
"outputDir": "/path/to/output"
}
deployContract
Deploy a compiled smart contract to ResilientDB.
Parameters:
contractPath(required): Path to the compiled contractaccountId(optional): Account ID for deploymentconstructorArgs(optional): Constructor arguments
Example:
{
"contractPath": "/path/to/compiled_contract.json",
"accountId": "my-account-123",
"constructorArgs": ["arg1", "arg2"]
}
executeContract
Execute a method on a deployed smart contract.
Parameters:
contractAddress(required): Address of the deployed contractmethodName(required): Name of the method to executemethodArgs(optional): Method argumentsaccountId(optional): Account ID for executiontransactionType(optional): "call" for read operations, "send" for write operations (default: "call")
Example:
{
"contractAddress": "0x123...",
"methodName": "getValue",
"transactionType": "call"
}
getTransaction
Get transaction details by transaction ID.
Parameters:
transactionId(required): Transaction ID to retrieve
Example:
{
"transactionId": "tx-123456"
}
postTransaction
Post a new transaction to ResilientDB.
Parameters:
data(required): Transaction data as key-value pairs
Example:
{
"data": {
"key": "value",
"amount": 100
}
}
updateTransaction
Update an existing transaction.
Parameters:
transactionId(required): Transaction ID to updatedata(required): Updated transaction data
Example:
{
"transactionId": "tx-123456",
"data": {
"status": "completed"
}
}
get
Retrieve a value from ResilientDB by key.
Parameters:
key(required): Key to retrieve
Example:
{
"key": "my-key"
}
set
Store a key-value pair in ResilientDB.
Parameters:
key(required): Key to storevalue(required): Value to store
Example:
{
"key": "my-key",
"value": "my-value"
}
getContractState
Get the current state of a deployed smart contract.
Parameters:
contractAddress(required): Address of the deployed contract
Example:
{
"contractAddress": "0x123..."
}
Architecture
The MCP server acts as a mediator between the MCP host (Claude Desktop) and ResilientDB backend services:
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Claude │────────▶│ MCP Server │────────▶│ ResilientDB │
│ Desktop │ │ (Python) │ │ Backend │
└─────────────┘ └──────────────┘ └─────────────┘
│
├──▶ GraphQL Client
│ (Account, Transaction, KV ops)
│
└──▶ ResContract CLI
(Smart Contract ops)
Routing Logic
The server automatically routes requests to the appropriate service:
- Smart Contract Operations → ResContract CLI
- Data Operations → GraphQL API
- Hybrid Operations → Tries GraphQL first, falls back to ResContract CLI
Development
Project Structure
ResilientDB-MCP/
├── server.py # Main MCP server implementation
├── graphql_client.py # GraphQL client for ResilientDB
├── rescontract_client.py # ResContract CLI client
├── config.py # Configuration management
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
└── README.md # This file
Running Tests
# Install test dependencies
pip install pytest pytest-asyncio
# Run tests
pytest
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Troubleshooting
ResContract CLI Not Found
If you get an error about ResContract CLI not being found:
- Ensure ResContract CLI is installed
- Add it to your PATH, or
- Set
RESCONTRACT_CLI_PATHenvironment variable to the full path
GraphQL Connection Errors
If you encounter GraphQL connection errors:
- Verify ResilientDB is running
- Check the
RESILIENTDB_GRAPHQL_URLis correct - Ensure network connectivity to the GraphQL endpoint
- Check firewall settings
Transaction Timeouts
If transactions timeout:
- Increase
REQUEST_TIMEOUTin.env - Check ResilientDB blockchain status
- Verify network latency
References
- ResilientDB GitHub
- ResilientDB Documentation
- ResContract CLI Documentation
- ResilientDB GraphQL API
- MCP Protocol Documentation
License
Apache 2.0 License
Authors
Team 10 - ECS 265 Project
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。