Skip to main content
Glama
finquant-mcp

finquant-mcp

Official
by finquant-ai
README.md
# finquant-mcp

MCP server providing SEC EDGAR filing data and FRED macroeconomic indicators for financial analysis workflows.

## What This Does

finquant-mcp is a [Model Context Protocol](https://modelcontextprotocol.io/) server that exposes financial data through 6 tools:

- **SEC EDGAR filings** — fetch, parse, and search 10-K and 10-Q filings for 10 public companies
- **FRED macro data** — retrieve macroeconomic time series (Fed Funds rate, CPI, GDP, unemployment, yield spread, corporate spreads)

The server handles data acquisition, HTML parsing, section extraction, and token counting. It does **not** perform LLM-based analysis — that responsibility belongs to the orchestration layer.

## Covered Companies

| Sector | Company | Ticker | CIK |
|--------|---------|--------|-----|
| Technology | Apple Inc. | AAPL | 0000320193 |
| Technology | Microsoft Corp. | MSFT | 0000789019 |
| Financials | JPMorgan Chase & Co. | JPM | 0000019617 |
| Financials | Goldman Sachs Group | GS | 0000886982 |
| Healthcare | Johnson & Johnson | JNJ | 0000200406 |
| Healthcare | UnitedHealth Group | UNH | 0000731766 |
| Consumer | Amazon.com Inc. | AMZN | 0001018724 |
| Consumer | Procter & Gamble Co. | PG | 0000080424 |
| Energy | Exxon Mobil Corp. | XOM | 0000034088 |
| Energy | NextEra Energy Inc. | NEE | 0000753308 |

Filing coverage: 10-K and 10-Q filings from 2020 to present (~100 filings total).

## FRED Macro Series

| Series ID | Description | Frequency |
|-----------|-------------|-----------|
| FEDFUNDS | Federal Funds Effective Rate | Monthly |
| CPIAUCSL | Consumer Price Index (All Urban) | Monthly |
| GDP | Gross Domestic Product | Quarterly |
| UNRATE | Unemployment Rate | Monthly |
| T10Y2Y | 10-Year minus 2-Year Treasury Spread | Daily |
| BAMLC0A0CM | ICE BofA US Corporate Index OAS | Daily |

## Prerequisites

- Python 3.12+
- [uv](https://docs.astral.sh/uv/) package manager
- FRED API key ([get one here](https://fred.stlouisfed.org/docs/api/api_key.html))

## Quick Start

```bash
# Clone and install
git clone https://github.com/your-org/finquant-mcp.git
cd finquant-mcp
make install

# Configure environment
cp .env.example .env
# Edit .env with your FRED API key and EDGAR User-Agent

# Download and parse filings
make download-filings
make parse-filings

# Start the MCP server
make serve
```

## Claude Desktop Integration

Add this to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "finquant": {
      "command": "uv",
      "args": ["--directory", "/path/to/finquant-mcp", "run", "finquant-mcp"],
      "env": {
        "FRED_API_KEY": "your_key_here",
        "EDGAR_USER_AGENT": "YourName/finquant-mcp your@email.com"
      }
    }
  }
}
```

## MCP Tools Reference

### `list_companies`
List all covered companies with metadata.

**Parameters:** None

**Returns:** List of companies with ticker, name, CIK, and sector.

---

### `fetch_filing`
Fetch a specific SEC filing for a company.

**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ticker` | string | yes | Company ticker (e.g., "AAPL") |
| `filing_type` | string | yes | "10-K" or "10-Q" |
| `period` | string | yes | Filing period (e.g., "2024-Q3") |

**Returns:** Filing metadata and full parsed text with token count.

---

### `get_filing_toc`
Get the table of contents / section list for a filing.

**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ticker` | string | yes | Company ticker |
| `filing_type` | string | yes | "10-K" or "10-Q" |
| `period` | string | yes | Filing period |

**Returns:** List of sections with names and token counts.

---

### `read_section`
Read a specific section from a filing.

**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ticker` | string | yes | Company ticker |
| `filing_type` | string | yes | "10-K" or "10-Q" |
| `period` | string | yes | Filing period |
| `section` | string | yes | Section identifier (from TOC) |

**Returns:** Section text content with token count.

---

### `search_filing`
Search within a filing's text for specific terms.

**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ticker` | string | yes | Company ticker |
| `filing_type` | string | yes | "10-K" or "10-Q" |
| `period` | string | yes | Filing period |
| `query` | string | yes | Search terms |

**Returns:** Matching passages with surrounding context and token counts.

---

### `fetch_fred_series`
Fetch FRED macroeconomic time series data.

**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `series_id` | string | yes | FRED series ID (e.g., "FEDFUNDS") |
| `start_date` | string | no | Start date (YYYY-MM-DD) |
| `end_date` | string | no | End date (YYYY-MM-DD) |

**Returns:** Time series observations with metadata and token count.

## Development

```bash
make lint          # Run ruff linter
make format        # Auto-format code
make test          # Run all tests
make test-unit     # Run unit tests only
make test-integ    # Run integration tests only
```

## Data Storage Layout

```
data/
├── raw/           # Original HTML filings from EDGAR
├── parsed/        # Clean text extracted from HTML
├── sections/      # Individual filing sections
└── finquant.db    # SQLite database (FRED data, filing metadata)
```

- **Raw filings** are cached locally to avoid repeated EDGAR downloads
- **Parsed text** and **sections** are stored as plain text files
- **FRED observations** are stored as individual SQLite rows (`series_id`, `date`, `value`) with TTL-based cache refresh

## Architecture

This server is the **data layer only**. It handles:
- Data acquisition (EDGAR API, FRED API)
- Data transformation (HTML parsing, section extraction)
- Data storage (files + SQLite)
- Data serving (MCP tools with token counting)

LLM-based analysis, multi-step reasoning, and report generation belong in the orchestration layer (separate repo).

## License

Apache 2.0 — see [LICENSE](LICENSE).