hedera-mcp-server

hedera-mcp/hedera-mcp-server

3.1

If you are the rightful owner of hedera-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Hedera MCP Server is a specialized server designed to facilitate communication and data exchange using the Model Context Protocol (MCP).

Hedera MCP Server

The Hedera Model Context Protocol (MCP) server provides unified blockchain services for the Hedera Hashgraph network.
It enables AI Agents, AI Assistants and Developers to interact with Hedera seamlessly via a standardized MCP interface.


šŸ“‹ Contents


šŸ”­ Overview

The Hedera MCP Server leverages the Model Context Protocol to provide comprehensive Hedera blockchain services to AI agents and apps.
It supports operations such as:

  • Querying account balances and token holdings (HTS tokens, NFTs)
  • Transferring native HBAR and HTS tokens
  • Interacting with Hedera smart contracts (Solidity contracts on Hedera network)
  • Retrieving transaction and record details
  • Managing token information and metadata

All services are exposed through a unified MCP tool and resource interface, making it easy for AI agents to discover and use Hedera blockchain functionality.


✨ Features & Tools

This document outlines the comprehensive features and tools available for interacting with EVM, Hedera, and DOVU ecosystems.


šŸ”— Blockchain Network & Block Data

  • Network Information: Get detailed information for any supported network, including both EVM (Chain ID, block number, RPC URL) and Hedera native (Mirror Node URL) data.
  • Supported Networks: Retrieve a list of all supported EVM and Hedera networks.
  • Block Exploration: Fetch blocks by their number or hash, and retrieve the latest block on the network.
  • Timestamp Queries (Hedera): Find blocks within a specific timestamp range or by a precise consensus timestamp.

šŸŖ™ Account & Token Services

  • Unified Balance Checks: Get native HBAR and token balances for any account using either its EVM address (0x...) or Hedera ID (0.0...).
  • Comprehensive Portfolio: Retrieve a complete account portfolio, including HBAR balance, all fungible tokens (with their balances), and a list of all owned NFTs.
  • Token Information: Get detailed metadata for any token, whether it's an ERC20, ERC721, or a native Hedera token (HTS).
  • NFT Management:
    • Check the balance and ownership of specific NFTs.
    • Get detailed metadata and URI for ERC721 and ERC1155 tokens.
    • List all NFTs owned by an account, with options to filter by collection.
  • Transfers:
    • HBAR: Send native HBAR between accounts.
    • HTS: Transfer native Hedera fungible tokens and NFTs.
    • ERC Standards: Transfer ERC20, ERC721, and ERC1155 tokens.
  • Token Allowances: Approve other addresses to spend your ERC20 tokens.

šŸ› ļø Address Utilities

  • Address Conversion: Convert between Hedera account IDs and EVM addresses.
  • Format Checking: Check if an address is in Hedera or EVM format.
  • Address Derivation: Derive a public EVM address from a private key.

šŸ“ Smart Contract Interactions

  • Deployment:
    • Deploy new ERC20 (fungible) and ERC721 (NFT) contracts to a specified network.
  • Verification:
    • Locally verify a deployed contract's parameters (name, symbol, supply, etc.) against the initial inputs.
    • Verify deployed ERC20 contracts on the Hashscan block explorer.
  • Read & Write Operations:
    • Read data from any smart contract by calling its functions.
    • Execute contract functions to write data to the blockchain, with support for passing arguments and value.
  • Contract Information:
    • Check if an address or ID belongs to a smart contract.
    • Get detailed information and execution results for Hedera native contracts.

šŸ“Š Blockchain Data Access & Transactions

  • Transaction History: Get a list of transactions for an account with powerful filtering options (by type, result, timestamp, etc.).
  • Activity Summary: Generate a summary of an account's recent activity, including transaction counts, success rates, and total fees.
  • Transaction Details: Fetch a specific transaction by its hash (EVM) or ID (Hedera).
  • Transaction Receipts: Retrieve detailed transaction receipts, which include logs and event data.
  • Gas Estimation: Estimate the gas cost for an EVM transaction before sending it.

