This MCP server for Yahoo Finance integrates with the yfinance package to provide tools for fetching stock data, news, and other financial information through a Model Context Protocol interface. It offers a streamlined way to access Yahoo Finance data in your applications.
First, install uv by following the instructions at the uv documentation
Add this configuration to your MCP server configuration file:
{
"mcpServers": {
"yfmcp": {
"command": "uvx",
"args": ["yfmcp@latest"]
}
}
}
If you prefer Docker, add this configuration to your MCP server configuration file:
{
"mcpServers": {
"yfmcp": {
"command": "docker",
"args": ["run", "-i", "--rm", "narumi/yfinance-mcp"]
}
}
}
The get_ticker_info tool retrieves comprehensive stock data including company information, financials, trading metrics, and governance data.
Input:
symbol
(string): The stock ticker symbol (e.g., "AAPL", "MSFT")The get_ticker_news tool fetches recent news articles related to a specific stock symbol, including title, content, and source details.
Input:
symbol
(string): The stock ticker symbolThe search tool retrieves and organizes search results from Yahoo Finance.
Inputs:
query
(string): Search query (ticker symbol or company name)search_type
(string): Type of search results to retrieve. Options:
The get_top tool retrieves top entities in a specified sector.
Inputs:
sector
(string): The sector to analyzetop_type
(string): Type of top entities to retrieve. Options:
top_n
(number, optional): Number of top entities to retrieve (default: 10)The get_price_history tool fetches historical price data for a given stock symbol.
Inputs:
symbol
(string): The stock ticker symbolperiod
(string, optional): Time period for data retrieval (e.g., '1d', '1mo', '1y'). Default: '1mo'interval
(string, optional): Data interval frequency (e.g., '1d', '1h', '1m'). Default: '1d'# Example MCP client call to get ticker info
response = mcp_client.call("yfmcp", "get_ticker_info", {"symbol": "AAPL"})
# Example MCP client call to search for Tesla quotes and news
response = mcp_client.call("yfmcp", "search", {
"query": "Tesla",
"search_type": "all"
})
# Example MCP client call to get 6-month price history for Amazon
response = mcp_client.call("yfmcp", "get_price_history", {
"symbol": "AMZN",
"period": "6mo",
"interval": "1d"
})
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.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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.
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.