DEV Community

Cover image for How to Connect Claude to Real Financial Data with FMP MCP
Kevin Meneses González
Kevin Meneses González

Posted on • Originally published at Medium

How to Connect Claude to Real Financial Data with FMP MCP

Most investors using AI are still stuck analyzing screenshots.

They copy numbers from a brokerage. Paste charts into ChatGPT. Ask questions about data that's already 3 hours old.

If you're:

  • building a portfolio monitoring system,
  • automating weekly research reports,
  • or trying to cut 4 hours of manual work down to 20 minutes,

This matters.

The real problem isn't the AI. It's the pipeline. And MCP fixes that.


Why Financial AI Tools Break at the Data Layer

The pattern repeats constantly.

A developer sets up a solid Claude workflow. The prompts are good. The logic is there. Then they hit the wall: getting real, structured financial data into the model without building and maintaining a custom API layer.

The options until recently were ugly:

  • Scrape Yahoo Finance and pray it doesn't break
  • Pay for a premium API and write integration code from scratch
  • Use CSV exports and process everything manually

None of these scale. All of them break.

The issue is infrastructure, not intelligence.


What FMP MCP Actually Does

Financial Modeling Prep launched an official MCP server that exposes its entire financial data catalog directly to Claude.

No middleware. No custom connectors. No parsing logic.

Claude reads the available tools, calls them when needed, and returns structured answers — the same way a senior analyst would query a Bloomberg terminal, except you don't need to pay $24,000/year for the hardware.

FMP's MCP server gives you access to:

  • Real-time and historical stock prices
  • Income statements, balance sheets, and cash flow data
  • Financial ratios and valuation metrics
  • Earnings calendars and analyst estimates
  • Sector performance and market movers
  • Crypto, forex, and commodities data

One server. One configuration. Everything your research workflow needs.


Setup in Under 10 Minutes

1. Get your FMP API key

Sign up at Financial Modeling Prep and grab your API key from the dashboard.

The free tier covers a solid range of endpoints — enough to test and build the core of your workflow.

2. Install the MCP server

npm install -g @financialmodelingprep/mcp-server
Enter fullscreen mode Exit fullscreen mode

3. Configure Claude Desktop

Open your claude_desktop_config.json file and add:

