A theoretical reconstruction of the Claude Mythos architecture, built from first principles using the available research literature.
Python financial analysis toolkit and MCP server
FinanceToolkit is a Python library for pulling and calculating financial data across statements, ratios, risk, performance, valuation, and more. It is built around the `Toolkit` class and related modules in `financetoolkit/`, with notebooks in `examples/` showing how the pieces fit together. The repo also ships an MCP server so Claude Code, Copilot, Cursor, Windsurf, and other MCP-compatible clients can query the toolkit directly. That makes it easier to compare methods, reuse calculations, and work from the same source of truth across sessions.
Builders who want a reusable Python toolkit for financial analysis or an MCP server for agent access.
You can pull consistent financial metrics and statement data into your own analysis or agent workflow without rebuilding the calculations yourself.
What it does
Financial statements
Gets income statement, balance sheet, cash flow, and statistics data on annual or quarterly bases.
Ratios and custom ratios
Collects profitability, liquidity, efficiency, solvency, and valuation ratios, and lets you define custom ratios.
Market and historical data
Fetches daily to yearly OHLC, volume, dividends, returns, and cumulative returns.
Risk and performance metrics
Calculates measures like volatility, Sharpe ratio, excess return, excess volatility, and value at risk.
Discovery and screening
Finds companies, sectors, industries, news, and screeners for stocks and other instruments.
MCP server access
Exposes 500+ methods through an MCP server for supported clients and local setups.
How to get it
- 1To install the Finance Toolkit it simply requires the following
pip install financetoolkit -U
- 2Run the setup wizard — it locates your client's config file and writes the MCP entry…
uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup
README
While browsing a variety of websites, I repeatedly observed significant fluctuations in the same financial metric among different sources. Similarly, the reported financial statements often didn't line up, and there was limited information on the methodology used to calculate each metric.
For example, Microsoft's Price-to-Earnings (PE) ratio on the 6th of May, 2023 is reported to be 28.93 (Stockopedia), 32.05 (Morningstar), 32.66 (Macrotrends), 33.09 (Finance Charts), 33.66 (Y Charts), 33.67 (Wall Street Journal), 33.80 (Yahoo Finance) and 34.4 (Companies Market Cap). All of these calculations are correct, however the method of calculation varies leading to different results. Therefore, collecting data from multiple sources can lead to wrong interpretation of the results given that one source could apply a different definition than another. And that is, if that definition is even available as often the underlying methods are hidden behind a paid subscription.
This is why I designed the FinanceToolkit, this is an open-source toolkit in which all relevant financial methods (500+) are written down in the most simplistic way allowing for complete transparency of the method of calculation (proof). This enables you to avoid dependence on metrics from other providers that do not provide their methods. With a large selection of financial statements in hand, it facilitates streamlined calculations, promoting the adoption of a consistent and universally understood methods and formulas.
Beyond Equities, it supports Options, Currencies, Cryptocurrencies, ETFs, Mutual Funds, Indices, Money Markets, Commodities, Key Economic Indicators and more, allowing you to obtain historical data as well as important performance and risk measurements such as the Sharpe Ratio and Value at Risk.
Complementing this is the Finance Database 🌎, a database featuring 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies and Money Markets. By utilising both, it is possible to do a fully-fledged competitive analysis with the tickers found from the FinanceDatabase inputted into the FinanceToolkit.
🔌 The Finance Toolkit is also available as an MCP Server
Query 500+ methods from Claude, Copilot, Cursor, Windsurf or any MCP-compatible client without writing code.
- Hosted: connect to
https://financetoolkit.jeroenbouma.com/mcp— OAuth handles the rest on first use. - Local:
uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup— sets up your client config and API key automatically. See MCP Server Documentation for manual setup.
Also on Smithery, Glama, MCP Servers and more.
Table of Contents
Installation
Before installation, consider starring the project on GitHub which helps others find the project as well.
To install the Finance Toolkit it simply requires the following:
pip install financetoolkit -U
Then within Python use:
from financetoolkit import Toolkit
companies = Toolkit(
tickers=['AAPL', 'MSFT'],
api_key="FINANCIAL_MODELING_PREP_KEY", # replace with your actual API key
)
To be able to get started, you need to obtain an API Key from FinancialModelingPrep. This is used to gain access to 30+ years of financial statement both annually and quarterly. Note that the Free plan is limited to 250 requests each day, 5 years of data and only features companies listed on US exchanges.
Through the link you are able to subscribe for the free plan and also premium plans at a 15% discount. This is an affiliate link and thus supports the project at the same time. I have chosen FinancialModelingPrep as a source as I find it to be the most transparent, reliable and at an affordable price. I have yet to find a platform offering such low prices for the amount of data offered. When you notice that the data is inaccurate or have any other issue related to the data, note that I simply provide the means to access this data and I am not responsible for the accuracy of the data itself. For this, use their contact form or provide the data yourself.
By default, the Finance Toolkit prioritizes Financial Modeling Prep for data retrieval. If data acquisition from Financial Modeling Prep is unsuccessful (e.g., due to plan restrictions or API key issues), the toolkit automatically switches to Yahoo Finance as a secondary source. To disable this fallback behavior and exclusively use Financial Modeling Prep, set enforce_source="FinancialModelingPrep" during Toolkit initialization. This configuration ensures that an error is raised if Financial Modeling Prep data cannot be accessed. Alternatively, you can set enforce_source="YahooFinance" to exclusively use Yahoo Finance as the data source.
The same enforce_source argument is also accepted per call on get_historical_data, get_treasury_data and the four statement functions (get_balance_sheet_statement, get_income_statement, get_cash_flow_statement and get_statistics_statement), where it overrides whatever the Toolkit was initialised with.
Functionality
This section is an introduction to the Finance Toolkit. Find with the link below fully-fledged code documentation as well as Jupyter Notebooks in which you can see many examples ranging from basic examples to creating custom ratios to working with your own datasets.
A basic example of how to use the Finance Toolkit is shown below. Every code snippet in the sections that follow builds on this same companies instance.
from financetoolkit import Toolkit
# Initialize the Toolkit for Apple and Microsoft
companies = Toolkit(["AAPL", "MSFT"], api_key=API_KEY, start_date="2017-12-31")
Each ratio, indicator and metric has a corresponding function that can be called directly, for example ratios.get_return_on_equity or technicals.get_relative_strength_index. Every module also has one or more collect_ functions that return a whole category at once, e.g. ratios.collect_profitability_ratios, useful when you want everything in one call instead of assembling it metric by metric.
Three capabilities cut across nearly the whole toolkit:
rollingandtrailingwindows. Many metrics return one value per reporting period by default. Passrolling=<n>to compute the metric over a sliding window instead, ortrailing=<n>for a trailing sum/average (e.g. a trailing 4-quarter sum to annualize a quarterly flow) — turning a snapshot into a proper time series.growthandlag. Passgrowth=Trueon almost anyget_orcollect_function to return the period-over-period growth instead of the raw value.lag(anintor list ofints, default1) controls how many periods back that growth is measured against, e.g.lag=4for year-over-year growth on quarterly data. Combine withtrailing(e.g.trailing=4, growth=True) to get TTM growth.standardize(Z-Score). Mostget_*methods across Economics, Ratios, Technicals, Risk, Performance, Models, Options and Fixed Income acceptstandardize=True, converting raw values into standard deviations from their own historical mean/std. Useful for ranking, scoring, or spotting an unusual reading across metrics that otherwise live on incompatible scales.
Every module below also has a How-To Guide notebook and full code documentation (formulas, parameters, worked examples) linked in its own section, see the documentation hub for the complete index.
Discovering Instruments & News
Before analyzing a ticker you often need to find it. The Discovery module is standalone and covers among other things lists of companies, cryptocurrencies, forex, commodities, ETFs and indices.
from financetoolkit import Discovery
# Initialize the standalone Discovery module
discovery = Discovery(api_key="FINANCIAL_MODELING_PREP_KEY")
# Screen for stocks matching a set of criteria
discovery.get_stock_screener(
market_cap_higher=1000000,
price_higher=100,
price_lower=200,
beta_higher=1,
beta_lower=1.5,
dividend_higher=1,
)
Which returns:
| Symbol | Name | Market Cap | Sector | Industry | Beta | Price | Dividend | Exchange | Country |
|---|---|---|---|---|---|---|---|---|---|
| NKE | NIKE, Inc. | 163403295604 | Consumer Cyclical | Footwear & Accessories | 1.079 | 107.36 | 1.48 | New York Stock Exchange | US |
| SAF.PA | Safran SA | 66234006559 | Industrials | Aerospace & Defense | 1.339 | 160.16 | 1.35 | Paris | FR |
| ROST | Ross Stores, Inc. | 46724188589 | Consumer Cyclical | Apparel Retail | 1.026 | 138.785 | 1.34 | NASDAQ Global Select | US |
Furthermore, you can find in this module stock screeners, sector/industry performance and news feeds and more. Find the Notebook here and the full instrument discovery documentation here.
Obtaining Historical Data
Obtain historical data on a daily, weekly, monthly or yearly basis. This includes OHLC, volumes, dividends, returns and cumulative returns for each corresponding period.
# Obtain historical market data for all tickers
historical_data = companies.get_historical_data()
# Select the results for Apple
historical_data.xs('AAPL', axis=1, level=1)
For example, a portion of the historical data for Apple is shown below.
| date | Open | High | Low | Close | Adj Close | Volume | Dividends | Return | Cumulative Return |
|---|---|---|---|---|---|---|---|---|---|
| 2018-01-02 | 42.54 | 43.075 | 42.315 | 43.065 | 40.78 | 1.02224e+08 | 0 | 0 | 1 |
| 2018-01-03 | 43.1325 | 43.6375 | 42.99 | 43.0575 | 40.77 | 1.17982e+08 | 0 | -0.0002 | 0.9998 |
| 2018-01-04 | 43.135 | 43.3675 | 43.02 | 43.2575 | 40.96 | 8.97384e+07 | 0 | 0.0047 | 1.0044 |
| 2018-01-05 | 43.36 | 43.8425 | 43.2625 | 43.75 | 41.43 | 9.46401e+07 | 0 | 0.0115 | 1.0159 |
| 2018-01-08 | 43.5875 | 43.9025 | 43.4825 | 43.5875 | 41.27 | 8.22711e+07 | 0 | -0.0039 | 1.012 |
And below the cumulative returns are plotted which include the S&P 500 as benchmark:
Metrics such as Volatility, Excess Return and Excess Volatility are calculated as dedicated Risk and Performance methods rather than columns on this table to create more efficient and flexible functionalities. Find the Notebook here and the full historical data documentation here.
Obtaining Financial Statements
Obtain an Income Statement on an annual or quarterly basis. This can also be a balance statement or cash flow statement.
# Obtain the Income Statement for all tickers
income_statement = companies.get_income_statement()
# Select the results for Apple
income_statement.loc['AAPL']
For example, the first 5 rows of the Income Statement for Apple are shown below.
| 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | |
|---|---|---|---|---|---|---|---|
| Revenue | 2.29234e+11 | 2.65595e+11 | 2.60174e+11 | 2.74515e+11 | 3.65817e+11 | 3.94328e+11 | 3.83285e+11 |
| Cost of Goods Sold | 1.41048e+11 | 1.63756e+11 | 1.61782e+11 | 1.69559e+11 | 2.12981e+11 | 2.23546e+11 | 2.14137e+11 |
| Gross Profit | 8.8186e+10 | 1.01839e+11 | 9.8392e+10 | 1.04956e+11 | 1.52836e+11 | 1.70782e+11 | 1.69148e+11 |
| Gross Profit Ratio | 0.3847 | 0.3834 | 0.3782 | 0.3823 | 0.4178 | 0.4331 | 0.4413 |
| Research and Development Expenses | 1.1581e+10 | 1.4236e+10 | 1.6217e+10 | 1.8752e+10 | 2.1914e+10 | 2.6251e+10 | 2.9915e+10 |
And below the Earnings Before Interest, Taxes, Depreciation and Amortization (EBITDA) are plotted for both Apple and Microsoft. Find the Notebook here and the full financial statement documentation here.
Obtaining Financial Ratios
Get Profitability Ratios based on the inputted balance sheet, income and cash flow statements. This can be any of the 80+ ratios within the ratios module.
# Collect all Profitability Ratios for all tickers
profitability_ratios = companies.ratios.collect_profitability_ratios()
# Select the results for Microsoft
profitability_ratios.loc['MSFT']
For example, see some of the profitability ratios of Microsoft below.
| 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | |
|---|---|---|---|---|---|---|---|
| Gross Margin | 0.6191 | 0.6525 | 0.659 | 0.6778 | 0.6893 | 0.684 | 0.6892 |
| Operating Margin | 0.2482 | 0.3177 | 0.3414 | 0.3703 | 0.4159 | 0.4206 | 0.4177 |
| Net Profit Margin | 0.2357 | 0.1502 | 0.3118 | 0.3096 | 0.3645 | 0.3669 | 0.3415 |
| Interest Coverage Ratio | 13.9982 | 16.5821 | 20.3429 | 25.3782 | 34.7835 | 47.4275 | 52.0244 |
| Income Before Tax Profit Margin | 0.2574 | 0.3305 | 0.3472 | 0.3708 | 0.423 | 0.4222 | 0.4214 |
And below a few of the profitability ratios are plotted for Microsoft.
The 80+ ratios are divided into five categories: Efficiency (asset/inventory/receivables turnover, cash conversion cycle, R&D/SG&A/SBC-to-revenue), Liquidity (current, quick and cash ratios, working capital), Profitability (margins, ROE/ROA/ROIC, cash vs. effective tax rate), Solvency (debt-to-equity, debt-to-capital, interest and dividend coverage) and Valuation (P/E, PEG, Forward P/E, EV multiples, buyback and shareholder yield). It's also possible to define fully custom ratios calculated automatically from the balance sheet, income and cash flow statements. Find the Notebook here and the full ratio-by-ratio documentation here.
Obtaining Financial Models
Get an Extended DuPont Analysis based on the inputted balance sheet, income and cash flow statements.
# Get the Extended DuPont Analysis for all tickers
extended_dupont_analysis = companies.models.get_extended_dupont_analysis()
# Select the results for Apple
extended_dupont_analysis.loc['AAPL']
For example, this shows the Extended DuPont Analysis for Apple:
|
Files in the repo
- .github
- examples
- financetoolkit
- tests
- .gitignore
- .pre-commit-config.yaml
- CONTRIBUTING.md
- docker-compose.yml
- Dockerfile
- glama.json
- LICENSE.txt
- medium.pdf
- pyproject.toml
- README.md
- server.json
- uv.lock
Discussion (0)
Ask about usage, or say what you built with itSign in to join the discussion.
No comments yet. Be the first to say what this is good for.
More frameworks & sdks
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!

Open-source Agent Operating System

A lightweight, lightning-fast, in-process vector database
One portable memory layer for every AI agent: local-first, Markdown-native, user-owned, and self-evolving across apps, tools, and workflows.
A bio-inspired cognitive memory engine — a new paradigm for Graph RAG.