Skip to main content
Glama
README.md
# filinglens

filinglens is a small local bridge to the hosted Finbolt
MCP server. Its centre of gravity is company financials
taken from SEC filings, with every figure traceable to
the filing it came from: ask for one reported fact and
you get the value together with its accession number,
form, filing date and XBRL tag; ask for a statement and
you get the income statement, balance sheet or cash-flow
statement newest period first. Around that core sit
market data — quotes, daily / weekly / monthly time
series, exchange rates and news sentiment — and the
usual technical indicators.

The bridge holds no data of its own. It serves the
upstream server's captured tool list locally and
forwards each tool call upstream, returning the result
untouched.

## Labelled subset — 21 of 23 tools

This rebuild is a **labelled subset**: it serves 21 of
the 23 tools in the live capture. The two omitted tools
are `find_tool` and `run_tool`, a meta-dispatch pair
that searches and runs "all 113 data tools, including
ones not in the default list". That is a dynamic surface
onto roughly 92 unenumerated tools whose schemas are
nowhere published, so it cannot be parity-pinned and is
deliberately not registered here. Their absence is
asserted in the test suite.

The 21 served tools are entirely read-only: SEC-filing
financials with citations, market data, and technical
indicators. There is no trading, order, or account tool
among them. Upstream descriptions mark the data
"Personal research only"; respect that in use.

## Tools

Time series, search and quotes:

- `fetch_time_series_daily` — daily OHLCV. Required: `symbol`.
- `fetch_time_series_weekly` — weekly OHLCV. Required: `symbol`.
- `fetch_time_series_monthly` — monthly OHLCV. Required: `symbol`.
- `search_endpoint` — symbol / company search. Required: `keywords`.
- `fetch_quote` — latest price and trading info. Required: `symbol`.
- `fetch_news_sentiment` — news sentiment. Required: `tickers`.
- `fetch_company_overview` — overview, ratios, market cap. Required: `symbol`.
- `fetch_exchange_rate` — currency conversion. Required: `from_currency`, `to_currency`.

Statements and earnings:

- `fetch_income_statement` — Required: `symbol`.
- `fetch_balance_sheet` — Required: `symbol`.
- `fetch_cash_flow` — Required: `symbol`.
- `fetch_earnings` — EPS estimates vs actuals. Required: `symbol`.

Technical indicators:

- `fetch_sma` — Required: `symbol`, `interval`, `time_period`.
- `fetch_ema` — Required: `symbol`, `interval`, `time_period`.
- `fetch_macd` — Required: `symbol`, `interval`.
- `fetch_rsi` — Required: `symbol`, `interval`.
- `fetch_bbands` — Required: `symbol`, `interval`.

SEC-filing tools:

- `analyze_stock` — one-call brief: filed fundamentals
  (each filing cited by accession), market figures and
  derived ratios. Required: `symbol`.
- `compare_stocks` — side-by-side table for 2–6 stocks.
  Required: `symbols`.
- `get_fact` — one reported figure with its citation;
  a figure never reported comes back as missing, never
  estimated. Required: `company`, `concept`.
- `financials` — a full statement from SEC filings,
  newest period first, every null carrying a reason.
  Required: `company`.

## Configuration

- `FINBOLT_MCP_URL` (optional) — override the upstream
  endpoint. Defaults to `https://api.getfinbolt.com/mcp`.
  (The override hook is this rebuild's own labelled
  reconstruction.)
- `FINBOLT_API_KEY` (optional) — when set, every upstream
  request carries an `Authorization: Bearer <key>`
  header. When it is not set, no key header is sent.
  (The header name is pinned by the registry record;
  the Bearer scheme and the env forwarding are labelled
  reconstructions — the original surface was captured
  keyless.)

### Forwarding mechanics

On the first tool call the client opens a streamable
HTTP session with the upstream: a JSON-RPC `initialize`
request (protocolVersion `2025-03-26`, clientInfo name
`filinglens`), then a `notifications/initialized`
notification, then the `tools/call` request carrying
the caller's arguments unchanged. When the upstream
answers `initialize` with an `Mcp-Session-Id` header,
that value rides on every later request of the session,
which is reused for the life of the process. Replies
may arrive as plain JSON or as server-sent events;
both are read.

Successful upstream results pass through verbatim,
including any `isError` flag the upstream sets.
Failures — a JSON-RPC error, a non-2xx status, an
unreadable response, or a request that cannot be
completed — come back as an `isError` result whose
text starts with `filinglens error:` (this rendering
is this rebuild's own labelled reconstruction).

## CLI

Each tool is also a subcommand taking one JSON argument
string:

```bash
npx @reneturcios/filinglens fetch_quote '{"symbol":"AAPL"}'
npx @reneturcios/filinglens get_fact '{"company":"AAPL","concept":"revenue"}'
npx @reneturcios/filinglens financials '{"company":"AAPL","statement":"income"}'
npx @reneturcios/filinglens --version
```

Exit codes: `0` on success, `1` on an `isError`
result, `2` on a usage error.

## MCP server

```bash
npx -y @reneturcios/filinglens mcp
```

MCP client config:

```json
{
  "mcpServers": {
    "filinglens": {
      "command": "npx",
      "args": ["-y", "@reneturcios/filinglens", "mcp"]
    }
  }
}
```

## Docker

```bash
docker run -i ghcr.io/cloudcorprecords/filinglens
docker run --rm ghcr.io/cloudcorprecords/filinglens --version
```

The container's default command is `mcp`, so the first
form is a stdio MCP server; any other arguments reach
the CLI normally.

## Development

```bash
npm install
npm run build
npm test
npm run dev
```

The test suite runs entirely against a stubbed
JSON-RPC upstream — no live network calls.

## License

MIT — see `LICENSE`.