{
  "mcpServers": {
    "fmp": {
      "command": "npx",
      "args": ["-y", "@financialmodelingprep/mcp-server"],
      "env": {
        "FMP_API_KEY": "your_api_key_here"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Restart Claude Desktop. The FMP tools will appear automatically in the interface.

4. Test the connection

Ask Claude directly:

"What is Apple's current P/E ratio and how does it compare to the sector average?"

Claude will call the FMP tools, retrieve live data, and return a structured response. No copy-paste. No manual lookup.


3 Systems You Can Build This Week

This is where the time savings become concrete.

System 1 — Morning Portfolio Brief (15 minutes saved daily)

Instead of checking 6 different tabs every morning, set up a prompt that pulls everything in one shot:

Retrieve the current price, daily change, and P/E ratio for AAPL, MSFT, NVDA, and AMZN. 
Then summarize which position has moved most relative to its 52-week range 
and flag any that have dropped more than 2% today.
Enter fullscreen mode Exit fullscreen mode

Claude queries FMP, compares positions, and gives you a ranked brief.

What used to take 20 minutes of tab-hopping takes 90 seconds.

System 2 — Earnings Prep Autopilot (2 hours saved per company)

Before an earnings call, most investors pull the same data every time: revenue trend, margin evolution, analyst consensus, year-over-year comparisons.

Claude can do it all in one call:

For $TSLA: retrieve the last 4 quarters of revenue, gross margin, and EPS. 
Compare against analyst consensus estimates. 
Highlight the biggest deviation between reported and estimated figures.
Enter fullscreen mode Exit fullscreen mode

You get a structured earnings preview in under a minute.

From here you can build:

  • Pre-earnings briefing templates for your full watchlist
  • Automated flags when a company is expected to miss consensus by >10%
  • Comparative analysis across sectors before reporting season

System 3 — Fundamental Screening on Demand

Screening tools are useful. But they're fixed. They show you what the tool was designed to show.

With FMP MCP + Claude, you ask in natural language:

Find companies in the S&P 500 with a P/E below 15, 
debt-to-equity under 0.5, and revenue growth above 10% YoY. 
Sort by free cash flow yield descending.
Enter fullscreen mode Exit fullscreen mode

Claude translates that into FMP queries, aggregates the results, and returns a clean list.

Your own screener. No SQL. No filters to configure.


What This Looks Like in a Python Workflow

If you're building automated pipelines rather than interactive sessions, FMP's REST API integrates cleanly alongside the MCP layer.

import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://financialmodelingprep.com/api/v3"

def get_income_statement(ticker: str, limit: int = 4) -> list:
    url = f"{BASE_URL}/income-statement/{ticker}"
    params = {"apikey": API_KEY, "limit": limit}
    response = requests.get(url, params=params)
    return response.json()

def get_ratios(ticker: str) -> dict:
    url = f"{BASE_URL}/ratios-ttm/{ticker}"
    params = {"apikey": API_KEY}
    response = requests.get(url, params=params)
    return response.json()

# Pull last 4 quarters of financials + current ratios
ticker = "AAPL"
income = get_income_statement(ticker)
ratios = get_ratios(ticker)

print(f"Revenue (last quarter): ${income[0]['revenue']:,}")
print(f"Net income margin: {ratios[0]['netProfitMarginTTM']:.2%}")
print(f"P/E ratio (TTM): {ratios[0]['peRatioTTM']:.2f}")
Enter fullscreen mode Exit fullscreen mode

Sample output:

Revenue (last quarter): $124,300,000,000
Net income margin: 23.97%
P/E ratio (TTM): 28.43
Enter fullscreen mode Exit fullscreen mode

From here you can build:

  • Automated weekly reports delivered to Slack or email
  • Portfolio dashboards that refresh with real data on a schedule
  • Watchlist monitors that alert you when a ratio crosses a threshold

Practical Tips for Investors Using This Stack

Before building anything, a few lessons that save time.

Start with one workflow, not three. The most common mistake is trying to automate everything on day one. Pick your highest-friction task — for most investors it's the morning check — and make that seamless first. Once it runs reliably, extend it.

Use specific tickers, not vague questions. Claude performs better when you anchor queries to concrete symbols. "How is Apple doing?" produces a generic summary. "Retrieve AAPL's current P/E, 52-week range, and analyst consensus for Q2" produces structured, actionable data.

Chain queries, don't stack them. Instead of asking Claude to do everything in one giant prompt, build multi-step conversations:

  • Step 1: Pull the raw data
  • Step 2: Ask for the analysis
  • Step 3: Ask for the formatted output

This keeps the model focused and makes errors easier to debug.

Set a daily schedule for automated queries. If you're using the Python pipeline, run it at a fixed time — 7:30 AM before markets open works well. Use a simple cron job or a task scheduler like schedule:

import schedule
import time

def run_morning_brief():
    # Your FMP data pull + report generation here
    print("Morning brief generated.")

schedule.every().day.at("07:30").do(run_morning_brief)

while True:
    schedule.run_pending()
    time.sleep(60)
Enter fullscreen mode Exit fullscreen mode

Store your API key as an environment variable, never in code. A small discipline that matters:

export FMP_API_KEY="your_key_here"
Enter fullscreen mode Exit fullscreen mode
import os
API_KEY = os.getenv("FMP_API_KEY")
Enter fullscreen mode Exit fullscreen mode

Use FMP's free tier to prototype, then upgrade only when you hit a wall. The free plan covers quotes, financial statements, and ratios for most common tickers. You'll only need a paid plan when you require real-time data at high frequency, access to smaller/international stocks, or advanced endpoints like institutional holdings.


How to Build a Portfolio Dashboard with FMP + Python

This is where the stack becomes a genuine time-saving system.

The goal: a single HTML file that opens in any browser and shows your portfolio's key metrics, refreshed every morning without manual effort.

Architecture Overview

  • Claude Desktop + MCP handles interactive queries and one-off analysis
  • Python Pipeline handles scheduled, automated data pulls via REST API
  • FMP is the single source of truth for all financial data
  • Outputs are either Claude responses, Python-generated files, or Slack/email alerts

Step 1 — Define your dashboard metrics

Pick 5–8 metrics that actually drive your decisions. A solid starting set:

PORTFOLIO = {
    "AAPL": 15,   # shares
    "MSFT": 10,
    "NVDA": 8,
    "AMZN": 12,
}

METRICS = [
    "price",
    "changesPercentage",
    "pe",        # P/E ratio
    "eps",
    "52WeekHigh",
    "52WeekLow",
]
Enter fullscreen mode Exit fullscreen mode

Step 2 — Pull data for all positions

import requests
import os

API_KEY = os.getenv("FMP_API_KEY")
BASE_URL = "https://financialmodelingprep.com/api/v3"

def get_quotes(tickers: list) -> list:
    symbols = ",".join(tickers)
    url = f"{BASE_URL}/quote/{symbols}"
    response = requests.get(url, params={"apikey": API_KEY})
    return response.json()

portfolio_tickers = list(PORTFOLIO.keys())
quotes = get_quotes(portfolio_tickers)
Enter fullscreen mode Exit fullscreen mode

Step 3 — Calculate portfolio value and build the report

from datetime import datetime

def build_report(quotes: list, portfolio: dict) -> dict:
    report = {
        "date": datetime.now().strftime("%Y-%m-%d %H:%M"),
        "positions": [],
        "total_value": 0,
        "total_daily_change": 0,
    }

    for q in quotes:
        ticker = q["symbol"]
        shares = portfolio.get(ticker, 0)
        value = q["price"] * shares
        daily_pnl = q["change"] * shares

        report["positions"].append({
            "ticker": ticker,
            "price": q["price"],
            "change_pct": q["changesPercentage"],
            "pe": q.get("pe", "N/A"),
            "shares": shares,
            "value": round(value, 2),
            "daily_pnl": round(daily_pnl, 2),
        })

        report["total_value"] += value
        report["total_daily_change"] += daily_pnl

    report["total_value"] = round(report["total_value"], 2)
    report["total_daily_change"] = round(report["total_daily_change"], 2)
    return report

report = build_report(quotes, PORTFOLIO)
Enter fullscreen mode Exit fullscreen mode

Step 4 — Export to HTML dashboard

def export_html(report: dict, filename: str = "dashboard.html"):
    rows = ""
    for p in report["positions"]:
        color = "#22c55e" if p["daily_pnl"] >= 0 else "#ef4444"
        sign = "+" if p["daily_pnl"] >= 0 else ""
        rows += f"""
        <tr>
            <td><strong>{p['ticker']}</strong></td>
            <td>${p['price']:,.2f}</td>
            <td style="color:{color}">{p['change_pct']:.2f}%</td>
            <td>{p['pe']}</td>
            <td>{p['shares']}</td>
            <td>${p['value']:,.2f}</td>
            <td style="color:{color}">{sign}${p['daily_pnl']:,.2f}</td>
        </tr>"""

    html = f"""<!DOCTYPE html>
<html>
<head>
  <title>Portfolio Dashboard</title>
  <style>
    body {{ font-family: Arial, sans-serif; padding: 20px; background: #0f172a; color: #e2e8f0; }}
    h1 {{ color: #94a3b8; font-size: 18px; }}
    table {{ width: 100%; border-collapse: collapse; margin-top: 20px; }}
    th {{ background: #1e293b; padding: 10px; text-align: left; color: #94a3b8; }}
    td {{ padding: 10px; border-bottom: 1px solid #1e293b; }}
    .total {{ margin-top: 20px; font-size: 22px; }}
  </style>
</head>
<body>
  <h1>Portfolio Dashboard — {report['date']}</h1>
  <table>
    <tr><th>Ticker</th><th>Price</th><th>Change</th><th>P/E</th><th>Shares</th><th>Value</th><th>P&L Today</th></tr>
    {rows}
  </table>
  <div class="total">
    Total: <strong>${report['total_value']:,.2f}</strong> &nbsp;|&nbsp;
    Today: <strong style="color:{'#22c55e' if report['total_daily_change'] >= 0 else '#ef4444'}">${report['total_daily_change']:,.2f}</strong>
  </div>
</body>
</html>"""

    with open(filename, "w") as f:
        f.write(html)
    print(f"Dashboard saved: {filename}")

export_html(report)
Enter fullscreen mode Exit fullscreen mode

Open dashboard.html in any browser. Schedule the full script at 7:30 AM and your portfolio brief is ready before you pour your coffee.

From here you can extend it with:

  • A Slack webhook to push the summary to a channel automatically
  • A second tab comparing current P/E ratios against 5-year historical averages
  • An alert row that highlights any position down more than 3% in red

Key Takeaways

  • MCP removes the integration layer — Claude connects to FMP directly, without custom code or API wrappers
  • The time savings are real — systems like these compress hours of manual research into minutes of structured output
  • The free tier is enough to start — you don't need a premium plan to build and test the core workflows

Start Building

FMP's MCP server is one of the cleanest financial data integrations available for Claude today.

If you're building research workflows, portfolio tools, or automated briefings — this is the infrastructure layer that makes it practical.


FAQs

Do I need to know how to code to use FMP MCP with Claude?

No. The Claude Desktop setup requires only editing a JSON config file — no coding involved. You can query financial data in plain English from day one. The Python examples are optional, for those who want to build automated pipelines.

Is FMP MCP available for free?

FMP offers a free tier that includes access to a solid range of endpoints — enough to test and build core workflows. Paid plans unlock higher rate limits, more historical data, and premium endpoints like institutional ownership or advanced DCF models.

What's the difference between using FMP's REST API directly vs using MCP?

The REST API requires you to write integration code: authentication, request formatting, response parsing. MCP exposes those same endpoints as tools Claude can call autonomously. For interactive workflows and natural language queries, MCP is significantly faster to set up and easier to extend.

Can I use FMP MCP with Claude Code, not just Claude Desktop?

Yes. The same MCP server configuration works with Claude Code. You can reference FMP data inside your development environment and build AI-assisted financial tooling without switching contexts.

How current is the data?

FMP provides real-time quotes with minimal delay on paid plans. Historical data, financial statements, and ratios are updated following each earnings release. For intraday trading decisions, always verify against your broker's live feed.


Looking for technical content for your company? I can help — LinkedIn · kevinmenesesgonzalez@gmail.com

Top comments (0)