Alpha Vantage MCP server

Integrates with Alpha Vantage API to provide real-time financial market data for stock quotes, company information, cryptocurrency rates, and historical prices.
Back to servers
Setup instructions
Provider
berlinbra
Release date
Dec 19, 2024
Language
Python
Stats
77 stars

This MCP server provides a powerful interface for accessing financial market data from the Alpha Vantage API, offering real-time stock quotes, detailed company information, and various financial data endpoints through a standardized protocol.

Installation

Using Docker

  1. Clone the repository and build a local image:
cd alpha-vantage-mcp
docker build -t mcp/alpha-vantage .
  1. Configure your Claude Desktop client by modifying the claude_desktop_config.json file:

Location:

  • MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json

Add the following configuration, replacing REPLACE_API_KEY with your Alpha Vantage API key:

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

Using Smithery

For an automated installation via Smithery:

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

Manual Installation

  1. Install packages:
uv install -e .
  1. Run the server:
uv run src/alpha_vantage_mcp/server.py

With inspector:

npx @modelcontextprotocol/inspector uv --directory /Users/{INSERT_USER}/YOUR/PATH/TO/alpha-vantage-mcp run src/alpha_vantage_mcp/server.py

Available Tools

get-stock-quote

Retrieves the latest stock quote for a specific company.

Input:

{
    "symbol": "AAPL"
}

Example Response:

Stock quote for AAPL:

Price: $198.50
Change: $2.50 (+1.25%)
Volume: 58942301
High: $199.62
Low: $197.20

get-company-info

Retrieves detailed company information for a given symbol.

Input:

{
    "symbol": "AAPL"
}

Example Response:

Company information for AAPL:

Name: Apple Inc
Sector: Technology
Industry: Consumer Electronics
Market Cap: $3000000000000
Description: Apple Inc. designs, manufactures, and markets smartphones...
Exchange: NASDAQ
Currency: USD

get-crypto-exchange-rate

Retrieves real-time cryptocurrency exchange rates with additional market data.

Input:

{
    "crypto_symbol": "BTC",
    "market": "USD"
}

Example Response:

Cryptocurrency exchange rate for BTC/USD:

From: Bitcoin (BTC)
To: United States Dollar (USD)
Exchange Rate: 43521.45000
Last Updated: 2024-12-17 19:45:00 UTC
Bid Price: 43521.00000
Ask Price: 43522.00000

get-time-series

Retrieves daily time series (OHLCV) data with optional date filtering.

Input:

{
    "symbol": "AAPL",
    "outputsize": "compact",
    "limit": 5
}

Example Response:

Time Series Data for AAPL (Last Refreshed: 2024-12-17 16:00:00):
(Showing 5 most recent data points)

Date: 2024-12-16
Open: $195.09
High: $197.68
Low: $194.83
Close: $197.57
Volume: 55,751,011
---
Date: 2024-12-13
Open: $194.50
High: $196.25
Low: $193.80
Close: $195.12
Volume: 48,320,567
---

get-realtime-options

Retrieves real-time options chain data with Greeks and implied volatility.

⚠️ PREMIUM SUBSCRIPTION REQUIRED: This endpoint requires Alpha Vantage Premium with either the 600 requests/minute or 1200 requests/minute plan.

Input:

{
    "symbol": "AAPL",
    "require_greeks": true
}

get-historical-options

Retrieves historical options chain data with advanced filtering and sorting capabilities.

Input:

{
    "symbol": "AAPL",
    "min_strike": 190,
    "max_strike": 200,
    "contract_type": "call",
    "sort_by": "strike"
}

get-etf-profile

Retrieves comprehensive ETF profile information including holdings and sector allocation.

Input:

{
    "symbol": "QQQ"
}

get-crypto-daily, get-crypto-weekly, get-crypto-monthly

Retrieves cryptocurrency time series data at different intervals.

Input:

{
    "symbol": "SOL",
    "market": "USD"
}

get-earnings-calendar

Retrieves upcoming earnings calendar data for companies.

Input:

{
    "horizon": "3month",
    "limit": 10
}

get-historical-earnings

Retrieves historical earnings data for a specific company.

Input:

{
    "symbol": "AAPL"
}

Error Handling

The server includes comprehensive error handling for various scenarios including:

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

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "alpha-vantage-mcp" '{"command":"uv","args":["run","src/alpha_vantage_mcp/server.py"],"env":{"ALPHA_VANTAGE_API_KEY":"<insert api key>"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "alpha-vantage-mcp": {
            "command": "uv",
            "args": [
                "run",
                "src/alpha_vantage_mcp/server.py"
            ],
            "env": {
                "ALPHA_VANTAGE_API_KEY": "<insert api key>"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "alpha-vantage-mcp": {
            "command": "uv",
            "args": [
                "run",
                "src/alpha_vantage_mcp/server.py"
            ],
            "env": {
                "ALPHA_VANTAGE_API_KEY": "<insert api key>"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later