šŸ“ˆ DeFi & Exchange Data (via DexScreener)

  • Pair & Token Search: Search for token pairs by name, symbol, or address.
  • Market Data: Get information on token pairs, including price, volume, and liquidity.
  • Advanced Queries: Perform advanced searches for tokens, get data for top boosted or recently updated tokens, and view trading activity on a specific chain.
  • Multi-Chain Data: Aggregate token pair information across multiple blockchains.

šŸŒ DOVU OS Integration

  • Workflow Management:
    • List, filter, and get details for all DOVU workflows and their instances.
    • Publish new workflows and workflow instances.
  • Actor & User Management:
    • Register new actors (e.g., suppliers, verifiers) in the DOVU system.
    • Log in to get an authentication token.
    • Assign users to specific workflow instances.
  • Data & Approvals:
    • Submit data to a workflow block instance.
    • Submit approval or rejection messages to a workflow block.
  • Auditing & Assets:
    • Fetch the complete audit trail for a workflow instance.
    • List all assets that have been issued from DOVU workflows.
  • Schema Management: Get and validate data against various DOVU schemas.

🌐 Supported Networks

  • Hedera Mainnet
  • Hedera Testnet

šŸ› ļø Prerequisites

  • Node.js 18.0.0 or higher
  • Optional: Bun 1.0.0 or higher (alternative runtime)

šŸ“¦ Installation

# Clone the repository
git clone https://github.com/hedera-mcp/hedera-mcp-server.git
cd hedera-mcp-server

# Install dependencies with npm
npm install

# Or with Bun
bun install

āš™ļø Server Configuration

Default configuration includes:

  • Default Network: Hedera Mainnet
  • Server Port: 3001
  • Server Host: 0.0.0.0

These values are hardcoded in the application. If you need to modify them, you can edit the following files:

  • For chain configuration: src/core/chains.ts
  • For server configuration: src/server/http-server.ts

Environment Variables

The server supports loading configuration from environment variables:

  • PRIVATE_KEY: Required private key in ECDSA Format for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the sole method for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the PRIVATE_KEY environment variable and restart the MCP server.
  • HEDERA_OPERATOR_ID: Optional operator ID for Hedera operations.
  • HEDERA_PRIVATE_KEY: Optional private key in DER Format for Hedera operations.

Create a .env file in the root directory based on the .env.example template:

# .env.example
PRIVATE_KEY=your_private_key_here
HEDERA_OPERATOR_ID=your_hedera_operator_id_here
HEDERA_PRIVATE_KEY=your_hedera_private_key_here

SECURITY WARNING: Never commit your actual private key to version control. The .env file is included in .gitignore by default.

šŸš€ Usage

Using with Claude Desktop

  1. Install the Claude Desktop.
  2. Go to Settings > Developer > Edit Config.
  3. Add the following to the mcpServers section:
{
  "mcpServers": {
    "hedera": {
      "command": "npx",
      "args": [
        "-y",
        "@hedera-mcp/hedera-mcp-server"
      ],
      "env": {
        "PRIVATE_KEY": "your_private_key_here",
        "HEDERA_OPERATOR_ID": "your_hedera_operator_id_here",
        "HEDERA_PRIVATE_KEY": "your_hedera_private_key_here"
      }
    }
  }
}
  1. Save the configuration file and restart Claude. When done, Claude will add new prompts, resources and tools. To access prompts, click "+" button in the bottom left corner. And then "Add from hedera".

From there, click "Add from hedera" to and for example, add a "my_wallet_address" prompt. Claude should invoke now get_address_from_private_key tool and return the wallet address. Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with extensive thinking option.

All tools available could be found by clicking "Search And Tools" button and then "hedera".

Running the Server Locally

Start the server using stdio (for embedding in CLI tools):

# Start the stdio server
bun start

# Development mode with auto-reload
bun dev

Or start the HTTP server with SSE for web applications:

# Start the HTTP server
bun start:http

# Development mode with auto-reload
bun dev:http

Connecting to the Server

Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.

Connecting from Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the bottom left)
  2. Scroll down to "MCP" section
  3. Click "Add new Global MCP server"
  4. In mcp.json tab add the following configuration
