Alphavantage

by calvernaz

32 stars
873 downloads
Not rated
GitHub

About

Integrates with the Alphavantage API to provide access to real-time stock market data and financial information.

Details

Author
calvernaz
Repository
calvernaz/alphavantage
GitHub stars
32
Downloads
873
License
Apache License 2.0
Categories
Cloud Service, Finance, Other, API, AI, Design, Developer Tools, Search, Frontend, Knowledge Base
Tags
#integration

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

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Alphavantage
    Command (node, npx, python, etc.) uvx
    Arguments
    • Argument 1 alphavantage-mcp
    Environment
    • ALPHAVANTAGE_API_KEY YOUR_API_KEY_HERE

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

1. Sign up for a Free Alphavantage API key
2. Add the API key to your environment variables as ALPHAVANTAGE_API_KEY

uvx alphavantage-mcp

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

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

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:


For testing with Keycloak:

bash

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"

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

Linux

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

Macos

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

Windows

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

Access real-time and historical stock market data from the Alpha Vantage API.

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/
- Sign up for a
Free Alphavantage API key
- Add the API key to your environment variables asALPHAVANTAGE_API_KEY

The easiest way to use the AlphaVantage MCP server is withuvx:

# Run directly without installation uvx alphavantage-mcp # Or with specific arguments uvx alphavantage-mcp --server http --port 8080
pip install alphavantage-mcp alphavantage-mcp
git clone https://github.com/calvernaz/alphavantage.git cd alphavantage uv run alphavantage

The AlphaVantage server can run in two different modes:

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

alphavantage # or explicitly: alphavantage --server stdio

This mode provides real-time updates via HTTP streaming.

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

When using the--oauthflag, the server requires OAuth 2.1 configuration via 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"
# 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 2.0 Protected Resource Metadataendpoint (/.well-known/oauth-protected-resource)
- Bearer token authenticationfor all MCP requests
- JWT and Token Introspectionvalidation methods
- MCP Security Best Practicescompliance:

- 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

# 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

When OAuth is enabled, MCP clients must:
- Discoverthe authorization server viaGET /.well-known/oauth-protected-resource
- Registerwith the authorization server (if using Dynamic Client Registration)
- Obtain access tokensfrom the authorization server
- Include tokensin requests:Authorization: Bearer <access-token>
- Handle 401/403 responsesand refresh tokens as needed

- --server: Choose betweenstdio(default) orhttpserver mode
- --port: Specify the port for the Streamable HTTP server (default: 8080)
- --oauth: Enable OAuth 2.1 authentication (requires--server http)

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

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

When telemetry is enabled, Prometheus metrics are available at:

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)

# 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

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

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

- ✅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:SeeAWS Deployment Guidefor complete setup instructions, testing, monitoring, and troubleshooting.

Add this to yourclaude_desktop_config.json:

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

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

{ "mcpServers": { "alphavantage": { "command": "uvx", "args": ["alphavantage-mcp", "--server", "http", "--port", "8080"], "env": { "ALPHAVANTAGE_API_KEY": "YOUR_API_KEY_HERE" } } } }
{ "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" } } } }

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

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 usestwineby default (recommended) but can also useuv publishwith the--use-uvflag.

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

- Configure trusted publishing on PyPI/TestPyPI with your GitHub repository
- No secrets needed - uses OpenID Connect

- AddPYPI_API_TOKENandTEST_PYPI_API_TOKENsecrets to your repository
- Use the "Use twine" option in the workflow dispatch

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

Interact with Twelve Data APIs to access real-time and historical financial market data for your AI agents.

Access real-time financial data, including stock prices, forex rates, and cryptocurrencies from Alpha Vantage.

An MCP server for Zuora, powered by the CData JDBC Driver. Requires a separate driver and configuration file for connection.

An MCP server for retrieving financial data using the financialdatasets API.

Provides access to real-time and historical stock data from the Alpha Vantage API.

Real-time financial indicators for AI assistants

Enrich banking data using the Ntropy API.

Access real-time mortgage rate data from the RateSpot.io API.

Provides real-time US stock market data and company financial information using the Alpha Vantage API.

US/HK markets — 110 tools: real-time quotes, options, orders, fundamentals, alerts, DCA & portfolio

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.