MCP HubMCP Hub
berlinbra

alpha-vantage-mcp

by: berlinbra

MCP Server for Alpha Advantage API

30created 17/12/2024
Visit
API
Alpha

📌Overview

Purpose: To provide real-time access to financial market data through a standardized interface using the Alpha Vantage API.

Overview: The Alpha Vantage MCP Server serves as a Model Context Protocol server that facilitates the retrieval of stock quotes and company information, as well as cryptocurrency exchange rates and historical options data.

Key Features:

  • Real-time Stock Quotes: Access the latest stock market data, including price, volume, and changes, enabling timely decision-making for investments.

  • Company Information Retrieval: Offers detailed insights about companies, such as sector, industry, and market capitalization, assisting investors in evaluating potential investments.

  • Cryptocurrency Exchange Rates: Provides real-time exchange rates with bid/ask prices for various cryptocurrencies, catering to the growing interest in digital assets.

  • Historical Options Data: Retrieves historical options chain information with advanced filtering and sorting capabilities, supporting sophisticated trading strategies.

  • Error Handling & Rate Limit Management: Implements robust error handling for various scenarios, ensuring reliability and user-friendly feedback in case of errors.


Alpha Vantage MCP Server

A Model Context Protocol (MCP) server that provides real-time access to financial market data through the free Alpha Vantage API. This server implements a standardized interface for retrieving stock quotes and company information.

Features

  • Real-time stock quotes with price, volume, and change data
  • Detailed company information including sector, industry, and market cap
  • Real-time cryptocurrency exchange rates with bid/ask prices
  • Historical options chain data with advanced filtering and sorting
  • Built-in error handling and rate limit management

Installation

Using Claude Desktop

Installing via Docker

  1. Clone the repository and build a local image:

    cd alpha-vantage-mcp
    docker build -t mcp/alpha-vantage .
    
  2. Update your claude_desktop_config.json:

    {
      "mcpServers": {
        "alphavantage": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "-e",
            "ALPHA_VANTAGE_API_KEY",
            "mcp/alpha-vantage"
          ],
          "env": {
            "ALPHA_VANTAGE_API_KEY": "REPLACE_API_KEY"
          }
        }
      }
    }
    

Installing via Smithery

To install Alpha Vantage MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @berlinbra/alpha-vantage-mcp --client claude

Install Packages

uv install -e .

Running the Server

After connecting the Claude client with the MCP tool and installing the packages, you can run the server:

uv run src/alpha_vantage_mcp/server.py

Available Tools

The server implements five tools:

  • get-stock-quote: Get the latest stock quote for a specific company.
  • get-company-info: Get stock-related information for a specific company.
  • get-crypto-exchange-rate: Get current cryptocurrency exchange rates.
  • get-time-series: Get historical daily price data for a stock.
  • get-historical-options: Get historical options chain data with sorting capabilities.

Error Handling

The server includes comprehensive error handling for various scenarios, such as:

  • Rate limit exceeded
  • Invalid API key
  • Network connectivity issues
  • Timeout handling
  • Malformed responses

Prerequisites

  • Python 3.12 or higher
  • httpx
  • mcp

Contributors

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This MCP server is licensed under the MIT License. You are free to use, modify, and distribute the software, subject to the terms of the MIT License.