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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.