Option 1: Use NPM (for published versions)
{
  "mcpServers": {
    "hedera": {
      "command": "npx",
      "args": [
        "-y",
        "@hedera-mcp/hedera-mcp-server"
      ],
      "env": {
        "PRIVATE_KEY": "your_private_key_here",
        "HEDERA_OPERATOR_ID": "your_hedera_operator_id_here",
        "HEDERA_PRIVATE_KEY": "your_hedera_private_key_here"
      }
    }
  }
}

āœ… Use Option 2 if there is any error.

Option 2: Use Local Path (for development)
{
  "mcpServers": {
    "hedera": {
      "command": "npx",
      "args": [
        "-y",
        "../hedera-mcp-server" // Relative path to the hedera-mcp-server directory
      ],
      "env": {
        "PRIVATE_KEY": "your_private_key_here",
        "HEDERA_OPERATOR_ID": "your_hedera_operator_id_here",
        "HEDERA_PRIVATE_KEY": "your_hedera_private_key_here"
      }
    }
  }
}

āš ļø Use this if you're developing locally or the package is throwing some error. Make sure the hedera-mcp-server directory is cloned one level up from your project.

Example: HTTP Mode with SSE

If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:

{
  "mcpServers": {
    "hedera-mcp-sse": {
      "url": "http://localhost:3001/sse"
    }
  }
}

This connects directly to the HTTP server's SSE endpoint, which is useful for:

  • Web applications that need to connect to the MCP server from the browser
  • Environments where running local commands isn't ideal
  • Sharing a single MCP server instance among multiple users or applications

To use this configuration:

  1. Create a .cursor directory in your project root if it doesn't exist
  2. Save the above JSON as mcp.json in the .cursor directory
  3. Restart Cursor or open your project
  4. Cursor will detect the configuration and offer to enable the server(s)

Example: Using the MCP Server in Cursor

After configuring the MCP server with mcp.json, you can easily use it in Cursor. Here's an example workflow:

// blockchain-example.js
async function main() {
  try {
    // Get Hedera balance for an address
    console.log("Getting Hedera balance for 0.0.123456 or 0x123456789987654321123456789");
    
    // When using with Cursor, you can simply ask Cursor to:
    // "Check the Hedera balance of 0.0.123456 on mainnet"
    // Or "Transfer 0.1 Hedera from my wallet to 0x123456789987654321123456789"
    
    // Cursor will use the MCP server to execute these operations 
    // without requiring any additional code from you
    
    // This is the power of the MCP integration - your AI assistant
    // can directly interact with blockchain data and operations
  } catch (error) {
    console.error("Error:", error.message);
  }
}

main();
  1. With the file open in Cursor, you can ask Cursor to:

    • "Check the current Hedera balance of 0.0.123456 on mainnet"
    • "Show me the latest block on Hedera"
    • "Check if 0.0.123456 is a contract address"
    • "Transfer 0.1 Hedera from my wallet to 0.0.123456789987654321123456789"
    • "Check the Hedera transaction status of 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
  2. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.

The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.

Example: Getting a Token Balance

// Example of using the MCP client to check a token balance
const mcp = new McpClient("http://localhost:3000");

const result = await mcp.invokeTool("get-token-balance", {
  tokenAddress: "0.0.1456986", // WHBAR on Hedera
  ownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", 
  network: "hedera"
});

console.log(result);
// {
//   tokenAddress: "0.0.1456986",
//   owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
//   network: "hedera",
//   raw: "1000000000",
//   formatted: "1000",
//   symbol: "WHBAR",
//   decimals: 8
// }

šŸ“š API Reference

