Metadata-Version: 2.5
Name: polefinance-mcp
Version: 0.1.0
Summary: MCP server for the Pôle Finance public API — exchanges, instruments, quotes, technical indicators, risk metrics, portfolio optimization and backtests.
Author: PoleFinance
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: mcp<3,>=2.0
Requires-Dist: polefinance>=0.1.0
Provides-Extra: test
Requires-Dist: pytest-asyncio>=0.21; extra == 'test'
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# polefinance-mcp

MCP server for the [Pôle Finance public API](https://polefinance-invest.com/developers/docs) —
exchanges, instruments, delayed quotes (once enabled), technical indicators, risk metrics,
portfolio optimization and backtests. A thin wrapper over the official
[`polefinance`](../python-sdk) Python SDK: every tool call hits the real API with your own key;
nothing is computed or fabricated here.

## Install

**From PyPI (recommended — no repo access needed):**

```bash
uv pip install polefinance-mcp
```

**From source (for contributors working on this repo):**

```bash
cd mcp-server
uv venv
source .venv/bin/activate
uv pip install -e ../python-sdk -e .
```

## Get an API key

Create a project and key at https://polefinance-invest.com/developers/dashboard (scopes
`instruments:read` and `analytics:compute` cover every tool below except quotes, which also
needs `market_data:read` and is not yet enabled in production).

## Run it

```bash
POLEFINANCE_API_KEY=pf_live_... polefinance-mcp
```

This starts a stdio MCP server — it's meant to be launched by an MCP client, not run standalone
in a terminal for long.

## Configure a client

**Claude Desktop / Claude Code** — add to the client's MCP config (e.g.
`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "polefinance": {
      "command": "polefinance-mcp",
      "env": { "POLEFINANCE_API_KEY": "pf_live_..." }
    }
  }
}
```

If `polefinance-mcp` isn't on the client's PATH, point `command` at the venv's copy instead, e.g.
`"/absolute/path/to/mcp-server/.venv/bin/polefinance-mcp"`.

## Tools

| Tool | Scope needed | Maps to |
|---|---|---|
| `list_exchanges` | `instruments:read` | `GET /exchanges` |
| `search_instruments` | `instruments:read` | `GET /instruments` |
| `get_instrument` | `instruments:read` | `GET /instruments/{id}` |
| `get_quotes` | `market_data:read` (disabled in prod) | `GET /market-data/quotes` |
| `compute_technical_indicators` | `analytics:compute` | `POST /technical/indicators` |
| `compute_risk_metrics` | `analytics:compute` | `POST /risk/metrics` |
| `optimize_portfolio` | `analytics:compute` | `POST /optimization/portfolio` |
| `run_backtest` | `analytics:compute` | `POST /backtests/run` |

The four `analytics:compute` tools are rate-limited to 10 calls/minute per key and accept at most
10 assets × 2,520 bars (same limits as the API itself — see `../docs/DEVELOPER_PLATFORM.md`).

## Tests

```bash
cd mcp-server && source .venv/bin/activate && pytest
```

The tests only check that the server starts and the tool list/schemas are well-formed — they do
not call the live API (no key is required to run them).
