yfinance-agent-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yfinance_agent_mcp-0.1.0/LICENSE +21 -0
- yfinance_agent_mcp-0.1.0/PKG-INFO +200 -0
- yfinance_agent_mcp-0.1.0/README.md +166 -0
- yfinance_agent_mcp-0.1.0/pyproject.toml +135 -0
- yfinance_agent_mcp-0.1.0/pyproject.toml.orig +108 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/__init__.py +7 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/__main__.py +61 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/cache.py +88 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/config.py +109 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/errors.py +67 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/gateway.py +842 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/indicators.py +128 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/live.py +145 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/models.py +431 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/py.typed +0 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/ratelimit.py +88 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/server.py +65 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/shaping.py +189 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/__init__.py +33 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/context.py +120 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/datasets.py +198 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/events.py +149 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/fundamentals.py +180 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/markets.py +147 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/news.py +117 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/options.py +109 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/prices.py +227 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/screening.py +213 -0
- yfinance_agent_mcp-0.1.0/src/yfinance_agent_mcp/tools/streaming.py +92 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nikolay Kostadinov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yfinance-agent-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Read-only yfinance MCP server for AI trading-research agents: quotes, price history, news, screeners, fundamentals, options and live prices.
|
|
5
|
+
Keywords: mcp,mcp-server,model-context-protocol,yfinance,yahoo-finance,stock-market,market-data,finance,trading,stocks,options,financial-news,ai-agents,llm,claude,uvx
|
|
6
|
+
Author: Nikolay Kostadinov
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Dist: mcp>=2.3,<3
|
|
25
|
+
Requires-Dist: platformdirs>=4.0
|
|
26
|
+
Requires-Dist: yfinance>=1.8.0,<2
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
|
+
Project-URL: Homepage, https://n-kostadinov.github.io/yfinance-agent-mcp/
|
|
29
|
+
Project-URL: Documentation, https://n-kostadinov.github.io/yfinance-agent-mcp/
|
|
30
|
+
Project-URL: Repository, https://github.com/n-kostadinov/yfinance-agent-mcp
|
|
31
|
+
Project-URL: Issues, https://github.com/n-kostadinov/yfinance-agent-mcp/issues
|
|
32
|
+
Project-URL: Changelog, https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/CHANGELOG.md
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
<!-- mcp-name: io.github.n-kostadinov/yfinance-agent-mcp -->
|
|
36
|
+
|
|
37
|
+
# yfinance-agent-mcp: Yahoo Finance MCP server for AI trading-research agents
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/yfinance-agent-mcp/)
|
|
40
|
+
[](https://pypi.org/project/yfinance-agent-mcp/)
|
|
41
|
+
[](https://github.com/n-kostadinov/yfinance-agent-mcp/actions/workflows/ci.yml)
|
|
42
|
+
[](https://n-kostadinov.github.io/yfinance-agent-mcp/)
|
|
43
|
+
[](https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/LICENSE)
|
|
44
|
+
|
|
45
|
+
**yfinance-agent-mcp** is a read-only [Model Context Protocol](https://modelcontextprotocol.io/) server that gives AI agents market data from Yahoo Finance through [yfinance](https://github.com/ranaroussi/yfinance): quotes, price history with ready-made indicators, news, screeners, earnings and economic calendars, fundamentals, analyst views, options and live prices.
|
|
46
|
+
|
|
47
|
+
It is built for agents that follow news and trends and prepare trading decisions: answers are small, timestamped and honest about delays, and failures come back as actionable errors instead of empty data.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uvx yfinance-agent-mcp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**[Documentation](https://n-kostadinov.github.io/yfinance-agent-mcp/)** · **[Tools](https://n-kostadinov.github.io/yfinance-agent-mcp/tools/)** · **[Changelog](https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/CHANGELOG.md)**
|
|
54
|
+
|
|
55
|
+
## Why this server
|
|
56
|
+
|
|
57
|
+
- **13 tools that cover all of yfinance**, shaped for agents rather than one tool per library method.
|
|
58
|
+
- **Answers that fit in context.** Price history comes with returns, SMA 20/50/200, RSI 14, ATR 14 and the 52-week range instead of thousands of raw bars; every response stays under 20,000 characters by default.
|
|
59
|
+
- **Freshness you can check.** Every answer carries `as_of`; quotes add `market_state`, `quote_source` and `delay_min`, because many exchanges are delayed by 15 minutes.
|
|
60
|
+
- **Errors an agent can act on:** `rate_limited` (with the seconds to wait), `not_found`, `invalid_argument` (with the valid values) and `upstream_error`, never a silent empty result.
|
|
61
|
+
- **Gentle with Yahoo.** One shared session, a process-wide rate limit, a pause after HTTP 429, and a short-lived cache with its own expiry times.
|
|
62
|
+
- **Safe with news.** Publisher text arrives in fields marked `untrusted`, so agents treat headlines as data, not instructions.
|
|
63
|
+
- **Read-only.** It cannot place orders.
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
You need [uv](https://docs.astral.sh/uv/getting-started/installation/). `uvx` downloads and runs the server; it talks MCP over stdio.
|
|
68
|
+
|
|
69
|
+
### Claude Code
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
claude mcp add yfinance -- uvx yfinance-agent-mcp
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Or install the plugin, which adds the server and a market-research skill:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
/plugin marketplace add n-kostadinov/yfinance-agent-mcp
|
|
79
|
+
/plugin install yfinance@yfinance-agent-mcp
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
On Claude Code 2.1.275 or later this works in one step: `/plugin install yfinance --marketplace n-kostadinov/yfinance-agent-mcp`.
|
|
83
|
+
|
|
84
|
+
### Claude Desktop
|
|
85
|
+
|
|
86
|
+
Add to `claude_desktop_config.json`:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"mcpServers": {
|
|
91
|
+
"yfinance": {
|
|
92
|
+
"command": "uvx",
|
|
93
|
+
"args": ["yfinance-agent-mcp"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Cursor
|
|
100
|
+
|
|
101
|
+
Add to `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global):
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"mcpServers": {
|
|
106
|
+
"yfinance": {
|
|
107
|
+
"command": "uvx",
|
|
108
|
+
"args": ["yfinance-agent-mcp"]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### VS Code
|
|
115
|
+
|
|
116
|
+
Add to `.vscode/mcp.json`:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"servers": {
|
|
121
|
+
"yfinance": {
|
|
122
|
+
"type": "stdio",
|
|
123
|
+
"command": "uvx",
|
|
124
|
+
"args": ["yfinance-agent-mcp"]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Windsurf
|
|
131
|
+
|
|
132
|
+
Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": {
|
|
137
|
+
"yfinance": {
|
|
138
|
+
"command": "uvx",
|
|
139
|
+
"args": ["yfinance-agent-mcp"]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
More clients, including the Claude Agent SDK, are covered in the [client guides](https://n-kostadinov.github.io/yfinance-agent-mcp/clients/claude-code/).
|
|
146
|
+
|
|
147
|
+
## Tools
|
|
148
|
+
|
|
149
|
+
| Tool | What it answers |
|
|
150
|
+
|---|---|
|
|
151
|
+
| `search_symbols` | Which Yahoo symbol is "Nvidia", "SAP" or "gold"? |
|
|
152
|
+
| `get_quotes` | Price, change, day range, volume and freshness for up to 25 symbols |
|
|
153
|
+
| `get_market_overview` | Is the market open, and how are the indices doing? |
|
|
154
|
+
| `get_price_history` | Trend, momentum and volatility: indicators plus the latest bars |
|
|
155
|
+
| `get_news` | Latest news for symbols or a topic, newest first, publisher text marked untrusted |
|
|
156
|
+
| `screen_securities` | Candidates from Yahoo's predefined screens or a custom query |
|
|
157
|
+
| `get_sector_industry` | Leaders, ETFs and industries of a sector or industry |
|
|
158
|
+
| `get_events` | Earnings, IPO, economic and split calendars; a symbol's next earnings |
|
|
159
|
+
| `get_fundamentals` | Income, balance sheet, cash flow, valuation history, key ratios |
|
|
160
|
+
| `get_analyst_view` | Price targets, ratings, rating changes, EPS and revenue estimates |
|
|
161
|
+
| `get_options` | Calls and puts around the current price, every expiration |
|
|
162
|
+
| `get_ticker_dataset` | Holders, insider trades, dividends, splits, SEC filings, fund holdings and more |
|
|
163
|
+
| `get_live_quotes` | The price right now, from Yahoo's streaming feed |
|
|
164
|
+
|
|
165
|
+
Each tool is described in detail, with examples, in the [tool reference](https://n-kostadinov.github.io/yfinance-agent-mcp/tools/).
|
|
166
|
+
|
|
167
|
+
## Example prompts
|
|
168
|
+
|
|
169
|
+
- "What moved NVDA today? Check the news, the price action and whether earnings are coming."
|
|
170
|
+
- "Screen today's top gainers and tell me which ones have above-average volume and analyst upgrades."
|
|
171
|
+
- "Compare AAPL and MSFT: valuation, margins, growth and the 6-month trend."
|
|
172
|
+
- "Is the US market open? How are the indices and Bitcoin doing right now?"
|
|
173
|
+
|
|
174
|
+
## Configuration
|
|
175
|
+
|
|
176
|
+
Everything is optional; set environment variables in your client's server config.
|
|
177
|
+
|
|
178
|
+
| Variable | Default | Meaning |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| `YFINANCE_AGENT_MCP_RATE_LIMIT` | `2` | Requests per second to Yahoo |
|
|
181
|
+
| `YFINANCE_AGENT_MCP_RATE_BURST` | `5` | Requests allowed at once |
|
|
182
|
+
| `YFINANCE_AGENT_MCP_TTL_<CATEGORY>` | per category | Seconds a cached answer stays valid, e.g. `YFINANCE_AGENT_MCP_TTL_QUOTES=5` |
|
|
183
|
+
| `YFINANCE_AGENT_MCP_CACHE_DIR` | user cache dir | Where yfinance keeps its timezone and cookie caches |
|
|
184
|
+
| `YFINANCE_AGENT_MCP_LANG` / `_REGION` | `en-US` / `US` | Yahoo locale |
|
|
185
|
+
| `YFINANCE_AGENT_MCP_PROXY` | none | Proxy URL for Yahoo requests |
|
|
186
|
+
| `YFINANCE_AGENT_MCP_LOG_LEVEL` | `WARNING` | Log level (logs go to stderr) |
|
|
187
|
+
|
|
188
|
+
See the [configuration guide](https://n-kostadinov.github.io/yfinance-agent-mcp/configuration/) for all cache categories.
|
|
189
|
+
|
|
190
|
+
## Disclaimer
|
|
191
|
+
|
|
192
|
+
yfinance-agent-mcp is not affiliated with, endorsed by, or vetted by Yahoo. It uses yfinance, which reads Yahoo Finance's publicly available endpoints; Yahoo's [terms of service](https://legal.yahoo.com/us/en/yahoo/terms/otos/index.html) say the data is for personal use. Data can be delayed, incomplete or wrong. Nothing here is investment advice, and the server cannot trade. Read the full [disclaimer](https://n-kostadinov.github.io/yfinance-agent-mcp/disclaimer/).
|
|
193
|
+
|
|
194
|
+
## Contributing
|
|
195
|
+
|
|
196
|
+
Issues and pull requests are welcome. See the [contributing guide](https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/CONTRIBUTING.md) to set up the project with uv and run the tests.
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
[MIT](https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/LICENSE)
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<!-- mcp-name: io.github.n-kostadinov/yfinance-agent-mcp -->
|
|
2
|
+
|
|
3
|
+
# yfinance-agent-mcp: Yahoo Finance MCP server for AI trading-research agents
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/yfinance-agent-mcp/)
|
|
6
|
+
[](https://pypi.org/project/yfinance-agent-mcp/)
|
|
7
|
+
[](https://github.com/n-kostadinov/yfinance-agent-mcp/actions/workflows/ci.yml)
|
|
8
|
+
[](https://n-kostadinov.github.io/yfinance-agent-mcp/)
|
|
9
|
+
[](https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/LICENSE)
|
|
10
|
+
|
|
11
|
+
**yfinance-agent-mcp** is a read-only [Model Context Protocol](https://modelcontextprotocol.io/) server that gives AI agents market data from Yahoo Finance through [yfinance](https://github.com/ranaroussi/yfinance): quotes, price history with ready-made indicators, news, screeners, earnings and economic calendars, fundamentals, analyst views, options and live prices.
|
|
12
|
+
|
|
13
|
+
It is built for agents that follow news and trends and prepare trading decisions: answers are small, timestamped and honest about delays, and failures come back as actionable errors instead of empty data.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uvx yfinance-agent-mcp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**[Documentation](https://n-kostadinov.github.io/yfinance-agent-mcp/)** · **[Tools](https://n-kostadinov.github.io/yfinance-agent-mcp/tools/)** · **[Changelog](https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/CHANGELOG.md)**
|
|
20
|
+
|
|
21
|
+
## Why this server
|
|
22
|
+
|
|
23
|
+
- **13 tools that cover all of yfinance**, shaped for agents rather than one tool per library method.
|
|
24
|
+
- **Answers that fit in context.** Price history comes with returns, SMA 20/50/200, RSI 14, ATR 14 and the 52-week range instead of thousands of raw bars; every response stays under 20,000 characters by default.
|
|
25
|
+
- **Freshness you can check.** Every answer carries `as_of`; quotes add `market_state`, `quote_source` and `delay_min`, because many exchanges are delayed by 15 minutes.
|
|
26
|
+
- **Errors an agent can act on:** `rate_limited` (with the seconds to wait), `not_found`, `invalid_argument` (with the valid values) and `upstream_error`, never a silent empty result.
|
|
27
|
+
- **Gentle with Yahoo.** One shared session, a process-wide rate limit, a pause after HTTP 429, and a short-lived cache with its own expiry times.
|
|
28
|
+
- **Safe with news.** Publisher text arrives in fields marked `untrusted`, so agents treat headlines as data, not instructions.
|
|
29
|
+
- **Read-only.** It cannot place orders.
|
|
30
|
+
|
|
31
|
+
## Quick start
|
|
32
|
+
|
|
33
|
+
You need [uv](https://docs.astral.sh/uv/getting-started/installation/). `uvx` downloads and runs the server; it talks MCP over stdio.
|
|
34
|
+
|
|
35
|
+
### Claude Code
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
claude mcp add yfinance -- uvx yfinance-agent-mcp
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or install the plugin, which adds the server and a market-research skill:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
/plugin marketplace add n-kostadinov/yfinance-agent-mcp
|
|
45
|
+
/plugin install yfinance@yfinance-agent-mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
On Claude Code 2.1.275 or later this works in one step: `/plugin install yfinance --marketplace n-kostadinov/yfinance-agent-mcp`.
|
|
49
|
+
|
|
50
|
+
### Claude Desktop
|
|
51
|
+
|
|
52
|
+
Add to `claude_desktop_config.json`:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"yfinance": {
|
|
58
|
+
"command": "uvx",
|
|
59
|
+
"args": ["yfinance-agent-mcp"]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Cursor
|
|
66
|
+
|
|
67
|
+
Add to `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global):
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"mcpServers": {
|
|
72
|
+
"yfinance": {
|
|
73
|
+
"command": "uvx",
|
|
74
|
+
"args": ["yfinance-agent-mcp"]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### VS Code
|
|
81
|
+
|
|
82
|
+
Add to `.vscode/mcp.json`:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"servers": {
|
|
87
|
+
"yfinance": {
|
|
88
|
+
"type": "stdio",
|
|
89
|
+
"command": "uvx",
|
|
90
|
+
"args": ["yfinance-agent-mcp"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Windsurf
|
|
97
|
+
|
|
98
|
+
Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"yfinance": {
|
|
104
|
+
"command": "uvx",
|
|
105
|
+
"args": ["yfinance-agent-mcp"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
More clients, including the Claude Agent SDK, are covered in the [client guides](https://n-kostadinov.github.io/yfinance-agent-mcp/clients/claude-code/).
|
|
112
|
+
|
|
113
|
+
## Tools
|
|
114
|
+
|
|
115
|
+
| Tool | What it answers |
|
|
116
|
+
|---|---|
|
|
117
|
+
| `search_symbols` | Which Yahoo symbol is "Nvidia", "SAP" or "gold"? |
|
|
118
|
+
| `get_quotes` | Price, change, day range, volume and freshness for up to 25 symbols |
|
|
119
|
+
| `get_market_overview` | Is the market open, and how are the indices doing? |
|
|
120
|
+
| `get_price_history` | Trend, momentum and volatility: indicators plus the latest bars |
|
|
121
|
+
| `get_news` | Latest news for symbols or a topic, newest first, publisher text marked untrusted |
|
|
122
|
+
| `screen_securities` | Candidates from Yahoo's predefined screens or a custom query |
|
|
123
|
+
| `get_sector_industry` | Leaders, ETFs and industries of a sector or industry |
|
|
124
|
+
| `get_events` | Earnings, IPO, economic and split calendars; a symbol's next earnings |
|
|
125
|
+
| `get_fundamentals` | Income, balance sheet, cash flow, valuation history, key ratios |
|
|
126
|
+
| `get_analyst_view` | Price targets, ratings, rating changes, EPS and revenue estimates |
|
|
127
|
+
| `get_options` | Calls and puts around the current price, every expiration |
|
|
128
|
+
| `get_ticker_dataset` | Holders, insider trades, dividends, splits, SEC filings, fund holdings and more |
|
|
129
|
+
| `get_live_quotes` | The price right now, from Yahoo's streaming feed |
|
|
130
|
+
|
|
131
|
+
Each tool is described in detail, with examples, in the [tool reference](https://n-kostadinov.github.io/yfinance-agent-mcp/tools/).
|
|
132
|
+
|
|
133
|
+
## Example prompts
|
|
134
|
+
|
|
135
|
+
- "What moved NVDA today? Check the news, the price action and whether earnings are coming."
|
|
136
|
+
- "Screen today's top gainers and tell me which ones have above-average volume and analyst upgrades."
|
|
137
|
+
- "Compare AAPL and MSFT: valuation, margins, growth and the 6-month trend."
|
|
138
|
+
- "Is the US market open? How are the indices and Bitcoin doing right now?"
|
|
139
|
+
|
|
140
|
+
## Configuration
|
|
141
|
+
|
|
142
|
+
Everything is optional; set environment variables in your client's server config.
|
|
143
|
+
|
|
144
|
+
| Variable | Default | Meaning |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| `YFINANCE_AGENT_MCP_RATE_LIMIT` | `2` | Requests per second to Yahoo |
|
|
147
|
+
| `YFINANCE_AGENT_MCP_RATE_BURST` | `5` | Requests allowed at once |
|
|
148
|
+
| `YFINANCE_AGENT_MCP_TTL_<CATEGORY>` | per category | Seconds a cached answer stays valid, e.g. `YFINANCE_AGENT_MCP_TTL_QUOTES=5` |
|
|
149
|
+
| `YFINANCE_AGENT_MCP_CACHE_DIR` | user cache dir | Where yfinance keeps its timezone and cookie caches |
|
|
150
|
+
| `YFINANCE_AGENT_MCP_LANG` / `_REGION` | `en-US` / `US` | Yahoo locale |
|
|
151
|
+
| `YFINANCE_AGENT_MCP_PROXY` | none | Proxy URL for Yahoo requests |
|
|
152
|
+
| `YFINANCE_AGENT_MCP_LOG_LEVEL` | `WARNING` | Log level (logs go to stderr) |
|
|
153
|
+
|
|
154
|
+
See the [configuration guide](https://n-kostadinov.github.io/yfinance-agent-mcp/configuration/) for all cache categories.
|
|
155
|
+
|
|
156
|
+
## Disclaimer
|
|
157
|
+
|
|
158
|
+
yfinance-agent-mcp is not affiliated with, endorsed by, or vetted by Yahoo. It uses yfinance, which reads Yahoo Finance's publicly available endpoints; Yahoo's [terms of service](https://legal.yahoo.com/us/en/yahoo/terms/otos/index.html) say the data is for personal use. Data can be delayed, incomplete or wrong. Nothing here is investment advice, and the server cannot trade. Read the full [disclaimer](https://n-kostadinov.github.io/yfinance-agent-mcp/disclaimer/).
|
|
159
|
+
|
|
160
|
+
## Contributing
|
|
161
|
+
|
|
162
|
+
Issues and pull requests are welcome. See the [contributing guide](https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/CONTRIBUTING.md) to set up the project with uv and run the tests.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
[MIT](https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/LICENSE)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "yfinance-agent-mcp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Read-only yfinance MCP server for AI trading-research agents: quotes, price history, news, screeners, fundamentals, options and live prices."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
keywords = [
|
|
10
|
+
"mcp",
|
|
11
|
+
"mcp-server",
|
|
12
|
+
"model-context-protocol",
|
|
13
|
+
"yfinance",
|
|
14
|
+
"yahoo-finance",
|
|
15
|
+
"stock-market",
|
|
16
|
+
"market-data",
|
|
17
|
+
"finance",
|
|
18
|
+
"trading",
|
|
19
|
+
"stocks",
|
|
20
|
+
"options",
|
|
21
|
+
"financial-news",
|
|
22
|
+
"ai-agents",
|
|
23
|
+
"llm",
|
|
24
|
+
"claude",
|
|
25
|
+
"uvx",
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 4 - Beta",
|
|
29
|
+
"Environment :: Console",
|
|
30
|
+
"Intended Audience :: Developers",
|
|
31
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
32
|
+
"Intended Audience :: Science/Research",
|
|
33
|
+
"Operating System :: OS Independent",
|
|
34
|
+
"Programming Language :: Python :: 3",
|
|
35
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
36
|
+
"Programming Language :: Python :: 3.11",
|
|
37
|
+
"Programming Language :: Python :: 3.12",
|
|
38
|
+
"Programming Language :: Python :: 3.13",
|
|
39
|
+
"Programming Language :: Python :: 3.14",
|
|
40
|
+
"Topic :: Office/Business :: Financial :: Investment",
|
|
41
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
42
|
+
"Typing :: Typed",
|
|
43
|
+
]
|
|
44
|
+
dependencies = [
|
|
45
|
+
"mcp>=2.3,<3",
|
|
46
|
+
"platformdirs>=4.0",
|
|
47
|
+
"yfinance>=1.8.0,<2",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[[project.authors]]
|
|
51
|
+
name = "Nikolay Kostadinov"
|
|
52
|
+
|
|
53
|
+
[project.urls]
|
|
54
|
+
Homepage = "https://n-kostadinov.github.io/yfinance-agent-mcp/"
|
|
55
|
+
Documentation = "https://n-kostadinov.github.io/yfinance-agent-mcp/"
|
|
56
|
+
Repository = "https://github.com/n-kostadinov/yfinance-agent-mcp"
|
|
57
|
+
Issues = "https://github.com/n-kostadinov/yfinance-agent-mcp/issues"
|
|
58
|
+
Changelog = "https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/CHANGELOG.md"
|
|
59
|
+
|
|
60
|
+
[project.scripts]
|
|
61
|
+
yfinance-agent-mcp = "yfinance_agent_mcp.__main__:main"
|
|
62
|
+
|
|
63
|
+
[build-system]
|
|
64
|
+
requires = ["uv_build>=0.13.9,<0.14"]
|
|
65
|
+
build-backend = "uv_build"
|
|
66
|
+
|
|
67
|
+
[tool.uv]
|
|
68
|
+
required-version = ">=0.13.9"
|
|
69
|
+
|
|
70
|
+
[tool.ruff]
|
|
71
|
+
line-length = 100
|
|
72
|
+
target-version = "py311"
|
|
73
|
+
src = [
|
|
74
|
+
"src",
|
|
75
|
+
"tests",
|
|
76
|
+
"scripts",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.ruff.lint]
|
|
80
|
+
select = [
|
|
81
|
+
"E",
|
|
82
|
+
"F",
|
|
83
|
+
"W",
|
|
84
|
+
"I",
|
|
85
|
+
"B",
|
|
86
|
+
"UP",
|
|
87
|
+
"SIM",
|
|
88
|
+
"RUF",
|
|
89
|
+
"PT",
|
|
90
|
+
"C4",
|
|
91
|
+
"RET",
|
|
92
|
+
"N",
|
|
93
|
+
"PIE",
|
|
94
|
+
]
|
|
95
|
+
ignore = ["N818"]
|
|
96
|
+
|
|
97
|
+
[tool.pyright]
|
|
98
|
+
include = [
|
|
99
|
+
"src",
|
|
100
|
+
"tests",
|
|
101
|
+
"scripts",
|
|
102
|
+
]
|
|
103
|
+
pythonVersion = "3.11"
|
|
104
|
+
typeCheckingMode = "standard"
|
|
105
|
+
venvPath = "."
|
|
106
|
+
venv = ".venv"
|
|
107
|
+
|
|
108
|
+
[tool.pytest.ini_options]
|
|
109
|
+
testpaths = ["tests"]
|
|
110
|
+
addopts = [
|
|
111
|
+
"-ra",
|
|
112
|
+
"--strict-markers",
|
|
113
|
+
"-m",
|
|
114
|
+
"not live",
|
|
115
|
+
]
|
|
116
|
+
markers = ["live: calls the real Yahoo Finance service over the network"]
|
|
117
|
+
|
|
118
|
+
[tool.coverage.run]
|
|
119
|
+
source = ["yfinance_agent_mcp"]
|
|
120
|
+
branch = true
|
|
121
|
+
|
|
122
|
+
[tool.coverage.report]
|
|
123
|
+
show_missing = true
|
|
124
|
+
skip_covered = true
|
|
125
|
+
fail_under = 85
|
|
126
|
+
|
|
127
|
+
[dependency-groups]
|
|
128
|
+
dev = [
|
|
129
|
+
"anyio>=4.9",
|
|
130
|
+
"pyright[nodejs]>=1.1.414",
|
|
131
|
+
"pytest>=9.2",
|
|
132
|
+
"pytest-cov>=7.1",
|
|
133
|
+
"ruff>=0.17",
|
|
134
|
+
"zensical>=0.1.3,<0.2",
|
|
135
|
+
]
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "yfinance-agent-mcp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Read-only yfinance MCP server for AI trading-research agents: quotes, price history, news, screeners, fundamentals, options and live prices."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Nikolay Kostadinov" }]
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
keywords = [
|
|
11
|
+
"mcp",
|
|
12
|
+
"mcp-server",
|
|
13
|
+
"model-context-protocol",
|
|
14
|
+
"yfinance",
|
|
15
|
+
"yahoo-finance",
|
|
16
|
+
"stock-market",
|
|
17
|
+
"market-data",
|
|
18
|
+
"finance",
|
|
19
|
+
"trading",
|
|
20
|
+
"stocks",
|
|
21
|
+
"options",
|
|
22
|
+
"financial-news",
|
|
23
|
+
"ai-agents",
|
|
24
|
+
"llm",
|
|
25
|
+
"claude",
|
|
26
|
+
"uvx",
|
|
27
|
+
]
|
|
28
|
+
classifiers = [
|
|
29
|
+
"Development Status :: 4 - Beta",
|
|
30
|
+
"Environment :: Console",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
32
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
33
|
+
"Intended Audience :: Science/Research",
|
|
34
|
+
"Operating System :: OS Independent",
|
|
35
|
+
"Programming Language :: Python :: 3",
|
|
36
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
"Programming Language :: Python :: 3.13",
|
|
40
|
+
"Programming Language :: Python :: 3.14",
|
|
41
|
+
"Topic :: Office/Business :: Financial :: Investment",
|
|
42
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
43
|
+
"Typing :: Typed",
|
|
44
|
+
]
|
|
45
|
+
dependencies = [
|
|
46
|
+
"mcp>=2.3,<3",
|
|
47
|
+
"platformdirs>=4.0",
|
|
48
|
+
"yfinance>=1.8.0,<2",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[project.urls]
|
|
52
|
+
Homepage = "https://n-kostadinov.github.io/yfinance-agent-mcp/"
|
|
53
|
+
Documentation = "https://n-kostadinov.github.io/yfinance-agent-mcp/"
|
|
54
|
+
Repository = "https://github.com/n-kostadinov/yfinance-agent-mcp"
|
|
55
|
+
Issues = "https://github.com/n-kostadinov/yfinance-agent-mcp/issues"
|
|
56
|
+
Changelog = "https://github.com/n-kostadinov/yfinance-agent-mcp/blob/main/CHANGELOG.md"
|
|
57
|
+
|
|
58
|
+
[project.scripts]
|
|
59
|
+
yfinance-agent-mcp = "yfinance_agent_mcp.__main__:main"
|
|
60
|
+
|
|
61
|
+
[build-system]
|
|
62
|
+
requires = ["uv_build>=0.13.9,<0.14"]
|
|
63
|
+
build-backend = "uv_build"
|
|
64
|
+
|
|
65
|
+
[tool.uv]
|
|
66
|
+
required-version = ">=0.13.9"
|
|
67
|
+
|
|
68
|
+
[dependency-groups]
|
|
69
|
+
dev = [
|
|
70
|
+
"anyio>=4.9",
|
|
71
|
+
"pyright[nodejs]>=1.1.414",
|
|
72
|
+
"pytest>=9.2",
|
|
73
|
+
"pytest-cov>=7.1",
|
|
74
|
+
"ruff>=0.17",
|
|
75
|
+
"zensical>=0.1.3,<0.2",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[tool.ruff]
|
|
79
|
+
line-length = 100
|
|
80
|
+
target-version = "py311"
|
|
81
|
+
src = ["src", "tests", "scripts"]
|
|
82
|
+
|
|
83
|
+
[tool.ruff.lint]
|
|
84
|
+
select = ["E", "F", "W", "I", "B", "UP", "SIM", "RUF", "PT", "C4", "RET", "N", "PIE"]
|
|
85
|
+
# Error classes use domain names (RateLimited, NotFound) rather than an "Error" suffix.
|
|
86
|
+
ignore = ["N818"]
|
|
87
|
+
|
|
88
|
+
[tool.pyright]
|
|
89
|
+
include = ["src", "tests", "scripts"]
|
|
90
|
+
pythonVersion = "3.11"
|
|
91
|
+
typeCheckingMode = "standard"
|
|
92
|
+
venvPath = "."
|
|
93
|
+
venv = ".venv"
|
|
94
|
+
|
|
95
|
+
[tool.pytest.ini_options]
|
|
96
|
+
testpaths = ["tests"]
|
|
97
|
+
addopts = ["-ra", "--strict-markers", "-m", "not live"]
|
|
98
|
+
markers = ["live: calls the real Yahoo Finance service over the network"]
|
|
99
|
+
|
|
100
|
+
[tool.coverage.run]
|
|
101
|
+
source = ["yfinance_agent_mcp"]
|
|
102
|
+
branch = true
|
|
103
|
+
|
|
104
|
+
[tool.coverage.report]
|
|
105
|
+
show_missing = true
|
|
106
|
+
skip_covered = true
|
|
107
|
+
# Enforced whenever coverage is measured: `uv run pytest --cov`.
|
|
108
|
+
fail_under = 85
|