A comprehensive Model Context Protocol (MCP) for interacting with the STABILITY blockchain. This project provides tools for wallet management, smart contract deployment, and blockchain interactions.
PRODUCTION URL: https://mcp.stabilityprotocol.com
For detailed usage instructions including SSE, HTTP Streaming, STDIO modes, and API examples, see USAGE.md.
- Create new random wallets
- Get wallet balances
- Retrieve transaction history
- Deploy ERC20 tokens
- Deploy ERC721 NFTs
- Deploy ERC1155 multi-tokens
- Deploy custom contracts with user-provided bytecode and ABI
- Send transactions
- Query transaction details
- Get block information
- Read from smart contracts
- Write to smart contracts
- Get latest block data
- Node.js 18+
- Yarn package manager
- STABILITY blockchain API key from https://portal.stabilityprotocol.com/
- Clone and install dependencies:
git clone <repository-url>
cd stability-mcp
yarn install- Build the project:
npx tsc --build- Set environment variables:
export PORT=3000 # Optional, defaults to 3000cd apps/server
node dist/index.jsThe server will start and provide several endpoints:
- Health Check:
GET /health - MCP Endpoints:
/mcp/{toolset}(wallet, contracts, blockchain) - SSE Endpoints:
/sse/{toolset} - REST API:
/v1/tools/{toolset}
The STABILITY API key can be provided in multiple ways:
-
HTTP Header (for REST API calls):
-H "X-API-Key: your_stability_api_key_here" -
Parameter in tool arguments (required for blockchain tools):
{ "tool": "send_transaction", "args": { "apiKey": "your_stability_api_key_here", ... } }
create_wallet- Create a new random walletget_balance- Get wallet balanceget_transaction_history- Get transaction history
deploy_erc20- Deploy ERC20 token contractdeploy_erc721- Deploy ERC721 NFT contractdeploy_erc1155- Deploy ERC1155 multi-token contractdeploy_custom_contract- Deploy custom contract
send_transaction- Send transactionsget_transaction- Get transaction detailsget_block- Get block informationread_contract- Read from smart contractswrite_contract- Write to smart contractsget_latest_block- Get latest block info
curl -X POST http://localhost:3000/v1/tools/wallet \
-H "Content-Type: application/json" \
-H "X-API-Key: your_stability_api_key_here" \
-d '{
"tool": "create_wallet",
"args": {
"alias": "MyWallet"
}
}'curl -X POST http://localhost:3000/v1/tools/wallet \
-H "Content-Type: application/json" \
-H "X-API-Key: your_stability_api_key_here" \
-d '{
"tool": "get_balance",
"args": {
"address": "0x..."
}
}'curl -X POST http://localhost:3000/v1/tools/contracts \
-H "Content-Type: application/json" \
-H "X-API-Key: your_stability_api_key_here" \
-d '{
"tool": "deploy_erc20",
"args": {
"name": "MyToken",
"symbol": "MTK",
"initialSupply": "1000000",
"walletAddress": "0x...",
"privateKey": "0x..."
}
}'curl -X POST http://localhost:3000/v1/tools/blockchain \
-H "Content-Type: application/json" \
-H "X-API-Key: your_stability_api_key_here" \
-d '{
"tool": "send_transaction",
"args": {
"to": "0x...",
"value": "0.1",
"privateKey": "0x...",
"apiKey": "your_stability_api_key_here"
}
}'- RPC Endpoint:
https://rpc.stabilityprotocol.com/zgt/{API_KEY} - Explorer: https://explorer.stabilityprotocol.com/
- Gas Fees: All transactions use zero gas fees (
maxFeePerGas: 0,maxPriorityFeePerGas: 0)
stability-mcp/
βββ apps/
β βββ wallet/ # Wallet management tools
β βββ contracts/ # Smart contract deployment
β βββ blockchain/ # Blockchain interaction tools
β βββ server/ # MCP server application
βββ libs/
β βββ types/ # Shared TypeScript types
β βββ utils/ # Shared utilities (logging, env)
βββ instructions/ # Project specifications
# Build all packages
npx tsc --build
# Build specific package
cd apps/wallet && npx tscyarn test # When tests are implemented- Create new tool in appropriate app directory
- Follow the
IMCPToolinterface pattern - Export tool in the app's
index.ts - Add app to server's
toolsEndpoints
β οΈ API keys should be kept secure - Never commit them to version controlβ οΈ Transaction validation - Always verify transaction details before signing
MIT License - see LICENSE file for details.