Network & Blockchain Tools
Tool NameDescriptionKey Parameters
get_chain_infoGet information about a network, including EVM and Hedera data.network
get_supported_networksGet a list of supported EVM and Hedera networks.—
get_block_by_numberGet a block by its number.blockNumber, network
get_block_by_hashGet a block by its hash.blockHash, network
get_latest_blockGet the latest block from the network.network
get_block_numberGet the current block number.network
get_blocks_by_timestampGet blocks within a Hedera timestamp range.fromTimestamp, toTimestamp, limit, network
get_block_by_timestampGet a block by a specific Hedera consensus timestamp.timestamp, network
Account & Transaction Tools
Tool NameDescriptionKey Parameters
get_balanceGet the native token (HBAR) balance for an address (EVM or Hedera format).address, network, preferMirrorNode, timeout
get_account_portfolioGet a complete account portfolio (HBAR, tokens, NFTs).addressOrId, network, includeNFTs, nftLimit
get_account_transactionsGet transactions for a Hedera account with filtering.accountId, limit, order, timestamp, transactiontype, result, type, network
get_account_transaction_countGet the total number of transactions for a Hedera account.accountId, transactiontype, result, type, timestamp, network
get_account_activity_summaryGet a summary of recent account activity.accountId, days, network
get_transactionGet a transaction by its hash (EVM) or ID (Hedera).identifier, network
get_transaction_receiptGet a transaction receipt by its hash (EVM) or ID (Hedera).identifier, network
check_address_formatCheck the format of an address (EVM or Hedera).address
convert_address_formatConvert between Hedera ID and EVM address formats.identifier, network
get_address_from_private_keyGet the EVM address derived from a private key.—
Token Tools (Fungible, NFT, HTS, ERC)
Tool NameDescriptionKey Parameters
deploy_erc20Deploys a new ERC20 token.name, symbol, initialSupply, decimals, network
deploy_erc721Deploys a new ERC721 (NFT) token.name, symbol, baseURI_, network
get_token_balanceGet token balance (ERC20 or Hedera) for an address.tokenAddressOrId, ownerAddressOrId, network, preferMirrorNode
get_token_infoGet comprehensive information about an ERC20 or Hedera token.tokenAddressOrId, network
get_account_tokensGet all tokens owned by an account.addressOrId, network
get_account_nftsGet NFTs owned by an account.addressOrId, network, tokenId, limit, order
check_nft_ownershipCheck if an address owns a specific NFT.tokenAddressOrId, tokenId, ownerAddressOrId, network
get_nft_balanceGet the total number of NFTs from a collection owned by an address.tokenAddressOrId, ownerAddressOrId, network
get_nft_infoGet detailed information about a specific NFT (ERC721).tokenAddress, tokenId, network
get_erc1155_balanceGet the balance of a specific ERC1155 token ID.tokenAddress, tokenId, ownerAddress, network
get_erc1155_token_uriGet the metadata URI for an ERC1155 token.tokenAddress, tokenId, network
transfer_hbarTransfer native HBAR tokens.to, amount, network
transfer_erc20Transfer ERC20 tokens.tokenAddress, toAddress, amount, network
transfer_nftTransfer an NFT (ERC721).tokenAddress, tokenId, toAddress, network
transfer_erc1155Transfer ERC1155 tokens.tokenAddress, tokenId, amount, toAddress, network
hts_token_transferTransfer a Hedera (HTS) fungible token.receiver, tokenId, amount, network
hts_nft_transferTransfer a Hedera (HTS) NFT.receiver, tokenId, serialNumber, network
approve_token_spendingApprove an address to spend your ERC20 tokens.tokenAddress, spenderAddress, amount, network
Smart Contract Tools
Tool NameDescriptionKey Parameters
verify_erc20_contract_locallyVerifies a deployed ERC20 contract's parameters.contractAddress, name, symbol, initialSupply, decimals, network
verify_erc20_contractVerifies a deployed ERC20 contract on a block explorer.contractAddress, contractName, network
verify_erc721_contract_locallyVerifies a deployed ERC721 contract's parameters.contractAddress, name, symbol, baseURI_, network
read_contractRead data from a smart contract (EVM or Hedera).contractAddress, abi, functionName, args, network
write_contractWrite data to a smart contract (EVM or Hedera).contractAddress, abi, functionName, args, gas, payableAmount, network
is_contractCheck if an address or ID is a smart contract.addressOrId, network
get_contract_infoGet detailed information about a Hedera native contract.contractId, network
get_contract_resultsGet execution results for a Hedera native contract.contractId, limit, order, network
estimate_gasEstimate the gas cost for an EVM transaction.to, value, data, network
DeFi (DexScreener) Tools
Tool NameDescriptionKey Parameters
dex_search_pairsSearch for token pairs by token name, symbol, or address.query
dex_get_token_pairsGet all pairs for specific token addresses.tokenAddresses
dex_get_pairs_by_addressGet pair information by a specific pair address.chainId, pairAddress
dex_get_token_profileGet a token's profile information.chainId, tokenAddress
dex_get_latest_token_profilesGet recently updated token profiles.—
dex_get_top_boosted_tokensGet top boosted tokens on DexScreener.—
dex_get_orders_by_chainGet trading orders/activity by chain.chainId, tokenAddress
DOVU OS Tools
Tool NameDescriptionKey Parameters
get_dovu_workflowsGet a list of workflows from DOVU.filter
publish_dovu_workflowPublish a workflow on DOVU.payload, authToken
get_dovu_workflow_owner_instance_detailsGet details for a specific workflow owner instance.workflowInstanceId
submit_data_workflow_block_instanceSubmit JSON data to a workflow block instance.workflowBlockInstanceId, data, token
submit_approval_workflow_block_instanceSubmit an approval or rejection to a workflow block.workflowBlockInstanceId, approve, message, token
register_dovu_actorRegister a new actor in the DOVU OS.name, email, password, password_confirmation, role
dovu_loginLogin to DOVU OS to get an authentication token.email, password
get_dovu_audit_trailGet the audit trail of a specific workflow instance.workflowInstanceId

