A Model Context Protocol (MCP) server for interacting with the XIAN blockchain network. This server enables AI assistants to manage wallets, send transactions, query smart contracts, and interact with the XIAN blockchain and DEX.
- âś… Create new wallets (standard and HD wallets)
- âś… Import wallets from private keys or mnemonics
- âś… Check balances (XIAN and custom tokens)
- âś… Send transactions and tokens
- âś… Query and interact with smart contracts
- âś… Sign, verify, encrypt, and decrypt messages
- âś… Simulate transactions for gas estimation
- âś… Query token information by symbol or contract
- âś… Trade on the XIAN DEX (buy/sell tokens)
- âś… Get real-time DEX price data
- Docker Desktop installed and running
- For Claude Desktop: Claude Desktop app (macOS, Windows, or Linux)
- For LM Studio: LM Studio version 0.3.17 or later
git clone https://github.com/endogen/xian-mcp-server.git
cd xian-mcp-serverdocker-compose builddocker build -t xian-mcp-server .The repo includes a test file with the proper MCP handshake that can be used to test
python xian_server.py < test_requests.jsonldocker run --rm -i xian-mcp-server < test_requests.jsonlThis test validates that:
- âś… The MCP server starts correctly and accepts stdio communication
- ✅ The MCP protocol handshake completes successfully (initialize → initialized → tools/list)
- âś… All Python dependencies are properly installed
- âś… The server can serialize and respond with valid JSON-RPC 2.0 messages
- âś… All Xian blockchain tools are registered and available
You should see two JSON responses:
- Initialize response (id:1)
- Tools list response (id:2)
To test the actual Xian blockchain functionality (wallets, transactions, cryptography), run the comprehensive test suite:
# Install test dependencies
pip install pytest pytest-asyncio
# Run the tests
python test_xian_server.py- Open test_xian_server.py and configure the test values at the top of the file
- Update the values with real testnet data (addresses, private keys, etc.)
- The tests use testnet by default (https://testnet.xian.org)
- âś… Wallet creation and import
- âś… Balance and state queries
- âś… Transaction simulation and retrieval
- âś… Cryptographic operations - signing, encryption
- âś… Error handling for invalid inputs
- Tests will show âś… for passed tests
- Tests requiring configuration will be skipped with helpful messages
- Failed tests will show detailed error information
Run these tests before building the Docker container to ensure all functionality works correctly with your network configuration.
Locate your Claude Desktop configuration file:
- macOS:
~/Library/Application\ Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Edit the configuration file and add the XIAN server:
{
"mcpServers": {
"xian": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"xian-mcp-server"
]
}
}
}If you already have other MCP servers configured, add the "xian" entry alongside them.
- Completely quit Claude Desktop (check system tray/menu bar)
- Start Claude Desktop again
- The XIAN tools should now be available
- Launch LM Studio
- Click the Program tab (>_) in the right sidebar
- Click Install > Edit mcp.json
Add this configuration to your mcp.json:
{
"xian": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"xian-mcp-server"
]
}
}The default location for this file is:
- macOS/Linux:
~/.lmstudio/mcp.json - Windows:
%USERPROFILE%\.lmstudio\mcp.json
Save the file - LM Studio automatically reloads MCP servers when you save changes.
If you're using Docker MCP Toolkit, you can add XIAN to your custom catalog:
- Copy the example catalog:
cp custom_catalog.yaml ~/.docker/mcp/catalogs/custom.yaml- Update your Claude Desktop config to use both catalogs:
{
"mcpServers": {
"mcp-toolkit-gateway": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"-v", "~/.docker/mcp:/mcp",
"docker/mcp-gateway",
"--catalog=/mcp/catalogs/docker-mcp.yaml",
"--catalog=/mcp/catalogs/custom.yaml",
"--config=/mcp/config.yaml",
"--registry=/mcp/registry.yaml",
"--tools-config=/mcp/tools.yaml",
"--transport=stdio"
]
}
}
}- Transport: stdio (
mcp.server), servinglist_toolsandcall_toolwithTextContentJSON responses. - Tools include wallet/HD wallet, balances/transactions, contract state/source, token queries, DEX helpers, and crypto (sign/verify/encrypt/decrypt). Use
tools/list(seetest_requests.jsonl) to discover the full schema.
- Add to registry:
echo 'registry:\n xian:\n ref: ""' >> ~/.docker/mcp/registry.yamlThe server supports these environment variables:
XIAN_NODE_URL: XIAN node URL (default:https://node.xian.org)XIAN_CHAIN_ID: XIAN chain ID (default:xian-1)XIAN_GRAPHQL: GraphQL endpoint URL (default:https://node.xian.org/graphql)
Create a .env file in the project directory (or copy and rename .env.example):
XIAN_NODE_URL=https://node.xian.org
XIAN_CHAIN_ID=xian-1
XIAN_GRAPHQL=https://node.xian.org/graphqlThen run:
docker-compose upTo use custom values with Docker:
{
"xian": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"--env", "XIAN_NODE_URL=https://your-node.example.com",
"--env", "XIAN_CHAIN_ID=testnet-1",
"--env", "XIAN_GRAPHQL=https://your-node.example.com/graphql",
"xian-mcp-server"
]
}
}Once installed, you can interact with the XIAN blockchain through your AI assistant:
- "Create a new XIAN wallet"
- "Create an HD wallet with recovery phrase"
- "Import wallet from private key [key]"
- "Restore HD wallet from mnemonic: [12/24 word phrase]"
- "Check balance for address 8bf21c7dc3a4ff32996bf56a665e1efe3c9261cc95bbf82552c328585c863829"
- "Send 10 XIAN to [address] using private key [key]"
- "Send 100 custom_token to [address] using private key [key]"
- "Get transaction details for hash [tx_hash]"
- "Simulate sending 100 tokens to estimate gas costs"
- "Get the source code of contract 'currency'"
- "Check the state of variable 'balances:address123' in contract 'currency'"
- "Read contract state: con_token.metadata:token_symbol"
- "Simulate calling function 'transfer' on contract 'currency'"
- "Find the contract address for token symbol USDT"
- "Get token metadata for contract con_my_token"
- "What's the current DEX price of con_my_token in XIAN?"
- "Buy 100 con_my_token with currency (XIAN) using private key [key]"
- "Sell 50 con_my_token for currency with 2% slippage"
- "Get the current price of con_my_token against XIAN"
- "Sign the message 'Hello XIAN' with private key [key]"
- "Verify signature [sig] for message 'Hello XIAN' from address [addr]"
- "Encrypt a message from [sender_key] to [recipient_public_key]"
- "Decrypt message [encrypted] from [sender_public_key] using [receiver_private_key]"
| Tool | Description | Parameters | Requires Private Key |
|---|---|---|---|
create_wallet |
Generate new random wallet | None | No |
create_wallet_from_private_key |
Import wallet from private key | private_key |
Yes (to import) |
create_hd_wallet |
Create new HD wallet with mnemonic | None | No |
create_hd_wallet_from_mnemonic |
Restore HD wallet from mnemonic | mnemonic |
No |
| Tool | Description | Parameters | Requires Private Key |
|---|---|---|---|
get_balance |
Check address balance | address, token_contract |
No |
send_transaction |
Send generic transaction | private_key, contract, function, kwargs |
Yes |
send_tokens |
Send tokens to address | private_key, to_address, token_contract, amount |
Yes |
get_transaction |
Get transaction details | tx_hash |
No |
simulate_transaction |
Estimate gas costs | address, contract, function, kwargs |
No |
| Tool | Description | Parameters | Requires Private Key |
|---|---|---|---|
get_state |
Read contract state variable | state_key |
No |
get_contract |
Get contract source code | contract_name |
No |
| Tool | Description | Parameters | Requires Private Key |
|---|---|---|---|
get_token_contract_by_symbol |
Find contract by token symbol | token_symbol |
No |
get_token_data_by_contract |
Get token metadata | token_contract |
No |
| Tool | Description | Parameters | Requires Private Key |
|---|---|---|---|
buy_on_dex |
Buy tokens on DEX | private_key, buy_token, sell_token, amount, slippage, deadline_min |
Yes |
sell_on_dex |
Sell tokens on DEX | private_key, sell_token, buy_token, amount, slippage, deadline_min |
Yes |
get_dex_price |
Get token price on DEX | token_contract, base_contract |
No |
| Tool | Description | Parameters | Requires Private Key |
|---|---|---|---|
sign_message |
Sign a message | private_key, message |
Yes |
verify_signature |
Verify message signature | address, message, signature |
No |
encrypt_message |
Encrypt message between parties | sender_private_key, receiver_public_key, message |
Yes |
decrypt_message |
Decrypt received message | receiver_private_key, sender_public_key, encrypted_message |
Yes |
- Ensure Docker Desktop is running
- Check that you have sufficient disk space
- Try
docker system pruneto clean up old images
- Verify the container built successfully:
docker images | grep xian - Check the config file syntax (must be valid JSON)
- Ensure you completely restarted the application
- Test the container directly:
docker run --rm xian-mcp-server
- Verify the XIAN node URL is accessible
- Check your internet connection
- Try the default node:
https://node.xian.org
- On Linux/macOS: Ensure Docker has necessary permissions
- On Windows: Run Docker Desktop as administrator if needed
For development, you can run the server directly:
# Install dependencies
pip install -r requirements.txt
# Run the server
python xian_server.py- XIAN Network Documentation
- xian-py SDK
- Model Context Protocol
- Claude Desktop MCP Guide
- LM Studio MCP Documentation
This server handles sensitive cryptographic material. Always:
- Use only for local development and testing
- Never expose to the internet
- Keep private keys secure
- Use testnet for experimentation
- Verify all transactions before execution