Skip to main content
Glama
Alpha Vantage MCP Server

Alpha Vantage MCP Server

by calvernaz

βœ… Official Alpha Vantage MCP Server

A MCP server for the stock market data API, Alphavantage API.

MCP Server URL: https://mcp.alphavantage.co

PyPi: https://pypi.org/project/alphavantage-mcp/

Configuration

Getting an API Key

  1. Sign up for a Free Alphavantage API key

  2. Add the API key to your environment variables as ALPHAVANTAGE_API_KEY

Related MCP server: Stock Ticker MCP Server

Installation

The easiest way to use the AlphaVantage MCP server is with uvx:

# Run directly without installation
uvx alphavantage-mcp

# Or with specific arguments
uvx alphavantage-mcp --server http --port 8080

Option 2: Using pip

pip install alphavantage-mcp
alphavantage-mcp

Option 3: From source

git clone https://github.com/calvernaz/alphavantage.git
cd alphavantage
uv run alphavantage

Server Modes

The AlphaVantage server can run in two different modes:

Stdio Server (Default)

This is the standard MCP server mode used for tools like Claude Desktop.

alphavantage
# or explicitly:
alphavantage --server stdio

Streamable HTTP Server

This mode provides real-time updates via HTTP streaming.

alphavantage --server http --port 8080

Streamable HTTP Server with OAuth 2.1 Authentication

This mode adds OAuth 2.1 authentication to the HTTP server, following the MCP specification for secure access.

alphavantage --server http --port 8080 --oauth

OAuth Configuration

When using the --oauth flag, the server requires OAuth 2.1 configuration via environment variables:

Required Environment Variables:

export OAUTH_AUTHORIZATION_SERVER_URL="https://your-auth-server.com/realms/your-realm"
export OAUTH_RESOURCE_SERVER_URI="https://your-mcp-server.com"

Optional Environment Variables:

# Token validation method (default: jwt)
export OAUTH_TOKEN_VALIDATION_METHOD="jwt"  # or "introspection"

# For JWT validation
export OAUTH_JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
export OAUTH_JWT_ALGORITHM="RS256"  # default

# For token introspection validation
export OAUTH_INTROSPECTION_ENDPOINT="https://your-auth-server.com/realms/your-realm/protocol/openid-connect/token/introspect"
export OAUTH_INTROSPECTION_CLIENT_ID="your-client-id"
export OAUTH_INTROSPECTION_CLIENT_SECRET="your-client-secret"

# Optional: Required scopes (space-separated)
export OAUTH_REQUIRED_SCOPES="mcp:access mcp:read"

# Optional: Enable session binding for additional security (default: true)
export OAUTH_SESSION_BINDING_ENABLED="true"

OAuth Features

The OAuth implementation provides:

  • OAuth 2.0 Protected Resource Metadata endpoint (/.well-known/oauth-protected-resource)

  • Bearer token authentication for all MCP requests

  • JWT and Token Introspection validation methods

  • MCP Security Best Practices compliance:

    • Token audience validation (prevents token passthrough attacks)

    • Session hijacking prevention with secure session IDs

    • User-bound sessions for additional security

    • Proper WWW-Authenticate headers for 401 responses

Example: Keycloak Configuration

For testing with Keycloak:

# Keycloak OAuth configuration
export OAUTH_AUTHORIZATION_SERVER_URL="https://keycloak.example.com/realms/mcp-realm"
export OAUTH_RESOURCE_SERVER_URI="https://mcp.example.com"
export OAUTH_TOKEN_VALIDATION_METHOD="introspection"
export OAUTH_INTROSPECTION_ENDPOINT="https://keycloak.example.com/realms/mcp-realm/protocol/openid-connect/token/introspect"
export OAUTH_INTROSPECTION_CLIENT_ID="mcp-server"
export OAUTH_INTROSPECTION_CLIENT_SECRET="your-keycloak-client-secret"
export OAUTH_REQUIRED_SCOPES="mcp:access"

# Start server with OAuth
alphavantage --server http --port 8080 --oauth

OAuth Client Flow

