yfinance MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@yfinance MCP ServerGet stock info and news for AAPL"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
yfinance MCP Server on Azure Functions
A Model Context Protocol (MCP) server providing Yahoo Finance data, hosted on Azure Functions as a self-hosted MCP server.
Based on yfinance, adapted for Azure Functions using the custom handler pattern with streamable-http transport.
Tools
Tool | Description |
| Get stock price, valuation, financials, and company info |
| Get historical OHLCV price data with configurable period/interval |
| Get dividend payment history |
| Get stock split history |
| Get income statement, balance sheet, and cash flow (annual/quarterly) |
| Get earnings data from income statements |
| Get recent news articles for a stock |
| Get analyst recommendations breakdown |
| Search for stocks by company name or ticker |
| Get quotes for multiple stocks at once |
| Get options data with strikes, bid/ask, volume, implied volatility |
| Get EPS forecasts, revenue estimates, and growth projections |
| Get price targets and upgrade/downgrade history |
| Get insider transactions, institutional and fund holders |
| Download historical data for multiple tickers efficiently |
| Screen stocks using predefined Yahoo Finance screeners |
| Get ESG sustainability scores |
| Get SEC filings (10-K, 10-Q, 8-K) with links |
| Get upcoming earnings dates, ex-dividend, and estimates |
Prerequisites
uv (package manager)
Azure Functions Core Tools v4 (for local dev and deployment)
Local Development
# Install dependencies
uv sync
# Run with Azure Functions Core Tools
func start
# Or run the server directly (without Functions host)
uv run python server.pyThe MCP server starts on http://localhost:8000/mcp using the streamable-http transport.
Testing Locally
Send MCP requests to http://localhost:8000/mcp:
# Initialize the MCP session
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'
# List available tools
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
# Call a tool (e.g., get stock info for AAPL)
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_stock_info","arguments":{"symbol":"AAPL"}}}'Or connect any MCP client (VS Code Copilot, Claude Desktop, etc.) with:
{
"mcpServers": {
"yfinance": {
"url": "http://localhost:8000/mcp"
}
}
}Deploy to Azure
The server is deployed to an Azure Functions Flex Consumption plan using the Azure CLI and Azure Functions Core Tools.
1. Create Azure Resources
az login
# Create a resource group
az group create --name <resource-group> --location <region>
# Create a storage account (required by Azure Functions)
az storage account create \
--name <storage-account> \
--resource-group <resource-group> \
--location <region> \
--sku Standard_LRS
# Create the Function App on Flex Consumption
az functionapp create \
--name <function-app-name> \
--resource-group <resource-group> \
--storage-account <storage-account> \
--flexconsumption-location <region> \
--runtime python \
--runtime-version 3.11Region must support Flex Consumption — see supported regions.
2. Configure App Settings
az functionapp config appsettings set \
--name <function-app-name> \
--resource-group <resource-group> \
--settings \
"AzureWebJobsFeatureFlags=EnableMcpCustomHandlerPreview" \
"PYTHONPATH=/home/site/wwwroot/.python_packages/lib/site-packages"3. Build and Deploy
Azure Functions custom handlers require Python packages to be pre-built for the target platform (Linux x86_64, Python 3.11):
# Generate requirements.txt from pyproject.toml
uv pip compile pyproject.toml -o requirements.txt
# Install packages for the Azure Functions target platform
pip install -r requirements.txt \
--target .python_packages/lib/site-packages \
--platform manylinux2014_x86_64 \
--python-version 3.11 \
--only-binary=:all:
# Deploy (--no-build since packages are pre-built)
func azure functionapp publish <function-app-name> --python --no-buildAfter deployment, the server is live at https://<function-app-name>.azurewebsites.net/mcp.
Authentication
Choose one of three authentication options depending on your security requirements.
Option 1: No Authentication (Anonymous)
The server is open to the internet with no authentication. Anyone can connect.
This is the default configuration — host.json sets DefaultAuthorizationLevel to anonymous, and no App Service Authentication is configured.
No additional setup is required after deployment.
{
"mcpServers": {
"yfinance": {
"url": "https://<function-app-name>.azurewebsites.net/mcp"
}
}
}Option 2: Function Key Authentication
Azure Functions provides built-in key-based authentication. Clients must include a function key in each request.
Configure
Change
DefaultAuthorizationLevelinhost.jsonfromanonymoustofunction:{ "customHandler": { "http": { "DefaultAuthorizationLevel": "function" } } }Redeploy the function app.
Retrieve the default function key:
az functionapp keys list \ --name <function-app-name> \ --resource-group <resource-group> \ --query "functionKeys.default" -o tsv
Connect
Pass the key as a query parameter or header:
{
"mcpServers": {
"yfinance": {
"url": "https://<function-app-name>.azurewebsites.net/mcp?code=<function-key>"
}
}
}Or use the x-functions-key header:
curl -X POST https://<function-app-name>.azurewebsites.net/mcp \
-H "x-functions-key: <function-key>" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'Note: Function keys provide basic access control but are shared secrets. Rotate keys periodically via the Azure Portal or CLI. For production workloads with user-level access control, use Entra ID (Option 3).
Option 3: Microsoft Entra ID (Recommended for Production)
Built-in App Service Authentication implements the MCP authorization specification. Clients receive a 401 challenge and must authenticate via OAuth before connecting.
1. Configure an Identity Provider
In Azure Portal, open your function app → Settings → Authentication
Add an identity provider (e.g., Microsoft Entra ID)
The identity provider registration should be unique for this MCP server — don't reuse an existing registration from another app
Make note of the scopes defined in your registration (e.g.,
api://<client-id>/user_impersonation)Under App Service authentication settings:
Setting
Value
Restrict access
Require authentication
Unauthenticated requests
HTTP 401 Unauthorized
Token store
✅ Checked
2. Configure Protected Resource Metadata
MCP server authorization requires that the server host protected resource metadata (PRM):
az functionapp config appsettings set \
--name <function-app-name> \
--resource-group <resource-group> \
--settings "WEBSITE_AUTH_PRM_DEFAULT_WITH_SCOPES=api://<client-id>/user_impersonation"3. Preauthorize MCP Clients
Microsoft Entra ID does not support Dynamic Client Registration, so MCP clients must be preconfigured.
To preauthorize a client (e.g., VS Code):
On the Authentication page, click the Entra app name next to Microsoft
Go to Manage → Expose an API
Under Authorized client applications, click + Add a client application
Enter the client ID (VS Code:
aebc6443-996d-45c2-90f0-388ff96faa56)Select the
user_impersonationscope checkbox → Add application
Note: Without preauthorization, users or an admin must consent to the MCP server registration. Some clients (e.g., GitHub Copilot in VS Code) don't surface interactive login prompts, so preauthorization is required. For dev/test, you can grant consent by navigating to
<your-app-url>/.auth/login/aadin a browser.
Connect
{
"mcpServers": {
"yfinance": {
"url": "https://<function-app-name>.azurewebsites.net/mcp"
}
}
}MCP clients that support the MCP authorization specification (e.g., VS Code Copilot, Claude Desktop) will automatically handle the OAuth flow when connecting.
For full details, see Configure built-in MCP server authorization and the Azure Functions MCP tutorial.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/torosent/yfinance-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server