openmarkets 0.1.0a0__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.
Files changed (30) hide show
  1. openmarkets-0.1.0a0/PKG-INFO +256 -0
  2. openmarkets-0.1.0a0/README.md +217 -0
  3. openmarkets-0.1.0a0/pyproject.toml +122 -0
  4. openmarkets-0.1.0a0/src/openmarkets/__init__.py +8 -0
  5. openmarkets-0.1.0a0/src/openmarkets/__main__.py +13 -0
  6. openmarkets-0.1.0a0/src/openmarkets/core/__init__.py +8 -0
  7. openmarkets-0.1.0a0/src/openmarkets/core/config.py +40 -0
  8. openmarkets-0.1.0a0/src/openmarkets/core/create_app.py +37 -0
  9. openmarkets-0.1.0a0/src/openmarkets/core/exceptions.py +22 -0
  10. openmarkets-0.1.0a0/src/openmarkets/core/fastmcp.py +41 -0
  11. openmarkets-0.1.0a0/src/openmarkets/core/registry.py +89 -0
  12. openmarkets-0.1.0a0/src/openmarkets/core/serializers.py +53 -0
  13. openmarkets-0.1.0a0/src/openmarkets/core/server.py +88 -0
  14. openmarkets-0.1.0a0/src/openmarkets/core/types.py +11 -0
  15. openmarkets-0.1.0a0/src/openmarkets/py.typed +0 -0
  16. openmarkets-0.1.0a0/src/openmarkets/tools/__init__.py +7 -0
  17. openmarkets-0.1.0a0/src/openmarkets/tools/analyst_data.py +56 -0
  18. openmarkets-0.1.0a0/src/openmarkets/tools/calendar.py +96 -0
  19. openmarkets-0.1.0a0/src/openmarkets/tools/corporate_actions.py +168 -0
  20. openmarkets-0.1.0a0/src/openmarkets/tools/crypto.py +216 -0
  21. openmarkets-0.1.0a0/src/openmarkets/tools/extended_market.py +326 -0
  22. openmarkets-0.1.0a0/src/openmarkets/tools/financial_statements.py +118 -0
  23. openmarkets-0.1.0a0/src/openmarkets/tools/funds.py +181 -0
  24. openmarkets-0.1.0a0/src/openmarkets/tools/historical_data.py +111 -0
  25. openmarkets-0.1.0a0/src/openmarkets/tools/market_data.py +168 -0
  26. openmarkets-0.1.0a0/src/openmarkets/tools/news.py +153 -0
  27. openmarkets-0.1.0a0/src/openmarkets/tools/options.py +219 -0
  28. openmarkets-0.1.0a0/src/openmarkets/tools/screener.py +392 -0
  29. openmarkets-0.1.0a0/src/openmarkets/tools/stock_info.py +274 -0
  30. openmarkets-0.1.0a0/src/openmarkets/tools/technical_analysis.py +126 -0
