Neo N3 MCP Server

by r3e-network
Integrations
  • Enables containerized deployment of the Neo N3 MCP server, supporting isolated and consistent execution environments across different platforms.

  • Hosts the source code repository for the Neo N3 MCP server, enabling version control and collaboration on the codebase.

  • Supports comprehensive testing of the Neo N3 MCP server functionality, ensuring reliability of blockchain interactions.

Neo N3 Model Context Protocol (MCP) v1.4.0

The Neo N3 Model Context Protocol (MCP) provides a standardized interface for AI agents and applications to interact with the Neo N3 blockchain. This server implementation aims for simplicity and ease of use, running directly via npx without requiring manual environment configuration for standard usage.

Adding the MCP to a Client (e.g., VS Code)

Configure your client to use the standard I/O server via npx:

Option A: VS Code User Settings (JSON)

Add the following to your User Settings JSON (Ctrl+Shift+P > Preferences: Open User Settings (JSON)):

{ "mcp": { "servers": { "neo-n3": { // You can choose any name "command": "npx", "args": [ "-y", // Auto-confirm npx installation/update "@r3e/neo-n3-mcp" ] } } } }

Option B: Workspace Configuration (.vscode/mcp.json)

Create a file named mcp.json inside the .vscode directory:

{ "servers": { "neo-n3": { // You can choose any name "command": "npx", "args": [ "-y", // Auto-confirm npx installation/update "@r3e/neo-n3-mcp" ] } } }

Option C: Other Clients (e.g., Cursor)

Follow your client's instructions for adding an MCP server using a command. Provide the command npx and the arguments ["-y", "@r3e/neo-n3-mcp"].

Available Tools

For detailed parameters and examples, please refer to the API.md documentation.

Configuration & Network

ToolDescriptionKey Parameters
get_network_modeGet the currently configured network modeNone
set_network_modeSet the active network mode for subsequent callsmode: "mainnet_only", "testnet_only", or "both"

Blockchain Information

ToolDescriptionKey Parameters
get_blockchain_infoGet current height and general network infonetwork
get_block_countGet the current block heightnetwork
get_blockGet block details by hash or heightnetwork, hashOrHeight
get_transactionGet transaction details by transaction IDnetwork, txid
check_transaction_statusCheck if a transaction is confirmednetwork, txid

Wallet & Account Management

ToolDescriptionKey Parameters
create_walletCreate a new encrypted wallet filepassword
import_walletImport existing wallet from WIF/private keykey, password
get_balanceGet token balances for an addressnetwork, address

Asset Transfers

ToolDescriptionKey Parameters
transfer_assetsSend NEO, GAS, or other NEP-17 tokensnetwork, fromWIF, toAddress, asset, amount, confirm
estimate_transfer_feesEstimate network and system fees for a transfernetwork, fromAddress, toAddress, asset, amount

Smart Contract Interaction

ToolDescriptionKey Parameters
list_famous_contractsList well-known contracts supported by the servernetwork
get_contract_infoGet details (hash, methods) of a famous contractnetwork, contractName
invoke_contract (replaces invoke_read/write)Invoke a smart contract method (read or write)network, scriptHash, operation, args, fromWIF (for write), confirm (for write)

NeoFS (Decentralized Storage)

ToolDescriptionKey Parameters
neofs_create_containerCreate a NeoFS storage containernetwork, fromWIF, ownerId, rules, confirm
neofs_get_containersList containers owned by an IDnetwork, ownerId

NeoBurger (Staking Service)

ToolDescriptionKey Parameters
neoburger_depositDeposit NEO to receive bNEOnetwork, fromWIF, confirm
neoburger_withdrawWithdraw NEO by returning bNEOnetwork, fromWIF, amount, confirm

Example Requests

Get Blockchain Information

Request:

{ "name": "get_blockchain_info", "arguments": { "network": "mainnet" } }

Response:

{ "result": { "height": 3456789, "network": "mainnet" } }

Transfer Assets

Request:

{ "name": "transfer_assets", "arguments": { "network": "testnet", "fromWIF": "YourSenderWalletWIF", "toAddress": "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj", "asset": "NEO", "amount": "1", "confirm": true } }

Response:

{ "result": { "txid": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "address": "NVbGwMfRQVudQCcChhCFwQRwSxr5tYEqQs", "network": "testnet" } }

Error Handling

The MCP server returns standardized error responses:

{ "error": { "code": "INVALID_PARAMETER", "message": "Invalid network parameter. Must be 'mainnet' or 'testnet'." } }

Common error codes:

  • INVALID_PARAMETER: Missing or invalid parameter
  • NETWORK_ERROR: Error connecting to Neo N3 node
  • BLOCKCHAIN_ERROR: Error from the Neo N3 blockchain
  • WALLET_ERROR: Error with wallet operations
  • CONTRACT_ERROR: Error with smart contract operations
  • UNAUTHORIZED: Operation not permitted
  • INTERNAL_ERROR: Unexpected server error

Security Best Practices

  • WIF Handling: Be extremely cautious when providing Wallet Import Format (WIF) keys. Ensure the environment where the MCP server runs and the communication channel are secure. Consider running the server locally or within a trusted network. Avoid exposing the server publicly without robust authentication and transport security (HTTPS).
  • Store wallet files securely if using file-based approaches (though the current API seems WIF-based).
  • Use confirm: true for all state-changing operations (transfers, contract invocations) to ensure the transaction is processed by the network.
  • Store wallet files securely with strong passwords
  • Use testnet for development and testing
  • Keep your Neo N3 MCP server updated to the latest version

HTTP Server

In addition to the MCP server, this package also provides an HTTP server that exposes the Neo N3 functionality through a RESTful API. The HTTP server is started automatically when you run the MCP server and listens on port 3002 by default.

HTTP Endpoints

EndpointMethodDescription
/api/blockchain/infoGETGet blockchain information
/api/blockchain/heightGETGet the current block height
/api/blocks/:heightGETGet block details by height
/api/transactions/:txidGETGet transaction details by transaction ID
/api/accounts/:address/balanceGETGet token balances for an address
/api/walletsPOSTCreate a new wallet
/api/wallets/:addressGETGet wallet information
/api/wallets/importPOSTImport a wallet from WIF or private key
/api/network/modeGETGet the current network mode
/api/contracts/:name/invokePOSTInvoke a smart contract method
/api/contracts/deployPOSTDeploy a new smart contract

Example HTTP Requests

# Get blockchain information curl http://localhost:3002/api/blockchain/info # Get the current block height curl http://localhost:3002/api/blockchain/height # Get token balances for an address curl http://localhost:3002/api/accounts/NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj/balance # Create a new wallet curl -X POST -H "Content-Type: application/json" -d '{"password":"your-password"}' http://localhost:3002/api/wallets # Get the current network mode curl http://localhost:3002/api/network/mode # Deploy a smart contract curl -X POST -H "Content-Type: application/json" -d '{ "wif": "your-private-key-wif", "script": "base64-encoded-contract-script", "manifest": { "name": "MyContract", "groups": [], "features": {}, "abi": { "methods": [ { "name": "myMethod", "parameters": [], "returnType": "Boolean", "offset": 0 } ], "events": [] }, "permissions": [ { "contract": "*", "methods": "*" } ], "trusts": [], "supportedStandards": [] } }' http://localhost:3002/api/contracts/deploy

Benefits of the HTTP Server

  • Accessibility: Provides access to Neo N3 blockchain functionality for applications that don't support the MCP protocol
  • Simplicity: Simple RESTful API that can be used with any HTTP client
  • Compatibility: Works with existing web applications and frameworks
  • Testing: Easier to test and debug than the MCP protocol

Testing

This package includes integration tests to verify the functionality of both the MCP server and the HTTP server.

Running Tests

# Build the project npm run build # Run the core functionality tests npm run test:core # Run the HTTP integration tests npm run test:http # Run the MCP integration tests npm run test:integration

Resources

License

This project is licensed under the MIT License - see the LICENSE file for details.

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

An MCP server that provides seamless integration with the Neo N3 blockchain, allowing Claude to interact with blockchain data, manage wallets, transfer assets, and invoke smart contracts.

  1. Adding the MCP to a Client (e.g., VS Code)
    1. Available Tools
      1. Configuration & Network
      2. Blockchain Information
      3. Wallet & Account Management
      4. Asset Transfers
      5. Smart Contract Interaction
      6. NeoFS (Decentralized Storage)
      7. NeoBurger (Staking Service)
    2. Example Requests
      1. Get Blockchain Information
      2. Transfer Assets
    3. Error Handling
      1. Security Best Practices
        1. HTTP Server
          1. HTTP Endpoints
          2. Example HTTP Requests
          3. Benefits of the HTTP Server
        2. Testing
          1. Running Tests
        3. Resources
          1. License

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              An MCP server that allows accessing and managing ledger files through Claude by providing account listing, balance checking, and transaction register viewing capabilities.
              Last updated -
              1
              Python
              GPL 3.0
              • Apple
            • A
              security
              F
              license
              A
              quality
              An MCP server that connects Claude to BrianKnows' blockchain knowledge base, allowing users to search for blockchain/DeFi information and interact with a specialized agent across multiple knowledge bases.
              Last updated -
              3
              JavaScript
            • -
              security
              F
              license
              -
              quality
              An MCP server that connects Claude for Desktop with blockchain functionality, allowing users to check balances and send tokens on EVM and Solana chains through natural language interactions.
              Last updated -
              TypeScript
              • Apple
            • -
              security
              A
              license
              -
              quality
              A meta-server that allows Claude to install other MCP servers from npm or PyPi, enabling easy expansion of Claude's capabilities with external tools.
              Last updated -
              4,321
              1
              MIT License
              • Apple

            View all related MCP servers

            ID: u2xsj86nbp