When OAuth is enabled, MCP clients must:

  1. Discover the authorization server via GET /.well-known/oauth-protected-resource

  2. Register with the authorization server (if using Dynamic Client Registration)

  3. Obtain access tokens from the authorization server

  4. Include tokens in requests: Authorization: Bearer <access-token>

  5. Handle 401/403 responses and refresh tokens as needed

Options:

  • --server: Choose between stdio (default) or http server mode

  • --port: Specify the port for the Streamable HTTP server (default: 8080)

  • --oauth: Enable OAuth 2.1 authentication (requires --server http)

πŸ“Š Telemetry

The AlphaVantage MCP server includes optional Prometheus metrics for monitoring and observability.

Enabling Telemetry

Set the following environment variables to enable telemetry:

# Enable telemetry (default: true)
export MCP_TELEMETRY_ENABLED=true

# Server identification (optional)
export MCP_SERVER_NAME=alphavantage
export MCP_SERVER_VERSION=1.0.0

# Metrics server port (default: 9464)
export MCP_METRICS_PORT=9464

Metrics Endpoint

When telemetry is enabled, Prometheus metrics are available at:

http://localhost:9464/metrics

Available Metrics

The server collects the following metrics for each tool call:

  • mcp_tool_calls_total - Total number of tool calls (labeled by tool and outcome)

  • mcp_tool_latency_seconds - Tool execution latency histogram

  • mcp_tool_request_bytes - Request payload size histogram

  • mcp_tool_response_bytes - Response payload size histogram

  • mcp_tool_active_concurrency - Active concurrent tool calls gauge

  • mcp_tool_errors_total - Total errors by type (timeout, bad_input, connection, unknown)

Example Usage with Telemetry

# Start server with telemetry enabled
export MCP_TELEMETRY_ENABLED=true
export MCP_SERVER_NAME=alphavantage-prod
export ALPHAVANTAGE_API_KEY=your_api_key
alphavantage --server http --port 8080

# View metrics
curl http://localhost:9464/metrics

πŸš€ AWS Serverless Deployment

Deploy the AlphaVantage MCP Server on AWS Lambda using the stateless MCP pattern for production-ready, scalable deployment.

Quick AWS Deployment

cd deploy/aws-stateless-mcp-lambda
export ALPHAVANTAGE_API_KEY=your_api_key_here
./deploy.sh

Features:

  • βœ… Stateless MCP pattern - Perfect for Lambda's execution model

  • βœ… Auto-scaling - Handles any load with AWS Lambda + API Gateway

  • βœ… Cost-effective - Pay only for requests (~$1-5/month for typical usage)

  • βœ… Production-ready - Based on AWS official sample patterns

  • βœ… OAuth 2.1 support - Optional authentication for secure access

πŸ“– Full Documentation: See AWS Deployment Guide for complete setup instructions, testing, monitoring, and troubleshooting.