@@ -0,0 +1,256 @@
1
+ Metadata-Version: 2.3
2
+ Name: openmarkets
3
+ Version: 0.1.0a0
4
+ Summary: A Model Context Protocol (MCP) server for agentic retrieval of financial market data. This server leverages YFinance to provide a simple and efficient way to access historical stock prices, dividends, stock splits, company information, and other financial metrics.
5
+ Keywords: machinelearning,finance,investment,mcp,modelcontextprotocol,yahoo finance,financial data retrieval
6
+ Author: Dobri Danchev
7
+ Author-email: Dobri Danchev <python-dist@danchev.net>
8
+ License: AGPL-3.0-or-later
9
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: Topic :: Office/Business :: Financial
15
+ Classifier: Topic :: Office/Business :: Financial :: Investment
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Programming Language :: Python
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Programming Language :: Python :: 3 :: Only
29
+ Requires-Dist: mcp[cli]>=1.18.0
30
+ Requires-Dist: yfinance>=0.2.66
31
+ Requires-Dist: fastmcp>=2.13.0rc1 ; extra == 'fastmcp'
32
+ Requires-Python: >=3.10
33
+ Project-URL: Documentation, https://danchev.github.io/openmarkets/
34
+ Project-URL: Homepage, https://openmarkets.dev
35
+ Project-URL: Issues, https://github.com/danchev/openmarkets/issues
36
+ Project-URL: Source, https://github.com/danchev/openmarkets
37
+ Provides-Extra: fastmcp
38
+ Description-Content-Type: text/markdown
39
+
40
+ ![PyPI](https://img.shields.io/pypi/v/openmarkets)
41
+ [![PyPI - Downloads](https://static.pepy.tech/badge/openmarkets)](https://pypi.org/project/openmarkets)
42
+ [![PyPI - Monthly Downloads](https://static.pepy.tech/badge/openmarkets/month)](https://pypi.org/project/openmarkets)
43
+
44
+ # Open Markets
45
+
46
+ A Model Context Protocol (MCP) server for agentic retrieval of financial data from Yahoo Finance. This server leverages YFinance to provide a simple and efficient way to access historical stock prices, dividends, stock splits, company information, and other financial metrics.
47
+
48
+ This MCP server is designed to be used with various LLM applications that support the Model Context Protocol, such as Claude Desktop, n8n, and Cursor. It allows users to retrieve financial data in a structured way, making it easy to integrate into AI applications.
49
+
50
+ ![MCP with OpenMarkets](https://r2.openmarkets.dev/80f5e8f644e3f9.gif)
51
+
52
+ ## Features
53
+
54
+ - Get basic stock information (price, market cap, sector, etc.)
55
+ - Fetch historical price data with customizable periods
56
+ - Retrieve analyst recommendations
57
+ - Download data for multiple stocks simultaneously
58
+ - Access dividend history
59
+
60
+ ## Usage
61
+
62
+ This MCP server can be used with various LLM applications that support the Model Context Protocol:
63
+
64
+ - **Claude Desktop**: Anthropic's desktop application for Claude
65
+ - **Cursor**: AI-powered code editor with MCP support
66
+ - **Custom MCP clients**: Any application implementing the MCP client specification
67
+
68
+ ## Usage with Claude Desktop
69
+
70
+ 1. Install Claude Desktop from https://claude.ai/download
71
+ 2. Open your Claude Desktop configuration:
72
+
73
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
74
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
75
+
76
+ 3. Add the following configuration:
77
+
78
+ ```json
79
+ {
80
+ "mcpServers": {
81
+ "openmarkets": {
82
+ "command": "uvx",
83
+ "args": [
84
+ "openmarkets@latest"
85
+ ]
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ 4. Restart Claude Desktop
92
+
93
+ ## Usage with VS Code
94
+
95
+ For quick installation, use one of the one-click installation buttons below:
96
+
97
+ [![Install with UVX in VS Code](https://img.shields.io/badge/VS_Code-UV-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=openmarkets&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22openmarkets%22%5D%7D) [![Install with UVX in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-UV-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=openmarkets&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22openmarkets%22%5D%7D&quality=insiders)
98
+
99
+ For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing `Ctrl + Shift + P` and typing `Preferences: Open Settings (JSON)`.
100
+
101
+ Optionally, you can add it to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.
102
+
103
+ > Note that the `mcp` key is not needed in the `.vscode/mcp.json` file.
104
+
105
+ #### UVX
106
+
107
+ ```json
108
+ {
109
+ "mcp": {
110
+ "servers": {
111
+ "openmarkets": {
112
+ "command": "uvx",
113
+ "args": [
114
+ "openmarkets@latest"
115
+ ]
116
+ }
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ ### Available Tools
123
+ This MCP server provides a variety of tools for retrieving financial data. Below is a list of available tools and their main arguments:
124
+
125
+ ---
126
+ #### Stock Information
127
+ - **get_stock_info(ticker: str)**
128
+ Get basic information about a stock.
129
+
130
+ #### Historical Data
131
+ - **get_historical_data(ticker: str, period: str = "1mo", interval: str = "1d")**
132
+ Get historical price data for a stock.
133
+ - **get_multiple_tickers(tickers: list[str], period: str = "1d")**
134
+ Get data for multiple stocks at once.
135
+ - **download_bulk_data(tickers: list[str], period: str = "1mo", interval: str = "1d", ...)**
136
+ Download bulk historical data for multiple tickers.
137
+ - **get_ticker_history_metadata(ticker: str)**
138
+ Get available periods, intervals, and metadata for a ticker.
139
+
140
+ #### Analyst Data
141
+ - **get_recommendations(ticker: str)**
142
+ Get analyst recommendations for a stock.
143
+ - **get_analyst_price_targets(ticker: str)**
144
+ Get analyst price targets.
145
+ - **get_upgrades_downgrades(ticker: str)**
146
+ Get recent upgrades and downgrades.
147
+ - **get_recommendations_summary(ticker: str)**
148
+ Get recommendations summary.
149
+
150
+ #### Corporate Actions
151
+ - **get_dividends(symbol: str, period: str = "5y")**
152
+ Get dividend history for a stock.
153
+ - **get_splits_history(symbol: str, period: str = "5y")**
154
+ Get stock split history.
155
+
156
+ #### Market Data
157
+ - **get_market_status()**
158
+ Get current US market status.
159
+ - **get_trending_tickers(region: str = "US", count: int = 10)**
160
+ Get trending/popular tickers.
161
+ - **get_sector_performance()**
162
+ Get sector performance using ETFs.
163
+ - **get_index_data(indices: list[str] = None)**
164
+ Get data for major market indices.
165
+
166
+ #### Calendar & Market Hours
167
+ - **get_market_calendar_info(ticker: str)**
168
+ Get market calendar and session info.
169
+ - **get_market_hours(ticker: str)**
170
+ Get market hours and session information.
171
+ - **get_exchange_info(ticker: str)**
172
+ Get detailed exchange and trading information.
173
+
174
+ #### Screener & Search
175
+ - **screen_stocks_by_criteria(...)**
176
+ Screen stocks by market cap, P/E, dividend yield, sector, etc.
177
+ - **get_similar_stocks(ticker: str, count: int = 5)**
178
+ Find similar stocks by sector and market cap.
179
+ - **get_top_performers(period: str = "1mo", sector: str = None, count: int = 10)**
180
+ Get top performing stocks.
181
+
182
+ #### Technical Analysis
183
+ - **get_technical_indicators(ticker: str, period: str = "6mo")**
184
+ Get technical indicators (SMA, price position, etc.).
185
+ - **get_volatility_metrics(ticker: str, period: str = "1y")**
186
+ Get volatility and risk metrics.
187
+ - **get_support_resistance_levels(ticker: str, period: str = "6mo")**
188
+ Get support and resistance levels.
189
+
190
+ #### Options
191
+ - **get_options_expiration_dates(ticker: str)**
192
+ Get available options expiration dates.
193
+ - **get_option_chain(ticker: str, expiration_date: str = None)**
194
+ Get option chain for a ticker.
195
+ - **get_options_volume_analysis(ticker: str, expiration_date: str = None)**
196
+ Analyze options volume and open interest.
197
+ - **get_options_by_moneyness(ticker: str, expiration_date: str = None, moneyness_range: float = 0.1)**
198
+ Filter options by proximity to current price.
199
+
200
+ #### Financial Statements
201
+ - **get_financials_summary(ticker: str)**
202
+ Get key financial metrics summary.
203
+
204
+ #### Funds & ETFs
205
+ - **get_fund_profile(ticker: str)**
206
+ Get fund/ETF profile.
207
+ - **get_fund_holdings(ticker: str, count: int = 20)**
208
+ Get top holdings of a fund/ETF.
209
+ - **get_fund_sector_allocation(ticker: str)**
210
+ Get sector allocation of a fund/ETF.
211
+ - **get_fund_performance(ticker: str)**
212
+ Get fund/ETF performance metrics.
213
+ - **compare_funds(tickers: list[str])**
214
+ Compare multiple funds/ETFs.
215
+
216
+ #### Crypto
217
+ - **get_crypto_info(crypto_symbol: str)**
218
+ Get cryptocurrency info.
219
+ - **get_crypto_historical_data(crypto_symbol: str, period: str = "1mo", interval: str = "1d")**
220
+ Get historical data for a cryptocurrency.
221
+ - **get_top_cryptocurrencies(count: int = 10)**
222
+ Get data for top cryptocurrencies.
223
+ - **get_crypto_fear_greed_proxy(crypto_symbols: list[str] = None)**
224
+ Get a proxy for crypto fear/greed index.
225
+
226
+ #### Currency & Validation
227
+ - **get_currency_data(base_currency: str = "USD", target_currencies: list[str] = None)**
228
+ Get currency exchange rates.
229
+ - **validate_tickers(tickers: list[str])**
230
+ Validate if tickers are valid and available.
231
+
232
+ ---
233
+
234
+ This list reflects the tools registered in the codebase and their main arguments. For more details, see the respective files in tools.
235
+
236
+ ## Development
237
+
238
+ To test the MCP server locally, install the `uvx` and `npx` and run the following command:
239
+
240
+ ```bash
241
+ npx @modelcontextprotocol/inspector uvx openmarkets@latest
242
+ ```
243
+
244
+ This command will start the MCP server and open the MCP Inspector in your default web browser. You can then interact with the server and test its functionality.
245
+
246
+ ## License
247
+
248
+ AGPLv3+ License - see [LICENSE](LICENSE) for details.
249
+
250
+ ## Contributing
251
+
252
+ 1. Fork the repository
253
+ 2. Create a feature branch
254
+ 3. Commit your changes
255
+ 4. Push to the branch
256
+ 5. Create a pull request
@@ -0,0 +1,217 @@
1
+ ![PyPI](https://img.shields.io/pypi/v/openmarkets)
2
+ [![PyPI - Downloads](https://static.pepy.tech/badge/openmarkets)](https://pypi.org/project/openmarkets)
3
+ [![PyPI - Monthly Downloads](https://static.pepy.tech/badge/openmarkets/month)](https://pypi.org/project/openmarkets)
4
+
5
+ # Open Markets
6
+
7
+ A Model Context Protocol (MCP) server for agentic retrieval of financial data from Yahoo Finance. This server leverages YFinance to provide a simple and efficient way to access historical stock prices, dividends, stock splits, company information, and other financial metrics.
8
+
9
+ This MCP server is designed to be used with various LLM applications that support the Model Context Protocol, such as Claude Desktop, n8n, and Cursor. It allows users to retrieve financial data in a structured way, making it easy to integrate into AI applications.
10
+
11
+ ![MCP with OpenMarkets](https://r2.openmarkets.dev/80f5e8f644e3f9.gif)
12
+
13
+ ## Features
14
+
15
+ - Get basic stock information (price, market cap, sector, etc.)
16
+ - Fetch historical price data with customizable periods
17
+ - Retrieve analyst recommendations
18
+ - Download data for multiple stocks simultaneously
19
+ - Access dividend history
20
+
21
+ ## Usage
22
+
23
+ This MCP server can be used with various LLM applications that support the Model Context Protocol:
24
+
25
+ - **Claude Desktop**: Anthropic's desktop application for Claude
26
+ - **Cursor**: AI-powered code editor with MCP support
27
+ - **Custom MCP clients**: Any application implementing the MCP client specification
28
+
29
+ ## Usage with Claude Desktop
30
+
31
+ 1. Install Claude Desktop from https://claude.ai/download
32
+ 2. Open your Claude Desktop configuration:
33
+
34
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
35
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
36
+
37
+ 3. Add the following configuration:
38
+
39
+ ```json
40
+ {
41
+ "mcpServers": {
42
+ "openmarkets": {
43
+ "command": "uvx",
44
+ "args": [
45
+ "openmarkets@latest"
46
+ ]
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ 4. Restart Claude Desktop
53
+
54
+ ## Usage with VS Code
55
+
56
+ For quick installation, use one of the one-click installation buttons below:
57
+
58
+ [![Install with UVX in VS Code](https://img.shields.io/badge/VS_Code-UV-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=openmarkets&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22openmarkets%22%5D%7D) [![Install with UVX in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-UV-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=openmarkets&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22openmarkets%22%5D%7D&quality=insiders)
59
+
60
+ For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing `Ctrl + Shift + P` and typing `Preferences: Open Settings (JSON)`.
61
+
62
+ Optionally, you can add it to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.
63
+
64
+ > Note that the `mcp` key is not needed in the `.vscode/mcp.json` file.
65
+
66
+ #### UVX
67
+
68
+ ```json
69
+ {
70
+ "mcp": {
71
+ "servers": {
72
+ "openmarkets": {
73
+ "command": "uvx",
74
+ "args": [
75
+ "openmarkets@latest"
76
+ ]
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ ### Available Tools
84
+ This MCP server provides a variety of tools for retrieving financial data. Below is a list of available tools and their main arguments:
85
+
86
+ ---
87
+ #### Stock Information
88
+ - **get_stock_info(ticker: str)**
89
+ Get basic information about a stock.
90
+
91
+ #### Historical Data
92
+ - **get_historical_data(ticker: str, period: str = "1mo", interval: str = "1d")**
93
+ Get historical price data for a stock.
94
+ - **get_multiple_tickers(tickers: list[str], period: str = "1d")**
95
+ Get data for multiple stocks at once.
96
+ - **download_bulk_data(tickers: list[str], period: str = "1mo", interval: str = "1d", ...)**
97
+ Download bulk historical data for multiple tickers.
98
+ - **get_ticker_history_metadata(ticker: str)**
99
+ Get available periods, intervals, and metadata for a ticker.
100
+
101
+ #### Analyst Data
102
+ - **get_recommendations(ticker: str)**
103
+ Get analyst recommendations for a stock.
104
+ - **get_analyst_price_targets(ticker: str)**
105
+ Get analyst price targets.
106
+ - **get_upgrades_downgrades(ticker: str)**
107
+ Get recent upgrades and downgrades.
108
+ - **get_recommendations_summary(ticker: str)**
109
+ Get recommendations summary.
110
+
111
+ #### Corporate Actions
112
+ - **get_dividends(symbol: str, period: str = "5y")**
113
+ Get dividend history for a stock.
114
+ - **get_splits_history(symbol: str, period: str = "5y")**
115
+ Get stock split history.
116
+
117
+ #### Market Data
118
+ - **get_market_status()**
119
+ Get current US market status.
120
+ - **get_trending_tickers(region: str = "US", count: int = 10)**
121
+ Get trending/popular tickers.
122
+ - **get_sector_performance()**
123
+ Get sector performance using ETFs.
124
+ - **get_index_data(indices: list[str] = None)**
125
+ Get data for major market indices.
126
+
127
+ #### Calendar & Market Hours
128
+ - **get_market_calendar_info(ticker: str)**
129
+ Get market calendar and session info.
130
+ - **get_market_hours(ticker: str)**
131
+ Get market hours and session information.
132
+ - **get_exchange_info(ticker: str)**
133
+ Get detailed exchange and trading information.
134
+
135
+ #### Screener & Search
136
+ - **screen_stocks_by_criteria(...)**
137
+ Screen stocks by market cap, P/E, dividend yield, sector, etc.
138
+ - **get_similar_stocks(ticker: str, count: int = 5)**
139
+ Find similar stocks by sector and market cap.
140
+ - **get_top_performers(period: str = "1mo", sector: str = None, count: int = 10)**
141
+ Get top performing stocks.
142
+
143
+ #### Technical Analysis
144
+ - **get_technical_indicators(ticker: str, period: str = "6mo")**
145
+ Get technical indicators (SMA, price position, etc.).
146
+ - **get_volatility_metrics(ticker: str, period: str = "1y")**
147
+ Get volatility and risk metrics.
148
+ - **get_support_resistance_levels(ticker: str, period: str = "6mo")**
149
+ Get support and resistance levels.
150
+
151
+ #### Options
152
+ - **get_options_expiration_dates(ticker: str)**
153
+ Get available options expiration dates.
154
+ - **get_option_chain(ticker: str, expiration_date: str = None)**
155
+ Get option chain for a ticker.
156
+ - **get_options_volume_analysis(ticker: str, expiration_date: str = None)**
157
+ Analyze options volume and open interest.
158
+ - **get_options_by_moneyness(ticker: str, expiration_date: str = None, moneyness_range: float = 0.1)**
159
+ Filter options by proximity to current price.
160
+
161
+ #### Financial Statements
162
+ - **get_financials_summary(ticker: str)**
163
+ Get key financial metrics summary.
164
+
165
+ #### Funds & ETFs
166
+ - **get_fund_profile(ticker: str)**
167
+ Get fund/ETF profile.
168
+ - **get_fund_holdings(ticker: str, count: int = 20)**
169
+ Get top holdings of a fund/ETF.
170
+ - **get_fund_sector_allocation(ticker: str)**
171
+ Get sector allocation of a fund/ETF.
172
+ - **get_fund_performance(ticker: str)**
173
+ Get fund/ETF performance metrics.
174
+ - **compare_funds(tickers: list[str])**
175
+ Compare multiple funds/ETFs.
176
+
177
+ #### Crypto
178
+ - **get_crypto_info(crypto_symbol: str)**
179
+ Get cryptocurrency info.
180
+ - **get_crypto_historical_data(crypto_symbol: str, period: str = "1mo", interval: str = "1d")**
181
+ Get historical data for a cryptocurrency.
182
+ - **get_top_cryptocurrencies(count: int = 10)**
183
+ Get data for top cryptocurrencies.
184
+ - **get_crypto_fear_greed_proxy(crypto_symbols: list[str] = None)**
185
+ Get a proxy for crypto fear/greed index.
186
+
187
+ #### Currency & Validation
188
+ - **get_currency_data(base_currency: str = "USD", target_currencies: list[str] = None)**
189
+ Get currency exchange rates.
190
+ - **validate_tickers(tickers: list[str])**
191
+ Validate if tickers are valid and available.
192
+
193
+ ---
194
+
195
+ This list reflects the tools registered in the codebase and their main arguments. For more details, see the respective files in tools.
196
+
197
+ ## Development
198
+
199
+ To test the MCP server locally, install the `uvx` and `npx` and run the following command:
200
+
201
+ ```bash
202
+ npx @modelcontextprotocol/inspector uvx openmarkets@latest
203
+ ```
204
+
205
+ This command will start the MCP server and open the MCP Inspector in your default web browser. You can then interact with the server and test its functionality.
206
+
207
+ ## License
208
+
209
+ AGPLv3+ License - see [LICENSE](LICENSE) for details.
210
+
211
+ ## Contributing
212
+
213
+ 1. Fork the repository
214
+ 2. Create a feature branch
215
+ 3. Commit your changes
216
+ 4. Push to the branch
217
+ 5. Create a pull request
@@ -0,0 +1,122 @@
1
+ [project]
2
+ name = "openmarkets"
3
+ version = "0.1.0.alpha"
4
+ description = "A Model Context Protocol (MCP) server for agentic retrieval of financial market data. This server leverages YFinance to provide a simple and efficient way to access historical stock prices, dividends, stock splits, company information, and other financial metrics."
5
+ authors = [{ name = "Dobri Danchev", email = "python-dist@danchev.net" }]
6
+ classifiers = [
7
+ "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
8
+ "Development Status :: 3 - Alpha",
9
+ "Operating System :: OS Independent",
10
+ "Intended Audience :: Developers",
11
+ "Intended Audience :: Financial and Insurance Industry",
12
+ "Topic :: Office/Business :: Financial",
13
+ "Topic :: Office/Business :: Financial :: Investment",
14
+ "Topic :: Scientific/Engineering",
15
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
16
+ "Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
17
+ "Topic :: Software Development :: Libraries",
18
+ "Topic :: Software Development :: Libraries :: Python Modules",
19
+ "Programming Language :: Python",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Programming Language :: Python :: 3 :: Only",
27
+ ]
28
+ keywords = [
29
+ "machinelearning",
30
+ "finance",
31
+ "investment",
32
+ "mcp",
33
+ "modelcontextprotocol",
34
+ "yahoo finance",
35
+ "financial data retrieval",
36
+ ]
37
+ readme = "README.md"
38
+ license = { text = "AGPL-3.0-or-later" }
39
+ requires-python = ">=3.10"
40
+ dependencies = [
41
+ "mcp[cli]>=1.18.0",
42
+ "yfinance>=0.2.66",
43
+ ]
44
+ optional-dependencies = {"fastmcp" = ["fastmcp>=2.13.0rc1",]}
45
+
46
+ [project.urls]
47
+ Homepage = "https://openmarkets.dev"
48
+ Source = "https://github.com/danchev/openmarkets"
49
+ Documentation = "https://danchev.github.io/openmarkets/"
50
+ Issues = "https://github.com/danchev/openmarkets/issues"
51
+
52
+ [project.scripts]
53
+ openmarkets = "openmarkets.core.server:main"
54
+ mcp-server-yfinance = "openmarkets.core.server:main"
55
+
56
+ [build-system]
57
+ requires = ["uv_build>=0.9.4,<0.10.0"]
58
+ build-backend = "uv_build"
59
+
60
+ [dependency-groups]
61
+ dev = [
62
+ "pyright>=1.1.406",
63
+ "refurb>=2.2.0",
64
+ "ruff>=0.14.1",
65
+ "ty>=0.0.1a23",
66
+ {include-group = "test"},
67
+ {include-group = "commit"},
68
+ ]
69
+ test = [
70
+ "pytest>=8.4.2",
71
+ "pytest-cov>=7.0.0",
72
+ "pytest-xdist>=3.8.0",
73
+ "pytest-asyncio>=1.2.0",
74
+ ]
75
+ docs = [
76
+ "mkdocs>=1.6.1",
77
+ "mkdocs-glightbox>=0.5.1",
78
+ "mkdocs-material[imaging]>=9.6.22",
79
+ "mkdocstrings-python>=1.18.2",
80
+ ]
81
+ commit = [
82
+ "commitizen>=4.9.1",
83
+ "pre-commit>=4.3.0",
84
+ ]
85
+
86
+ [tool.ruff]
87
+ fix = true
88
+ show-fixes = true
89
+ output-format = "full"
90
+ line-length = 120
91
+ target-version = "py310"
92
+
93
+ [tool.ruff.lint]
94
+ select = ["E", "F", "I", "B", "Q"]
95
+ ignore = ["E203", "E501"]
96
+
97
+ [tool.ruff.lint.isort]
98
+ known-first-party = ["openmarkets"]
99
+
100
+ [tool.ruff.format]
101
+ quote-style = "double"
102
+ indent-style = "space"
103
+ line-ending = "auto"
104
+
105
+ [tool.pytest.ini_options]
106
+ addopts = "-n auto --cov=src/openmarkets --cov-report=html --cov-report=term-missing --cov-fail-under=70"
107
+ testpaths = ["tests"]
108
+ python_files = "test_*.py"
109
+ python_functions = "test_*"
110
+
111
+ [tool.mypy]
112
+ custom_typeshed_dir = "typings"
113
+ plugins = ["mypy_ruff"]
114
+
115
+ [tool.commitizen]
116
+ name = "cz_conventional_commits"
117
+ version = "0.1.0.dev119"
118
+ tag_format = "$version"
119
+ version_files = [
120
+ "pyproject.toml:version"
121
+ ]
122
+ update_changelog_on_bump = true
@@ -0,0 +1,8 @@
1
+ try:
2
+ from importlib.metadata import version
3
+
4
+ __version__ = version("openmarkets")
5
+ except Exception:
6
+ __version__ = "unknown"
7
+
8
+ __all__ = ["__version__"]
@@ -0,0 +1,13 @@
1
+ # Application entry point (starts the server)
2
+
3
+ import logging
4
+ import sys
5
+
6
+ from openmarkets.core.server import main
7
+
8
+ logging.basicConfig(
9
+ level=logging.INFO, stream=sys.stdout, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
10
+ )
11
+
12
+ if __name__ == "__main__":
13
+ main()
@@ -0,0 +1,8 @@
1
+ from importlib.metadata import PackageNotFoundError, version
2
+
3
+ try:
4
+ __version__: str = version("openmarkets")
5
+ except PackageNotFoundError:
6
+ __version__ = "unknown"
7
+
8
+ __all__ = ["__version__"]
@@ -0,0 +1,40 @@
1
+ from functools import lru_cache
2
+
3
+ from pydantic import Field
4
+ from pydantic_settings import BaseSettings, CliSettingsSource, PydanticBaseSettingsSource, SettingsConfigDict
5
+
6
+
7
+ class Settings(BaseSettings):
8
+ name: str = Field("Open Markets Server")
9
+ environment: str = Field("development")
10
+ transport: str = Field("stdio")
11
+ host: str = Field("127.0.0.1")
12
+ port: int = Field(8000)
13
+ debug: bool = Field(False)
14
+ timeout: float = Field(5.0)
15
+ cors_allow_origins: str = Field("*")
16
+ tools_module: str = Field("openmarkets.tools")
17
+
18
+ model_config = SettingsConfigDict(env_file=".env")
19
+
20
+ @classmethod
21
+ def settings_customise_sources(
22
+ cls,
23
+ settings_cls: type[BaseSettings],
24
+ init_settings: PydanticBaseSettingsSource,
25
+ env_settings: PydanticBaseSettingsSource,
26
+ dotenv_settings: PydanticBaseSettingsSource,
27
+ file_secret_settings: PydanticBaseSettingsSource,
28
+ ) -> tuple[PydanticBaseSettingsSource, ...]:
29
+ return (
30
+ init_settings,
31
+ CliSettingsSource(settings_cls, cli_parse_args=True, cli_ignore_unknown_args=True),
32
+ env_settings,
33
+ dotenv_settings,
34
+ file_secret_settings,
35
+ )
36
+
37
+
38
+ @lru_cache
39
+ def get_settings() -> Settings:
40
+ return Settings() # type: ignore