MCP Server Getting Started
Get your Moralis MCP Server running in minutes. This guide covers installation, configuration, and making your first blockchain queries through AI models.
Prerequisites
- Node.js (version 16 or higher)
- Moralis API Key - Get one from admin.moralis.com
Installation
Option 1: Global Install
npm install -g @moralisweb3/api-mcp-server
Option 2: Use with npx (Recommended)
# No installation needed - run directly
npx @moralisweb3/api-mcp-server --version
Option 3: Auto-install for Claude Desktop
npx -y @smithery/cli install @MoralisWeb3/moralis-mcp-server --client claude
Get Your API Key
- Go to Moralis Admin Panel
- Sign up and log in
- Navigate to API Keys
- Copy your API key
- Set it in your environment:
export MORALIS_API_KEY=<your_api_key>
⚠️ Note: Some features require a Moralis paid plan for full access and production performance.
Basic Usage
Run with Default Settings
# Using global install
moralis-api-mcp --transport stdio
# Using npx
npx @moralisweb3/api-mcp-server --transport stdio
Transport Options
# Standard input/output (default - for AI clients)
moralis-api-mcp --transport stdio
# HTTP server (for web apps)
moralis-api-mcp --transport web
# HTTP with streaming (for real-time apps)
moralis-api-mcp --transport streamable-http
Connect to AI Clients
Claude Desktop Setup
Create or edit your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"moralis": {
"command": "npx @moralisweb3/api-mcp-server",
"args": [],
"env": {
"MORALIS_API_KEY": "your_api_key_here"
}
}
}
}
Restart Claude Desktop after saving.
Generic MCP Client Config
For other MCP-compatible clients:
{
"mcpServers": {
"serverName": {
"command": "npx @moralisweb3/api-mcp-server",
"args": [],
"env": {
"MORALIS_API_KEY": "your_api_key"
}
}
}
}
Test Your Setup
Once connected to an AI client, try these queries:
Basic Price Check
What's the current price of PEPE and Ethereum?
Wallet Analysis
What tokens does wallet 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 hold?
NFT Query
Show me the NFTs owned by vitalik.eth on Base
You should see the AI model using Moralis tools to fetch real blockchain data and provide intelligent responses.
Development Setup
Clone and Build
git clone https://github.com/MoralisWeb3/moralis-mcp-server.git
cd moralis-mcp-server
# Install dependencies
npm install
# Build the server
npm run build
Development with Auto-rebuild
npm run watch
Debug with MCP Inspector
npm run inspector
The Inspector provides a browser-based debugging interface at the URL shown in the output.
Environment Variables
Variable | Required | Description |
---|---|---|
MORALIS_API_KEY | Yes | Your Moralis API key |
Verification
Check Installation
npx @moralisweb3/api-mcp-server --version
Test API Key
# Set your key
export MORALIS_API_KEY=your_key_here
# Run server (should start without errors)
npx @moralisweb3/api-mcp-server --transport stdio
Verify AI Client Connection
In your AI client (Claude Desktop, etc.), you should see:
- MCP tools available in conversations
- Ability to query blockchain data
- Structured responses with real-time data
Common Issues
Command Not Found
# Use npx instead of global install
npx @moralisweb3/api-mcp-server --transport stdio
API Key Not Set
# Check if set
echo $MORALIS_API_KEY
# Set if missing
export MORALIS_API_KEY=your_api_key
Claude Desktop Not Showing Tools
- Check config file syntax
- Verify file path is correct
- Restart Claude Desktop completely
- Check for config file typos
Resources
- GitHub: MoralisWeb3/moralis-mcp-server
- NPM: @moralisweb3/api-mcp-server
- API Docs: Moralis API Reference