Getting Started
Welcome to the Neo N3 MCP Server user guide. This guide will help you get started with using the Neo N3 Model Context Protocol (MCP) server to integrate Neo N3 blockchain capabilities into your AI assistants.
Installation
To install the Neo N3 MCP server, you need Node.js (version 14 or higher). Run the following command:
npm install -g @r3e/neo-n3-mcp
Starting the Server
You can start the server manually using:
npx @r3e/neo-n3-mcp
However, for AI integration, you will typically configure the AI platform to start the server automatically, as described in the AI Integration section below.
AI Integration
This section explains how to integrate the Neo N3 MCP server with various AI assistants and platforms, allowing them to interact with the Neo N3 blockchain.
What is the Model Context Protocol (MCP)?
The Model Context Protocol (MCP) is a standardized way for AI assistants to interact with external tools and services. By implementing MCP, our server allows AI models to directly access Neo N3 blockchain functionality.
Claude Integration
To integrate with Claude, you need to configure the Claude Desktop app or API to use the Neo N3 MCP server:
Claude Desktop Setup
Add the following to your claude_desktop_config.json
file:
{
"mcpServers": {
"neo-n3": {
"command": "npx",
"args": [
"-y",
"@r3e/neo-n3-mcp"
]
}
}
}
Claude API Setup
When making API calls to Claude, include the Neo N3 MCP tool configuration in your request:
{
"model": "claude-3-opus-20240229",
"messages": [
{"role": "user", "content": "Check the Neo N3 blockchain status"}
],
"tools": [
{
"name": "neo-n3",
"description": "Neo N3 blockchain access through MCP protocol",
"serverUrl": "http://localhost:8080"
}
]
}
Cursor Integration
Cursor is an AI-powered code editor that supports MCP. To integrate the Neo N3 MCP server with Cursor:
Steps to Configure
- Open Cursor preferences
- Navigate to the AI Tools or Integrations section
- Add a new custom tool with the following configuration:
{
"name": "neo-n3",
"command": "npx",
"args": ["-y", "@r3e/neo-n3-mcp"],
"description": "Neo N3 blockchain access through MCP protocol"
}
After configuration, you can ask Cursor AI to interact with the Neo N3 blockchain directly in your coding workflow.
Windsurf Integration
Windsurf browser provides AI assistance with tool use capabilities. To integrate the Neo N3 MCP server:
Configuration Steps
- Open Windsurf Settings
- Go to AI & Tools section
- Add a new custom tool with the following details:
{
"toolName": "neo-n3",
"executionCommand": "npx -y @r3e/neo-n3-mcp",
"description": "Provides access to Neo N3 blockchain information and operations"
}
Once configured, you can ask Windsurf's AI assistant questions about Neo N3 blockchain or request operations.
Custom AI Setup
For other AI platforms that support the Model Context Protocol, you can use the following general integration pattern:
1. Start the MCP Server
Ensure the Neo N3 MCP server is running on your system:
npx @r3e/neo-n3-mcp
2. Configure the AI Platform
Most MCP-compatible platforms need the following information:
- Server URL: http://localhost:8080 (default)
- Tool Name: neo-n3
- Description: Neo N3 blockchain access through MCP protocol
3. Test the Integration
Test the integration by asking your AI about Neo N3 blockchain information:
"What is the current block height on Neo N3 mainnet?"
AI Chat Examples
This section provides examples of how to interact with the Neo N3 blockchain through AI chat interfaces after you've integrated the MCP server.
Blockchain Queries
Note: The example above uses the get_block_count
operation which calls the Neo N3 RPC command getblockcount
to retrieve the current block height.
Wallet Operations
Contract Interactions
Blockchain Interaction
The Neo N3 MCP Server provides various tools for interacting with the Neo N3 blockchain.
Querying the Blockchain
You can query the blockchain for various information, such as block details, transaction details, and asset balances.
Getting Blockchain Information
const blockchainInfo = await client.callTool('get_blockchain_info', {
network: 'mainnet'
});
console.log(blockchainInfo);
Getting Block Height
const blockCount = await client.callTool('get_block_count', {
network: 'mainnet'
});
console.log(`Current block height: ${blockCount.count}`);
Getting Block Details
// Get block by height
const blockByHeight = await client.callTool('get_block', {
height: 12345,
network: 'mainnet'
});
console.log(blockByHeight);
// Get block by hash
const blockByHash = await client.callTool('get_block', {
hash: '0xa4e5a35ed65e7a77d6d9af5321c159a23c384bf1a4045e411b03d6bd34dfdf12',
network: 'mainnet'
});
console.log(blockByHash);
Getting Transaction Details
const transaction = await client.callTool('get_transaction', {
hash: '0x7e94b3a69ca6c227a4f6d4012bab999acb11ee504883cb9abf976dcd8b5f2adc',
network: 'mainnet'
});
console.log(transaction);
Getting Asset Balance
const balance = await client.callTool('get_balance', {
address: 'NXV7ZhHaLY2GNjp6R1AYBV9FqrVnGLfQcz',
asset: 'NEO', // Can be 'NEO', 'GAS', or a script hash
network: 'mainnet'
});
console.log(balance);
Managing Wallets
The Neo N3 MCP Server provides tools for managing Neo N3 wallets.
Creating a Wallet
const wallet = await client.callTool('create_wallet', {
password: 'your-password',
path: '/path/to/save/wallet.json', // Optional, if not provided, a temporary path will be used
name: 'My Wallet' // Optional
});
console.log(wallet);
Importing a Wallet
// Import from WIF
const walletFromWif = await client.callTool('import_wallet', {
wif: 'KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr',
password: 'your-password',
path: '/path/to/save/wallet.json', // Optional
name: 'My Imported Wallet' // Optional
});
console.log(walletFromWif);
// Import from NEP-6 wallet file
const walletFromFile = await client.callTool('import_wallet', {
path: '/path/to/existing/wallet.json',
password: 'your-password'
});
console.log(walletFromFile);
Exporting a Wallet
// Export to WIF
const wif = await client.callTool('export_wallet', {
path: '/path/to/wallet.json',
password: 'your-password',
format: 'wif'
});
console.log(wif);
// Export to NEP-6
const nep6 = await client.callTool('export_wallet', {
path: '/path/to/wallet.json',
password: 'your-password',
format: 'nep6',
outputPath: '/path/to/output/wallet.json' // Optional
});
console.log(nep6);
Getting Wallet Information
const walletInfo = await client.callTool('get_wallet_info', {
path: '/path/to/wallet.json',
password: 'your-password'
});
console.log(walletInfo);
Transferring Assets
You can transfer assets between addresses using the transfer_assets
tool.
const transfer = await client.callTool('transfer_assets', {
fromPath: '/path/to/wallet.json',
fromPassword: 'your-password',
to: 'NXV7ZhHaLY2GNjp6R1AYBV9FqrVnGLfQcz',
asset: 'NEO', // Can be 'NEO', 'GAS', or a script hash
amount: '1',
network: 'mainnet',
confirm: true // Set to true to confirm the transaction
});
console.log(transfer);
Contract Interaction
The Neo N3 MCP Server provides tools for interacting with famous Neo N3 contracts.
Listing Famous Contracts
const contracts = await client.callTool('list_famous_contracts', {
network: 'mainnet'
});
console.log(contracts);
Getting Contract Information
const contractInfo = await client.callTool('get_contract_info', {
contractName: 'neoburger',
network: 'mainnet'
});
console.log(contractInfo);
Using NeoFS
NeoFS is a decentralized storage system on the Neo N3 blockchain.
Creating a Container
const container = await client.callTool('neofs_create_container', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
ownerId: 'your-owner-id',
rules: [
{ key: 'Placement/REP', value: '3' },
{ key: 'Placement/CBF', value: '3' }
],
network: 'mainnet'
});
console.log(container);
Getting Containers
const containers = await client.callTool('neofs_get_containers', {
ownerId: 'your-owner-id',
network: 'mainnet'
});
console.log(containers);
Using NeoBurger
NeoBurger is a Neo N3 staking service.
Depositing NEO
const deposit = await client.callTool('neoburger_deposit', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
network: 'mainnet'
});
console.log(deposit);
Withdrawing NEO
const withdraw = await client.callTool('neoburger_withdraw', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
amount: '1',
network: 'mainnet'
});
console.log(withdraw);
Getting Balance
const balance = await client.callTool('neoburger_get_balance', {
address: 'NXV7ZhHaLY2GNjp6R1AYBV9FqrVnGLfQcz',
network: 'mainnet'
});
console.log(balance);
Claiming GAS
const claim = await client.callTool('neoburger_claim_gas', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
network: 'mainnet'
});
console.log(claim);
Using Flamingo
Flamingo is a Neo N3 DeFi platform.
Staking FLM
const stake = await client.callTool('flamingo_stake', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
amount: '100',
network: 'mainnet'
});
console.log(stake);
Unstaking FLM
const unstake = await client.callTool('flamingo_unstake', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
amount: '100',
network: 'mainnet'
});
console.log(unstake);
Getting FLM Balance
const balance = await client.callTool('flamingo_get_balance', {
address: 'NXV7ZhHaLY2GNjp6R1AYBV9FqrVnGLfQcz',
network: 'mainnet'
});
console.log(balance);
Using NeoCompound
NeoCompound is an automatic yield farming protocol on Neo N3.
Depositing Assets
const deposit = await client.callTool('neocompound_deposit', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
assetId: '0xd2a4cff31913016155e38e474a2c06d08be276cf',
amount: '100',
network: 'mainnet'
});
console.log(deposit);
Withdrawing Assets
const withdraw = await client.callTool('neocompound_withdraw', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
assetId: '0xd2a4cff31913016155e38e474a2c06d08be276cf',
amount: '100',
network: 'mainnet'
});
console.log(withdraw);
Getting Balance
const balance = await client.callTool('neocompound_get_balance', {
address: 'NXV7ZhHaLY2GNjp6R1AYBV9FqrVnGLfQcz',
assetId: '0xd2a4cff31913016155e38e474a2c06d08be276cf',
network: 'mainnet'
});
console.log(balance);
Using GhostMarket
GhostMarket is an NFT marketplace on Neo N3.
Creating an NFT
const nft = await client.callTool('ghostmarket_create_nft', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
tokenURI: 'https://example.com/nft/metadata.json',
properties: [
{ key: "artist", value: "ExampleArtist" },
{ key: "edition", value: "1/1" }
],
network: 'mainnet'
});
console.log(nft);
Listing an NFT for Sale
const listing = await client.callTool('ghostmarket_list_nft', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
tokenId: 1,
price: '100',
paymentToken: '0xd2a4cff31913016155e38e474a2c06d08be276cf',
network: 'mainnet'
});
console.log(listing);
Buying an NFT
const purchase = await client.callTool('ghostmarket_buy_nft', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
tokenId: 1,
network: 'mainnet'
});
console.log(purchase);
Getting Token Information
const tokenInfo = await client.callTool('ghostmarket_get_token_info', {
tokenId: 1,
network: 'mainnet'
});
console.log(tokenInfo);
Advanced Usage
This section covers advanced usage patterns for the Neo N3 MCP Server.
Batch Operations
You can perform multiple operations in sequence to achieve more complex workflows. Here's an example of a batch operation that creates a wallet, gets the balance, and transfers assets:
// Create a wallet
const wallet = await client.callTool('create_wallet', {
password: 'your-password',
path: '/path/to/save/wallet.json'
});
// Get the balance
const balance = await client.callTool('get_balance', {
address: wallet.address,
asset: 'NEO',
network: 'mainnet'
});
// Transfer assets if balance is sufficient
if (parseFloat(balance.amount) > 1) {
const transfer = await client.callTool('transfer_assets', {
fromPath: '/path/to/save/wallet.json',
fromPassword: 'your-password',
to: 'NXV7ZhHaLY2GNjp6R1AYBV9FqrVnGLfQcz',
asset: 'NEO',
amount: '1',
network: 'mainnet',
confirm: true
});
console.log(transfer);
}
Custom RPC Providers
You can use custom RPC providers for the Neo N3 blockchain. This is useful if you're running your own Neo N3 node or want to use a specific RPC provider.
For configuration via environment variables:
NEO_MAINNET_RPC_URL=https://mainnet1.neo.coz.io:443 NEO_TESTNET_RPC_URL=https://testnet1.neo.coz.io:443 npx neo-n3-mcp
For configuration via config file:
// ~/.neo-n3-mcp/config.json
{
"port": 3000,
"network": "mainnet",
"mainnetRpcUrl": "https://mainnet1.neo.coz.io:443",
"testnetRpcUrl": "https://testnet1.neo.coz.io:443",
"walletPath": "./wallets"
}
Error Handling
The Neo N3 MCP Server provides detailed error messages that can help you troubleshoot issues. Here's an example of error handling:
try {
const result = await client.callTool('get_blockchain_info', {
network: 'invalid-network' // This will cause an error
});
console.log(result);
} catch (error) {
console.error(`Error: ${error.message}`);
// The error object may contain additional information
if (error.data) {
console.error(`Error code: ${error.data.code}`);
console.error(`Error details: ${error.data.details}`);
}
}
Common Patterns
This section covers common patterns for using the Neo N3 MCP Server.
Getting Asset Balance and Transferring
// Get balance
const balance = await client.callTool('get_balance', {
address: 'NXV7ZhHaLY2GNjp6R1AYBV9FqrVnGLfQcz',
asset: 'GAS',
network: 'mainnet'
});
// Transfer assets if balance is sufficient
if (parseFloat(balance.amount) > 10) {
const transfer = await client.callTool('transfer_assets', {
fromPath: '/path/to/wallet.json',
fromPassword: 'your-password',
to: 'NXV7ZhHaLY2GNjp6R1AYBV9FqrVnGLfQcz',
asset: 'GAS',
amount: '10',
network: 'mainnet',
confirm: true
});
console.log(transfer);
}
Staking and Claiming Rewards
// Stake FLM tokens
const stake = await client.callTool('flamingo_stake', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
amount: '100',
network: 'mainnet'
});
// Wait for some time for rewards to accumulate
// ...
// Claim GAS rewards from NeoBurger
const claim = await client.callTool('neoburger_claim_gas', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
network: 'mainnet'
});
Creating and Selling an NFT
// Create an NFT
const nft = await client.callTool('ghostmarket_create_nft', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
tokenURI: 'https://example.com/nft/metadata.json',
properties: [
{ key: "artist", value: "ExampleArtist" },
{ key: "edition", value: "1/1" }
],
network: 'mainnet'
});
// Get the token ID from the result
const tokenId = nft.tokenId;
// List the NFT for sale
const listing = await client.callTool('ghostmarket_list_nft', {
walletPath: '/path/to/wallet.json',
walletPassword: 'your-password',
tokenId: tokenId,
price: '100',
paymentToken: '0xd2a4cff31913016155e38e474a2c06d08be276cf',
network: 'mainnet'
});
Best Practices
Here are some best practices for using the Neo N3 MCP Server:
Security
- Never hardcode wallet passwords in your code
- Use environment variables or a secure configuration manager for sensitive information
- Always verify transaction details before confirming
- Back up your wallet files regularly
Performance
- Batch operations where possible to reduce the number of API calls
- Use caching for frequently accessed data
- Implement retry logic for operations that might fail due to network issues
Error Handling
- Always wrap API calls in try-catch blocks
- Log detailed error information for debugging
- Implement graceful fallbacks for failed operations
Testing
- Test your integration on the testnet before deploying to mainnet
- Use small amounts for initial transactions to verify functionality
- Create a comprehensive test suite covering all your use cases
Interactive Tools
This section covers interactive tools for using the Neo N3 MCP Server.
Block Explorer
The Block Explorer allows you to explore the Neo N3 blockchain and view transaction details.
API Playground
The API Playground allows you to experiment with Neo N3 MCP API calls directly from your browser.
AI Chat
The AI Chat feature allows you to chat with an AI assistant about Neo N3 blockchain and Model Context Protocol (MCP). The assistant can help you understand Neo N3 concepts, learn about MCP features, and provide guidance on how to interact with blockchain features.
Getting Started with AI Chat
- Visit the AI Chat page
- Enter your OpenRoute API key in the sidebar
- Select your preferred AI model
- Start chatting with the assistant
Note: You need an OpenRoute API key to use the chat feature. OpenRoute is a service that provides access to various AI models. You can sign up for OpenRoute here.
Chat Features
- Model Selection: Choose from a variety of AI models including OpenAI GPT-4/4o, Anthropic Claude 3, Google Gemini, Meta Llama 3, and Mistral
- Response Streaming: Experience real-time responses as the AI generates text word by word
- Temperature Control: Adjust the creativity level of the AI responses
- Conversation History: Your conversations are saved locally in your browser
- API Key Security: Your OpenRoute API key is stored only in your browser's local storage and never sent to our servers
- Neo N3 MCP Integration: Execute real blockchain operations and view results directly in the chat
Neo N3 MCP Operations
The AI Chat now features direct integration with Neo N3 MCP, allowing you to perform actual blockchain operations directly from your conversations. The following operations are supported:
Operation | Description | Parameters | Example Usage |
---|---|---|---|
get_blockchain_info | Get general information about the Neo N3 blockchain | network (optional): "mainnet" or "testnet" | "What's the current status of the Neo N3 blockchain?" |
get_block_count | Get the current block height of the Neo N3 blockchain | network (optional): "mainnet" or "testnet" | "What's the current block height of Neo N3?" |
get_balance | Check the balance of a Neo N3 address | address: Neo N3 wallet address network (optional): "mainnet" or "testnet" |
"What's the balance of NeoekE2EaP1hs583NSQ13nbR1zWMmHQK1L?" |
get_block | Get information about a specific block | block_height or block_hash: The height or hash of the block network (optional): "mainnet" or "testnet" |
"Show me block 123456 on Neo N3" |
get_transaction | Get details of a transaction | tx_hash: Transaction hash network (optional): "mainnet" or "testnet" |
"Can you show me details for transaction 0x1234abcd..." |
call_contract | Call a smart contract method (read-only) | contract_hash: Smart contract hash method: Contract method name args (optional): Array of arguments network (optional): "mainnet" or "testnet" |
"Call the symbol method on the NEO token contract" |
Note: When you ask the AI to perform any of these operations, it will detect your intent and execute the appropriate MCP function. The results will be displayed directly in the chat interface.
Example Questions
Here are some examples of questions you can ask the AI assistant:
- What is Neo N3 blockchain and how does it differ from Neo Legacy?
- How does the Model Context Protocol work with Neo blockchain?
- What smart contracts are supported by the Neo N3 MCP server?
- How can I check my NEO balance using MCP?
- Explain how to transfer assets on Neo N3 using MCP
- What is the difference between mainnet and testnet?
- How can I interact with the NeoBurger contract through MCP?
Privacy Considerations
When using the AI Chat feature, keep the following privacy considerations in mind:
- Your conversations are sent directly from your browser to OpenRoute's API
- Your OpenRoute API key is stored only in your browser and never sent to our servers
- Conversation history is stored only in your browser's local storage
- Don't share sensitive information like private keys or wallet passwords in the chat
Troubleshooting
This section covers common issues and their solutions when integrating the Neo N3 MCP server with AI platforms.
Common AI Integration Issues
AI Assistant Reports "Operation XXX is not a function"
This error indicates that the MCP server is running but the AI can't find the specified operation.
Solution:
- Check that you're using the correct operation name. Ask the AI to run
list_operations
to see available operations. - Make sure you're using the latest version of the Neo N3 MCP server. Update with
npm update -g @r3e/neo-n3-mcp
- Restart the MCP server, as it may be in an inconsistent state.
Connection Refused Error
If the AI reports a connection error, the MCP server may not be running or is running on a different port.
Solution:
- Make sure the MCP server is running. Start it manually with
npx @r3e/neo-n3-mcp
- Check that the port configuration matches in both the server and the AI platform settings.
- If you're using a firewall, ensure that the MCP server port (default 8080) is allowed.
Network-related Errors
Errors related to connecting to Neo N3 blockchain nodes indicate network connectivity issues.
Solution:
- Check your internet connection.
- Verify that the Neo N3 public nodes are functioning by checking status at https://status.neo.org/
- Try specifying a different RPC URL in your MCP server configuration.
AI Platform-Specific Issues
Claude Integration Issues
Common issues and solutions:
- Problem: Claude ignores the MCP tool
Solution: Ensure your prompt clearly asks Claude to use the Neo N3 tool. Sometimes you need to be explicit, like "Please use the Neo N3 MCP tool to check blockchain information." - Problem: Claude Desktop doesn't start the MCP server
Solution: Check yourclaude_desktop_config.json
configuration and ensure Node.js is in your system PATH.
Cursor Integration Issues
Common issues and solutions:
- Problem: Cursor doesn't recognize the Neo N3 MCP tool
Solution: Make sure you've added the tool in the correct format and check Cursor's logs for any errors. - Problem: Tool starts but times out on operations
Solution: Cursor may have timeout limits. For long-running operations, consider updating the timeout settings if available.
General AI Model Behavior Issues
Understanding and addressing AI limitations:
- Problem: AI incorrectly formats MCP operation parameters
Solution: Provide examples in your prompt and correct the AI when necessary. AI models may need guidance on the exact format. - Problem: AI claims to perform operations it can't actually do
Solution: AI models may hallucinate capabilities. Guide the AI to uselist_operations
first to understand what's possible.
Getting Help
If you encounter issues not covered here:
- Visit our GitHub Issues page to report bugs or request features
- Join our Discord community for direct support
- Check the Documentation for detailed technical information