Usage with Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "alphavantage": {
      "command": "uvx",
      "args": ["alphavantage-mcp"],
      "env": {
        "ALPHAVANTAGE_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

Option 2: From source

If you cloned the repository, use this configuration:

{
  "mcpServers": {
    "alphavantage": {
      "command": "uv",
      "args": [
        "--directory",
        "<DIRECTORY-OF-CLONED-PROJECT>/alphavantage",
        "run",
        "alphavantage"
      ],
      "env": {
        "ALPHAVANTAGE_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

Running the Server in Streamable HTTP Mode

Using uvx:

{
  "mcpServers": {
    "alphavantage": {
      "command": "uvx",
      "args": ["alphavantage-mcp", "--server", "http", "--port", "8080"],
      "env": {
        "ALPHAVANTAGE_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

From source:

{
  "mcpServers": {
    "alphavantage": {
      "command": "uv",
      "args": [
        "--directory",
        "<DIRECTORY-OF-CLONED-PROJECT>/alphavantage",
        "run",
        "alphavantage",
        "--server",
        "http",
        "--port",
        "8080"
      ],
      "env": {
        "ALPHAVANTAGE_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

πŸ“Ί Demo Video

Watch a quick demonstration of the Alpha Vantage MCP Server in action:

Alpha Vantage MCP Server Demo

πŸ”§ Development & Publishing

Publishing to PyPI

This project includes scripts for publishing to PyPI and TestPyPI:

# Publish to TestPyPI (for testing)
python scripts/publish.py --test

# Publish to PyPI (production)
python scripts/publish.py

# Use uv publish instead of twine
python scripts/publish.py --test --use-uv

The script uses twine by default (recommended) but can also use uv publish with the --use-uv flag.

GitHub Actions

The repository includes a GitHub Actions workflow for automated publishing:

  • Trusted Publishing: Uses PyPA's official publish action with OpenID Connect

  • Manual Trigger: Can be triggered manually with options for TestPyPI vs PyPI

  • Twine Fallback: Supports both trusted publishing and twine-based publishing

To set up publishing:

  1. For Trusted Publishing (recommended):

    • Configure trusted publishing on PyPI/TestPyPI with your GitHub repository

    • No secrets needed - uses OpenID Connect

  2. For Token-based Publishing:

    • Add PYPI_API_TOKEN and TEST_PYPI_API_TOKEN secrets to your repository

    • Use the "Use twine" option in the workflow dispatch

🀝 Contributing

We welcome contributions from the community! To get started, check out our contribution guide for setup instructions, development tips, and guidelines.

Available Tools

111 tools
adoscC

Fetch accumulation/distribution oscillator

Inputs: symbol (required), interval (required), fastperiod (required), slowperiod (required), +2 more.

adxD

Fetch average directional movement index

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

adxrC

Fetch average directional movement index rating

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

all_commoditiesD

Fetch all commodities

Inputs: interval, datatype.

aluminumD

Fetch aluminum

Inputs: interval, datatype.

analytics_fixed_windowD

Fetch analytics fixed window

Inputs: symbols (required), interval (required), series_range (required), calculations (required), +1 more.

analytics_sliding_windowD

Fetch analytics sliding window

Inputs: symbols (required), interval (required), series_range (required), window_size (required), +2 more.

apoC

Fetch absolute price oscillator

Inputs: symbol (required), interval (required), series_type (required), fastperiod (required), +4 more.

aroonD

Fetch aroon

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

aroonoscD

Fetch aroon oscillator

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

atrC

Fetch average true range

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

balance_sheetC

Fetch company balance sheet

Inputs: symbol (required).

bbandsC

Fetch bollinger bands

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +4 more.

bopD

Fetch balance of power

Inputs: symbol (required), interval (required), month, datatype.

brent_crude_oilD

Fetch Brent crude oil

Inputs: interval, datatype.

cash_flowC

Fetch company cash flow

Inputs: symbol (required).

cciC

Fetch commodity channel index

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

cmoC

Fetch chande momentum oscillator

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

coffeeD

Fetch coffee

Inputs: interval, datatype.

company_dividendsD

Fetch company splits

Inputs: symbol (required).

company_earningsC

Fetch company earnings

Inputs: symbol (required).

company_overviewC

Fetch company overview

Inputs: symbol (required).

copperD

Fetch copper

Inputs: interval, datatype.

cornD

Fetch corn

Inputs: interval, datatype.

cottonD

Fetch cotton

Inputs: interval, datatype.

cpiC

Fetch consumer price index

Inputs: interval, datatype.

crypto_intradayD

Fetch crypto intraday

Inputs: symbol (required), market (required), interval (required), outputsize, +1 more.

demaC

Fetch double exponential moving average

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

digital_currency_dailyC

Fetch digital currency daily

Inputs: symbol (required), market (required).

digital_currency_monthlyC

Fetch digital currency monthly

Inputs: symbol (required), market (required).

digital_currency_weeklyC

Fetch digital currency weekly

Inputs: symbol (required), market (required).

durablesD

Fetch durables

Inputs: datatype.

dxD

Fetch directional movement index

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

earnings_calendarC

Fetch company earnings calendar

Inputs: symbol, horizon.

earnings_call_transcriptC

Fetch the earnings call transcript for a given company in a specific quarter

Inputs: symbol (required), quarter (required).

emaC

Fetch exponential moving average

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

etf_profileC

Fetch ETF profile

Inputs: symbol (required).

exchange_rateD

Fetch exchange rate

Inputs: from_currency (required), to_currency (required).

federal_funds_rateC

Fetch federal funds rate

Inputs: interval, datatype.

fx_dailyC

Fetch FX daily

Inputs: from_symbol (required), to_symbol (required), datatype, outputsize.

fx_intradayD

Fetch FX intraday

Inputs: from_symbol (required), to_symbol (required), interval (required), outputsize, +1 more.

fx_monthlyD

Fetch FX monthly

Inputs: from_symbol (required), to_symbol (required), datatype.

fx_weeklyC

Fetch FX weekly

Inputs: from_symbol (required), to_symbol (required), datatype.

historical_optionsD

Fetch historical options

Inputs: symbol (required), datatype, contract.

ht_dcperiodC

Fetch hilbert transform - dominant cycle period

Inputs: symbol (required), interval (required), month, series_type, +1 more.

ht_dcphaseD

Fetch hilbert transform - dominant cycle phase

Inputs: symbol (required), interval (required), month, datatype.

ht_phasorD

Fetch hilbert transform - phasor components

Inputs: symbol (required), interval (required), month, datatype.

ht_sineD

Fetch hilbert transform - sine wave

Inputs: symbol (required), interval (required), series_type (required), month, +1 more.

ht_trendlineD

Fetch hilbert transform - trendline

Inputs: symbol (required), interval (required), series_type (required), month, +1 more.

ht_trendmodeD

Fetch hilbert transform - trend mode

Inputs: symbol (required), interval (required), month, datatype.

income_statementC

Fetch company income statement

Inputs: symbol (required).

inflationD

Fetch inflation

Inputs: datatype.

insider_transactionsC

Fetch insider transactions

Inputs: symbol (required).

ipo_calendarB

Fetch IPO calendar

Inputs: no named parameters.

kamaC

Fetch Kaufman adaptive moving average

Inputs: symbol, interval, month, time_period, +2 more.

listing_statusD

Fetch listing status

Inputs: symbol, date, state.

macdC

Fetch moving average convergence divergence

Inputs: symbol (required), interval (required), series_type (required), month, +4 more.

macdextD

Fetch moving average convergence divergence next

Inputs: symbol (required), interval (required), series_type (required), month, +7 more.

mamaC

Fetch MESA adaptive moving average

Inputs: symbol (required), interval (required), series_type (required), fastlimit (required), +3 more.

market_statusC

Fetch market status

Inputs: no named parameters.

mfiD

Fetch money flow index

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

midpointD

Fetch midpoint

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

midpriceD

Fetch midprice

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

minus_diD

Fetch minus directional indicator

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

minus_dmD

Fetch minus directional movement

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

momD

Fetch momentum

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

natrD

Fetch normalized average true range

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

natural_gasD

Fetch natural gas

Inputs: interval, datatype.

news_sentimentD

Fetch news sentiment

Inputs: tickers (required), topics, time_from, time_to, +3 more.

nonfarm_payrollD

Fetch nonfarm payroll

Inputs: datatype.

obvC

Fetch on balance volume

Inputs: symbol (required), interval (required), month, datatype.

plus_diD

Fetch plus directional indicator

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

plus_dmD

Fetch plus directional movement

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

ppoC

Fetch percentage price oscillator

Inputs: symbol (required), interval (required), series_type (required), fastperiod (required), +4 more.

real_gdpD

Fetch real GDP

Inputs: interval, datatype.

real_gdp_per_capitaC

Fetch real GDP per capita

Inputs: datatype.

realtime_bulk_quotesC

Fetch real time bulk quotes

Inputs: symbols (required).

realtime_optionsD

Fetch realtime options

Inputs: symbol (required), datatype, contract.

retail_salesD

Fetch retail sales

Inputs: datatype.

rocD

Fetch rate of change

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

rocrD

Fetch rate of change ratio

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

rsiD

Fetch relative strength index

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

sarD

Fetch parabolic sar

Inputs: symbol (required), interval (required), month, acceleration, +2 more.

smaD

Fetch simple moving average

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +3 more.

stochD

Fetch stochastic oscillator

Inputs: symbol (required), interval (required), month, fastkperiod, +5 more.

stochfC

Fetch stochastic oscillator fast

Inputs: symbol (required), interval (required), month, fastkperiod, +3 more.

stochrsiC

Fetch stochastic relative strength index

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +5 more.

stock_quoteC

Fetch a stock quote

Inputs: symbol (required), datatype.

sugarD

Fetch sugar

Inputs: interval, datatype.

t3C

Fetch triple exponential moving average

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

time_series_dailyD

Fetch a time series daily

Inputs: symbol (required), outputsize, datatype.

time_series_daily_adjustedD

Fetch a time series daily adjusted

Inputs: symbol (required), outputsize, datatype.

time_series_intradayD

Fetch a time series intraday

Inputs: symbol (required), interval (required), adjusted, outputsize, +2 more.

time_series_monthlyC

Fetch a time series monthly

Inputs: symbol (required), datatype.

time_series_monthly_adjustedD

Fetch a time series monthly adjusted

Inputs: symbol (required), datatype.

time_series_weeklyD

Fetch a time series weekly

Inputs: symbol (required), datatype.

time_series_weekly_adjustedC

Fetch a time series weekly adjusted

Inputs: symbol (required), datatype.

top_gainers_losersC

Fetch top gainers and losers

Inputs: no named parameters.

trangeD

Fetch true range

Inputs: symbol (required), interval (required), month, datatype.

treasury_yieldD

Fetch treasury yield

Inputs: interval, maturity, datatype.

trimaD

Fetch triangular moving average

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

trixD

Fetch triple exponential average

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

ultoscD

Fetch ultimate oscillator

Inputs: symbol (required), interval (required), timeperiod1 (required), timeperiod2 (required), +3 more.

unemploymentD

Fetch unemployment

Inputs: datatype.

vwapC

Fetch volume weighted average price

Inputs: symbol (required), interval (required), month, datatype.

wheatD

Fetch wheat

Inputs: interval, datatype.

willrD

Fetch williams percent range

Inputs: symbol (required), interval (required), time_period (required), month, +1 more.

wmaD

Fetch weighted moving average

Inputs: symbol (required), interval (required), time_period (required), series_type (required), +2 more.

wti_crude_oilC

Fetch WTI crude oil

Inputs: interval, datatype.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.4/5.0

    Scored across 111 tools

    Disambiguation4/5

    Most tools are clearly distinct, targeting specific financial indicators, commodities, or data types (e.g., 'ad' vs. 'adx', 'balance_sheet' vs. 'cash_flow'). However, some overlap exists in time series tools (e.g., 'time_series_daily' vs. 'time_series_daily_adjusted') and similar indicators (e.g., 'stoch' vs. 'stochf'), which could cause minor confusion without careful parameter inspection.

    Naming Consistency5/5

    Tool names follow a highly consistent pattern, primarily using snake_case with descriptive, abbreviated names for technical indicators (e.g., 'rsi', 'macd') and full phrases for broader data (e.g., 'company_overview', 'federal_funds_rate'). The naming is uniform across all 111 tools, making them predictable and readable.

    Tool Count2/5

    With 111 tools, the count is excessive for an MCP server, likely overwhelming agents and users. While Alpha Vantage's API is extensive, this tool set feels bloated; a more curated selection or categorization would improve usability. It exceeds typical well-scoped ranges (3-15 tools) significantly.

    Completeness5/5

    The tool set provides comprehensive coverage of Alpha Vantage's financial data domain, including technical indicators, fundamental data, commodities, forex, crypto, and economic indicators. There are no obvious gaps; it supports full data retrieval workflows across multiple asset classes and timeframes.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      D
      quality
      D
      maintenance
      Allows Claude and other MCP clients to access real-time and historical stock market data from Alpha Vantage API, including intraday and daily stock data with customizable intervals.
      3
      14 npm
      6
      MIT
    • -
      license
      Not graded
      quality
      D
      maintenance
      Provides real-time and historical stock market data through the Alpha Vantage API. Enables users to get current stock prices and retrieve historical stock data for any major stock symbol via natural language queries.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides real-time access to financial market data including stock quotes, company information, cryptocurrency exchange rates, historical options chains, and time series data through the Alpha Vantage API.
      -
    • A
      license
      A
      quality
      D
      maintenance
      Provides comprehensive market data, fundamental analysis, and technical indicators through the AlphaVantage API. It enables users to fetch financial statements, stock prices, and market news with sentiment analysis for detailed financial research.
      9
      1
      MIT