MCP Server Configuration
Configure your Moralis MCP Server with the essential settings needed to connect with AI clients and access Moralis APIs.
Environment Variables
Required
Variable | Description |
---|---|
MORALIS_API_KEY | Your Moralis API key from admin.moralis.com |
export MORALIS_API_KEY="your_api_key_here"
Transport Options
The server accepts a --transport
argument to specify the communication method:
stdio (Default)
Communicates over standard input/output - used for AI clients like Claude Desktop.
moralis-api-mcp --transport stdio
web
Starts an HTTP server for web-based communication.
moralis-api-mcp --transport web
streamable-http
Starts an HTTP server with streamable endpoints.
moralis-api-mcp --transport streamable-http
AI Client Configuration
Claude Desktop
Config file locations:
- 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"
}
}
}
}
Generic MCP Client
{
"mcpServers": {
"serverName": {
"command": "npx @moralisweb3/api-mcp-server",
"args": [],
"env": {
"MORALIS_API_KEY": "your_api_key"
}
}
}
}
Usage Examples
With Global Install
# Set environment variable
export MORALIS_API_KEY="your_key"
# Run with default stdio transport
moralis-api-mcp
# Run with web transport
moralis-api-mcp --transport web
With npx
# Set environment variable
export MORALIS_API_KEY="your_key"
# Run directly without installation
npx @moralisweb3/api-mcp-server --transport stdio
Verification
Check Environment Setup
# Verify API key is set
echo $MORALIS_API_KEY
Test Server Startup
# Should start without errors
npx @moralisweb3/api-mcp-server --transport stdio
Common Issues
Missing API Key
Error: MORALIS_API_KEY environment variable is required
Solution: Set your API key in the environment.
Invalid API Key
Error: Authentication failed
Solution: Verify your API key is correct and active.
AI Client Not Connecting
Solution:
- Check config file syntax and location
- Restart your AI client completely
- Verify the command path is correct
Note: Some features and endpoints require a Moralis paid plan for full access and production-grade performance.