šŸ”— Resources

The server exposes blockchain data through the following MCP resource URIs.

Blockchain Resources
Resource URI PatternDescription
hedera://{network}/account/{accountId}Account info and balances
hedera://{network}/token/{tokenId}Token info and metadata
hedera://{network}/token/{tokenId}/balanceOf/{accountId}Token balance of account
hedera://{network}/transaction/{transactionId}Transaction record and receipt

šŸ”’ Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

šŸ“ Project Structure

hedera-mcp-server/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ index.ts            # Main stdio server entry point
│   ā”œā”€ā”€ server/             # Server-related files
│   │   ā”œā”€ā”€ http-server.ts     # HTTP server with SSE
│   │   └── server.ts          # General server setup
│   ā”œā”€ā”€ core/
│   │   ā”œā”€ā”€ chains.ts          # Chain definitions and utilities
│   │   ā”œā”€ā”€ config.ts          # MCP configuration
│   │   ā”œā”€ā”€ resources.ts       # MCP resources implementation
│   │   ā”œā”€ā”€ prompts.ts         # MCP prompts implementation
│   │   └── services/          # Core blockchain services
│   │   │    ā”œā”€ā”€ index.ts          # Operation exports
│   │   │    ā”œā”€ā”€ balance.ts        # Balance services
│   │   │    ā”œā”€ā”€ transfer.ts       # Token transfer services
│   │   │    ā”œā”€ā”€ utils.ts          # Utility functions
│   │   │    ā”œā”€ā”€ tokens.ts         # Token metadata services
│   │   │    ā”œā”€ā”€ contracts.ts      # Contract interactions
│   │   │    ā”œā”€ā”€ transactions.ts   # Transaction services
│   │   │    └── blocks.ts         # Block services
│   │   │    └── clients.ts        # RPC client utilities
│   │   ā”œā”€ā”€ tools/             # Tools services
│   │        ā”œā”€ā”€ index.ts          # Tools exports
│   │        ā”œā”€ā”€ network.ts        # Network and Block Tools
│   │        ā”œā”€ā”€ token.ts          # Token Tools
│   │        ā”œā”€ā”€ transaction.ts    # Transaction Tools
│   │        ā”œā”€ā”€ deployERC20.ts    # Deploy ERC20 Tools
│   │        ā”œā”€ā”€ deployERC721.ts   # Deploy ERC721 Tools
│   │        ā”œā”€ā”€ dexscreener.ts    # Dexscreener Tools
│   │        └── dovu.ts           # Dovu OS Tools
ā”œā”€ā”€ package.json
ā”œā”€ā”€ tsconfig.json
└── README.md

šŸ› ļø Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Add and export new tools in src/core/tools/
  3. Register new resources in src/core/resources.ts
  4. To change server configuration, edit the hardcoded values in src/server/http-server.ts

šŸ“„ License

This project is licensed under the terms of the .