Skip to main content
Glama
SDK_INTEGRATION_COMPLETE.mdβ€’6.99 kB
# βœ… Zetrix SDK Integration Complete! The Zetrix MCP server now includes full integration with the official **zetrix-sdk-nodejs**! ## 🎯 What Was Added ### 6 New SDK Tools 1. **zetrix_sdk_create_account** - Create new Zetrix accounts - Returns address, private key, and public key - Perfect for onboarding new users 2. **zetrix_sdk_get_balance** - Get account balance using official SDK - More reliable than HTTP API for some operations 3. **zetrix_sdk_is_activated** - Check if an account exists and is activated - Returns true/false activation status 4. **zetrix_sdk_get_nonce** - Get account transaction nonce - Required for transaction sequencing 5. **zetrix_sdk_call_contract** - Query smart contracts (read-only) - No gas required, no state changes - Perfect for reading contract data 6. **zetrix_sdk_invoke_contract** - Invoke smart contracts with transactions - Full signing and submission workflow - Automatically handles: - Nonce retrieval - Fee estimation - Transaction blob building - Signing with private key - Blockchain submission ## πŸ“¦ Package Information **Official SDK:** [zetrix-sdk-nodejs](https://github.com/Zetrix-Chain/zetrix-sdk-nodejs) **Version:** 1.0.2 **License:** Apache-2.0 ## πŸ› οΈ Technical Implementation ### Files Modified/Created 1. **src/zetrix-sdk.ts** (NEW) - Complete wrapper around zetrix-sdk-nodejs - TypeScript interfaces for type safety - Error handling for all SDK methods - Lazy SDK initialization - Network-aware (mainnet/testnet/custom) 2. **src/zetrix-sdk-nodejs.d.ts** (NEW) - TypeScript type declarations - Allows proper TypeScript compilation 3. **src/index.ts** (MODIFIED) - Added 6 SDK tool definitions - Implemented handlers for all SDK operations - Integrated with existing MCP server 4. **README.md** (UPDATED) - Added "Official SDK Operations" section - Documentation for all 6 SDK tools 5. **EXAMPLES.md** (UPDATED) - Complete SDK usage examples - Natural language query examples - Best practices for SDK operations - Complete workflow examples 6. **package.json** (UPDATED) - Added zetrix-sdk-nodejs dependency ## 🎨 Features ### Automatic Network Detection The SDK automatically connects to the correct network based on your configuration: ```json { "env": { "ZETRIX_NETWORK": "mainnet" // or "testnet" } } ``` Or use a custom RPC URL: ```json { "env": { "ZETRIX_RPC_URL": "https://custom-node.zetrix.com" } } ``` ### Smart Contract Support The SDK provides two modes for smart contracts: **Query Mode (zetrix_sdk_call_contract):** - Read-only operations - No gas required - No state changes - Fast responses **Invoke Mode (zetrix_sdk_invoke_contract):** - Write operations - Requires gas payment - Changes contract state - Full transaction lifecycle ### Error Handling All SDK operations include comprehensive error handling: - SDK initialization errors - Network connection errors - Transaction errors - Invalid parameter errors - Blockchain errors ## πŸ“Š Total Tool Count The Zetrix MCP server now provides **30 tools**: - **6** Account operations (HTTP) - **3** Block & Ledger operations (HTTP) - **6** Transaction operations (HTTP) - **1** Contract operations (HTTP) - **2** Utility operations (HTTP) - **5** WebSocket operations (Real-time) - **6** Official SDK operations (NEW!) - **1** Health check ## πŸš€ Usage Examples ### Create Account **Ask Claude:** ``` Create a new Zetrix account for me ``` **Claude uses:** `zetrix_sdk_create_account` ### Check Balance **Ask Claude:** ``` Use the SDK to get the balance for address ZTX3Ta7d... ``` **Claude uses:** `zetrix_sdk_get_balance` ### Invoke Smart Contract **Ask Claude:** ``` Invoke contract ZTX3Uaci... with my private key to transfer 100 tokens ``` **Claude uses:** `zetrix_sdk_invoke_contract` See [EXAMPLES.md](EXAMPLES.md#official-sdk-operations) for complete usage examples! ## βœ… What's Working - [x] SDK installation and dependency management - [x] TypeScript type declarations - [x] All 6 SDK methods implemented - [x] Network selection (mainnet/testnet/custom) - [x] Error handling and validation - [x] MCP tool integration - [x] Documentation updated - [x] Examples added - [x] Project builds successfully - [x] **All tests passing (100% success rate)** ## πŸ§ͺ Testing The SDK integration has been tested and verified: ```bash # Run SDK tests npm run test:sdk # Test with specific network npm run test:sdk:mainnet npm run test:sdk:testnet ``` **Test Results:** - βœ… Account creation - PASSED - βœ… Account activation check - PASSED - βœ… Nonce retrieval - PASSED - βœ… Balance query - PASSED - βœ… Error handling - PASSED - **Success Rate: 100%** To test in Claude Desktop: ```bash # Build the project npm run build # Configure Claude Desktop with your network npm run setup # Restart Claude Desktop # Ask Claude: # "Create a new Zetrix account using the SDK" ``` ## πŸ”§ Configuration The SDK uses the same network configuration as the rest of the MCP server: **Environment Variables:** - `ZETRIX_NETWORK` - Set to "mainnet" or "testnet" - `ZETRIX_RPC_URL` - Override with custom RPC URL **SDK connects to:** - Mainnet: `node.zetrix.com` - Testnet: `test-node.zetrix.com` ## πŸ“š SDK Method Details ### Account Creation ```typescript async createAccount(): Promise<{ address: string; privateKey: string; publicKey: string; }> ``` ### Balance Query ```typescript async getBalance(address: string): Promise<{ address: string; balance: string; }> ``` ### Activation Check ```typescript async isAccountActivated(address: string): Promise<boolean> ``` ### Nonce Retrieval ```typescript async getNonce(address: string): Promise<number> ``` ### Contract Call (Query) ```typescript async callContract(params: { contractAddress: string; optType?: number; input?: string; sourceAddress?: string; }): Promise<any> ``` ### Contract Invoke (Transaction) ```typescript async invokeContract(params: { sourceAddress: string; privateKey: string; contractAddress: string; amount: string; input: string; metadata?: string; }): Promise<any> ``` ## πŸŽ‰ Summary The Zetrix MCP server now provides **complete blockchain interaction** through: 1. **HTTP API** - All 13 Zetrix HTTP endpoints 2. **WebSocket API** - Real-time blockchain updates 3. **Official SDK** - Advanced operations with signing support You can now: - Create and manage accounts - Query and invoke smart contracts - Submit signed transactions - Monitor blockchain in real-time - All through natural language with Claude! ## πŸ†˜ Support For issues or questions: - Check [EXAMPLES.md](EXAMPLES.md) for usage examples - Review [README.md](README.md) for configuration - See [QUICKSTART.md](QUICKSTART.md) for setup help - Visit [Zetrix Documentation](https://docs.zetrix.com/) --- **Happy exploring the Zetrix blockchain with the official SDK!** πŸš€

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Zetrix-Chain/zetrix-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server