Skip to main content
Glama

Zerion MCP Server

by SAK1337

Zerion MCP Server

A production-ready Model Context Protocol (MCP) server that provides AI assistants with access to the Zerion API for cryptocurrency portfolio management, DeFi positions, NFTs, and market data.

Features

  • šŸ”Œ Auto-generated Tools: Automatically exposes Zerion API endpoints as MCP tools via OpenAPI specification

  • āš™ļø Flexible Configuration: YAML config files with environment variable overrides

  • šŸ“ Structured Logging: JSON and text formats with sensitive data redaction

  • šŸ›”ļø Robust Error Handling: Custom exceptions with detailed context and troubleshooting hints

  • āœ… Comprehensive Tests: Unit and integration tests with pytest

  • šŸš€ Async HTTP: Non-blocking API calls with httpx

Requirements

Installation

From Source

# Clone the repository git clone https://github.com/SAK1337/myzerionmcp.git cd myzerionmcp # Install the package pip install -e . # For development (includes testing dependencies) pip install -e ".[dev]"

From PyPI (when published)

pip install zerion-mcp-server

Quick Start

1. Set up your API key

export ZERION_API_KEY="Bearer your-api-key-here"

2. Run the server

zerion-mcp-server

3. Connect with an MCP client

The server will start and listen for MCP protocol connections. You can connect it to AI assistants like Claude Desktop.

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{ "mcpServers": { "zerion": { "command": "zerion-mcp-server", "env": { "ZERION_API_KEY": "Bearer your-api-key-here" } } } }

Configuration

Configuration File

Create a config.yaml file in your working directory:

# Server configuration name: "Zerion API" base_url: "https://api.zerion.io" oas_url: "https://raw.githubusercontent.com/smart-mcp-proxy/zerion-mcp-server/main/zerion_mcp_server/openapi_zerion.yaml" # API authentication api_key: "${ZERION_API_KEY}" # Environment variable substitution # Logging configuration logging: level: "INFO" # DEBUG, INFO, WARN, ERROR format: "text" # text or json

See config.example.yaml for a complete example.

Environment Variables

Environment variables override config file values:

Variable

Description

Default

ZERION_API_KEY

Zerion API key (required)

-

ZERION_BASE_URL

Zerion API base URL

https://api.zerion.io

ZERION_OAS_URL

OpenAPI spec URL

GitHub raw URL

CONFIG_PATH

Path to config.yaml

./config.yaml

LOG_LEVEL

Logging level

INFO

LOG_FORMAT

Logging format (text/json)

text

Usage Examples

Once connected to an MCP client (like Claude), you can query Zerion data:

Portfolio Balance

Get the portfolio balance for wallet 0x1234...

The server exposes tools like getWalletChart, getWalletPositions, etc.

DeFi Positions

Show me the DeFi positions for address 0xabcd...

NFT Collections

List NFTs owned by 0x5678...

All Zerion API endpoints are automatically available as MCP tools. See the Zerion API documentation for available operations.

Development

Setup Development Environment

# Clone and install with dev dependencies git clone https://github.com/SAK1337/myzerionmcp.git cd myzerionmcp pip install -e ".[dev]" # Set up API key export ZERION_API_KEY="Bearer your-test-key"

Running Tests

# Run all tests pytest # Run with coverage pytest --cov=zerion_mcp_server --cov-report=html # Run specific test file pytest tests/test_config.py # Run with verbose output pytest -v

Code Quality

# Type checking (if mypy is installed) mypy zerion_mcp_server # Linting (if ruff is installed) ruff check zerion_mcp_server

Troubleshooting

Common Issues

"Configuration error: Missing required configuration: api_key"

Solution: Set the ZERION_API_KEY environment variable:

export ZERION_API_KEY="Bearer your-api-key-here"

"Timeout loading OpenAPI specification"

Solution: Check your internet connection. The server needs to download the OpenAPI spec from GitHub.

"Unauthorized: Invalid or missing API key"

Solution: Verify your API key is correct and includes the "Bearer " prefix:

export ZERION_API_KEY="Bearer your-actual-key"

"Rate limit exceeded"

Solution: Wait for the rate limit window to reset. Check the error message for retry_after_sec value.

Debug Mode

Enable debug logging for detailed information:

export LOG_LEVEL="DEBUG" zerion-mcp-server

Or in config.yaml:

logging: level: "DEBUG" format: "json" # Structured logs for analysis

Log Interpretation

  • INFO: Normal operation (startup, requests)

  • WARN: Potential issues (slow operations)

  • ERROR: Failures (API errors, network issues)

  • DEBUG: Detailed traces (request/response bodies)

Architecture

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ MCP Client │ (e.g., Claude Desktop) │ (AI Assistant) │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ MCP Protocol │ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ FastMCP Server │ │ │ │ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ │ │ Config │ │ (YAML + Env) │ │ Manager │ │ │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ │ │ │ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ │ │ Logger │ │ (Structured) │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ │ │ │ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ │ │ Error │ │ (Custom Exceptions) │ │ Handler │ │ │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ │ │ │ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ │ │ HTTP │ │ (httpx AsyncClient) │ │ Client │ │ │ ā””ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”˜ │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ │ HTTPS │ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ Zerion API │ │ │ │ - Portfolios │ │ - DeFi │ │ - NFTs │ │ - Transactions │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Tech Stack

  • Python 3.11+: Core language

  • FastMCP: MCP server framework with OpenAPI integration

  • httpx: Async HTTP client

  • PyYAML: Configuration parsing

  • pytest: Testing framework

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature/your-feature

  3. Write tests for your changes

  4. Ensure tests pass: pytest

  5. Submit a pull request

Development Workflow

  • Follow PEP 8 style guidelines

  • Add type hints to function signatures

  • Write docstrings for modules and functions

  • Update tests for any code changes

  • Keep commits focused and atomic

License

MIT License - see LICENSE file for details

Support

Changelog

See CHANGELOG.md for version history and changes

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

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Enables AI assistants to access cryptocurrency portfolio management, DeFi positions, NFTs, and market data through the Zerion API. Automatically exposes all Zerion API endpoints as MCP tools for comprehensive crypto asset management.

  1. Features
    1. Requirements
      1. Installation
        1. From Source
        2. From PyPI (when published)
      2. Quick Start
        1. 1. Set up your API key
        2. 2. Run the server
        3. 3. Connect with an MCP client
      3. Configuration
        1. Configuration File
        2. Environment Variables
      4. Usage Examples
        1. Portfolio Balance
        2. DeFi Positions
        3. NFT Collections
      5. Development
        1. Setup Development Environment
        2. Running Tests
        3. Code Quality
      6. Troubleshooting
        1. Common Issues
        2. Debug Mode
        3. Log Interpretation
      7. Architecture
        1. Tech Stack
          1. Contributing
            1. Development Workflow
          2. License
            1. Support
              1. Changelog

                MCP directory API

                We provide all the information about MCP servers via our MCP API.

                curl -X GET 'https://glama.ai/api/mcp/v1/servers/SAK1337/myzerionmcp'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server