Skip to content

Extend FMP MCP with additional financial statements, peer comparison, and representative tests#2

Open
ZhijingEu wants to merge 12 commits into
cdtait:mainfrom
ZhijingEu:main
Open

Extend FMP MCP with additional financial statements, peer comparison, and representative tests#2
ZhijingEu wants to merge 12 commits into
cdtait:mainfrom
ZhijingEu:main

Conversation

@ZhijingEu

@ZhijingEu ZhijingEu commented Jan 15, 2026

Copy link
Copy Markdown

Summary

This PR extends the Financial Modeling Prep (FMP) MCP server with additional financial statement coverage as the original statements.py file only covered the extraction of income_sheet data but not cashflow statements or balance sheet, peer comparison functionality, and representative unit tests.

Key Changes

New & Extended Tools

  • Extended financial statement tools:
  • balance sheet and cash flow statements (annual + quarterly)
  • TTM income, balance sheet, and cash flow statements
  • Financial ratios and key metrics (annual + TTM)
  • Financial scores (Altman Z, Piotroski, etc.)
  • Financial statement growth metrics
  • Revenue segmentation (product & geographic)
  • Added stock peer comparison tool using FMP stable API
  • Added FMP's stable/ discounted cash flow endpoints (NOTE - There is an error on the FMP API output where the % are not normalized ie it returns the value of 8.05 instead of 0.0805)

MCP Server Updates

  • Updated tool registration and descriptions in src/server.py
  • Added a top-level server.py entrypoint to resolve import/path issues when running under Claude Desktop (STDIO MCP execution)

Tests

  • Extended test_statements.py using a representative-test strategy:
    • Core period statements (income, balance sheet, cash flow)
    • TTM, growth, ratios, scores, and segmentation
  • Added test_peers.py for stock peer comparison tool

Notes

  • Uses only FMP stable endpoints (no legacy endpoints)
  • Representative testing is intentional to balance coverage and runtime
  • Designed to be LLM-friendly with verbose tool descriptions to avoid confusion between
    annual, quarterly, and TTM endpoints

ZhijingEu and others added 12 commits January 15, 2026 22:14
Note on changes to this fork
Add DCF valuation tools (discounted-cash-flow, levered, custom with scenario overrides) and the corresponding tests and docs
…ix dividends field

get_balance_sheet: adds totalDebt and capitalLeaseObligations to formatted
output. Previously only longTermDebt was included, causing downstream
pipelines to understate invested capital and ROIC for tickers with
significant lease liabilities (confirmed: BAH finding #008, CACI #011).

get_cash_flow_statement: replaces hardcoded 'dividendsPaid' field with a
fallback chain (commonDividendsPaid -> netDividendsPaid -> dividendsPaid)
matching the actual FMP API response field name. Also adds preferredDividendsPaid,
incomeTaxesPaid, and interestPaid to the formatted output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Activities typo

get_cash_flow_statement was using 'commonStockIssued' (wrong FMP field name)
and 'otherFinancingActivites' (typo, missing 'i'). Both caused N/A to be
returned for all tickers even when FMP REST response contains non-zero values
(confirmed: BAH $6-28M/yr equity issuance; KBR $130-280M/yr other financing).

Fix: 'commonStockIssued' -> 'commonStockIssuance'
     'otherFinancingActivites' -> 'otherFinancingActivities'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ipoDate from FMP is the stock market listing date, not the company
founding date (e.g. PSN: founded ~1984, IPO 2008 -- different dates).
Mislabeling caused downstream confusion when VIPER reads the field
to compute pre_ipo_periods for post-IPO analytical scoping.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ACC values

FMP custom DCF endpoints return rates as already-percentage values
(e.g. 14.9 = 14.9%), not decimals. The old _pct() multiplied by 100
unconditionally, producing 1490% for NVDA WACC=14.9.

Fix: guard on value <= 1.0 -- multiply by 100 only for decimal-form
values; display as-is for already-percentage values. Handles both
forms safely without breaking existing behaviour for decimal inputs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ocs URL

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@yairEO

yairEO commented Apr 13, 2026

Copy link
Copy Markdown

helloooo maintainer??? anyone here?

@ZhijingEu

Copy link
Copy Markdown
Author

@yairEO FMP now publishes an official hosted MCP server that wraps their full REST API (~250 tools)

https://site.financialmodelingprep.com/developer/docs/mcp-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants