This workspace includes two MCP clients and five finance-focused MCP servers that use free/keyless APIs. Both clients talk to OpenAI and can call tools exposed by the servers discovered from ~/.mcp/config.json.
mcp/mcp-client: simple single-loop client.mcp/mcp-agentic: LangGraph-based client with explicit graph/state handling and tool normalization.mcp/mcp-deep-agents: LangGraph “deep agent” with planning (TODOs), scratch files, and MCP tool execution.
- Python 3.11+
- uv installed (
curl -LsSf https://astral.sh/uv/install.sh | sh) - OpenAI API key in
mcp/mcp-client/.env(setOPENAI_API_KEY, optionallyOPENAI_BASE_URLandOPENAI_MODEL)
From repo root:
# Create a virtual env with uv and activate it
uv venv .venv
source .venv/bin/activate
# Install the classic client dependencies
uv pip install -e mcp/mcp-clientIf you are already inside mcp/mcp-client, install with:
uv pip install -e .Agentic client:
uv pip install -e mcp/mcp-agenticIf you are already inside mcp/mcp-agentic, install with:
uv pip install -e .Deep agent:
uv pip install -e mcp/mcp-deep-agentsIf you are already inside mcp/mcp-deep-agents, install with:
uv pip install -e .~/.mcp/config.json should point to the servers in this repo, for example:
{
"mcpServers": {
"sec-filings": {
"command": "uv",
"args": [
"--directory",
"~/mcp/mcp-servers/sec-filings",
"run",
"sec_filings.py"
]
},
"gdelt-news": {
"command": "uv",
"args": [
"--directory",
"~/mcp/mcp-servers/gdelt-news",
"run",
"gdelt_news.py"
]
},
"macro-data": {
"command": "uv",
"args": [
"--directory",
"~/mcp/mcp-servers/macro-data",
"run",
"macro_data.py"
]
},
"stooq-prices": {
"command": "uv",
"args": [
"--directory",
"~/mcp/mcp-servers/stooq-prices",
"run",
"stooq_prices.py"
]
},
"fhfa-hpi": {
"command": "uv",
"args": [
"--directory",
"~/mcp/mcp-servers/fhfa-hpi",
"run",
"fhfa_hpi.py"
]
}
}
}- sec-filings (SEC EDGAR submissions/facts, keyless):
- “List recent filings for CIK 0000320193.”
- “Fetch company facts keys for CIK 0000789019.”
- “Summarize submissions for CIK 0001652044.”
- gdelt-news (GDELT DOC API, keyless):
- “Search news about Tesla stock in the last week.”
- “Company news for NVDA.”
- “Topic trends for inflation.”
- macro-data (Treasury Fiscal Data, World Bank, ECB, keyless):
- “Get recent debt outstanding.”
- “Get recent Treasury yields.”
- “World Bank indicator FP.CPI.TOTL for USA, 2015:2023.”
- “ECB series EXR/M.USD.EUR.SP00.A.”
- stooq-prices (Stooq historical OHLCV, keyless):
- “Get daily OHLCV for AAPL.US for the last 10 rows.”
- “Fetch daily OHLCV for spy.us between 2024-01-01 and 2024-02-01.”
- fhfa-hpi (FHFA House Price Index CSVs, keyless):
- “Show FHFA HPI state sample rows.”
- “Show FHFA HPI metro sample rows.”
Classic client (mcp-client)
┌────────────────────────┐ messages (system prompt + memory window) ┌────────────────────┐
│ OpenAI LLM │ <------------------------------------------> │ MCP Client │
│ (chat + tool calling) │ tools advertised via server__tool schemas │ (mcp-client/) │
└────────────────────────┘ └────────────┬───────┘
│
~/.mcp/config.json declares servers │ stdio
│
┌────────────────┬─────────────┬──────────────┬───────────────┬──────────────┐
│ sec-filings │ gdelt-news │ macro-data │ stooq-prices │ fhfa-hpi │
│ (SEC EDGAR) │ (GDELT DOC) │ (Treasury, │ (Stooq CSV) │ (FHFA HPI) │
│ │ │ WB, ECB) │ │ │
└────────────────┴─────────────┴──────────────┴───────────────┴──────────────┘
Agentic client (mcp-agentic / LangGraph)
┌────────────────────────┐ messages (system prompt + memory window) ┌──────────────────────────┐
│ OpenAI LLM │ <------------------------------------------> │ LangGraph MCP Agent │
│ (chat + tool calling) │ tools advertised via server__tool schemas │ (llm → tool → normalize │
└────────────────────────┘ │ → llm) │
└──────────────┬───────────┘
│
~/.mcp/config.json declares servers │ stdio
│
┌────────────────┬─────────────┬──────────────┬───────────────┬──────────────┐
│ sec-filings │ gdelt-news │ macro-data │ stooq-prices │ fhfa-hpi │
│ (SEC EDGAR) │ (GDELT DOC) │ (Treasury, │ (Stooq CSV) │ (FHFA HPI) │
│ │ │ WB, ECB) │ │ │
└────────────────┴─────────────┴──────────────┴───────────────┴──────────────┘
Deep agent (mcp-deep-agents / LangGraph with planning)
┌────────────────────────┐ messages (system prompt + memory window) ┌─────────────────────────────┐
│ OpenAI LLM │ <------------------------------------------> │ Deep MCP Agent (plan → │
│ (chat + tool calling) │ tools advertised via server__tool schemas │ tool → normalize → llm) │
└────────────────────────┘ └────────────────┬────────────┘
│
~/.mcp/config.json declares servers │ stdio
│
plans + tool outputs saved to runs/<timestamp>/ (persistent scratchpad)
│
┌────────────────┬─────────────┬──────────────┬───────────────┬──────────────┐
│ sec-filings │ gdelt-news │ macro-data │ stooq-prices │ fhfa-hpi │
│ (SEC EDGAR) │ (GDELT DOC) │ (Treasury, │ (Stooq CSV) │ (FHFA HPI) │
│ │ │ WB, ECB) │ │ │
└────────────────┴─────────────┴──────────────┴───────────────┴──────────────┘
Memory/prompt: both clients keep a rolling history (configurable via `MCP_MAX_HISTORY`) that includes the system prompt. `reset` clears in-memory history; restart clears all state. Tools are normalized as `server__tool` for OpenAI compatibility. The agentic client also normalizes tool outputs into JSON strings to stabilize formatting between turns.
## Article and walkthrough
See `mcp/article.md` for a narrative overview of the architectures (classic, agentic, deep), how to run them, and what to expect.
- Create the server folder under
mcp/mcp-servers/<server-name>/. - Add a
pyproject.toml(use an existing server as a template) and a<server_name>.pywithFastMCPtools. - (Optional)
uv pip install -e .inside that server folder to ensure dependencies resolve. - Update
~/.mcp/config.jsonto include the new server entry:Make sure the path and script name match your server."my-server": { "command": "uv", "args": [ "--directory", "~/mcp/mcp-servers/my-server", "run", "my_server.py" ] }
- Restart the MCP client (
uv run --directory mcp/mcp-client python client.py). It will auto-discover tools from the new server.
uv run --directory mcp/mcp-client python client.pyIf you are inside mcp/mcp-client, the equivalent is:
uv run python client.pyThis will connect to the configured MCP servers, let you chat, and route tool calls as needed.
From repo root:
uv run --directory mcp/mcp-agentic python client.pyFrom inside mcp/mcp-agentic:
uv run python client.pyIt uses the same servers from ~/.mcp/config.json, applies the same prompt/memory window, and drives tool calls through a LangGraph loop (LLM → tools → LLM).
From repo root:
uv run --directory mcp/mcp-deep-agents python client.pyFrom inside mcp/mcp-deep-agents:
uv run python client.pyAdds planning (TODOs), tool execution, and persists plans/outputs to runs/<timestamp>/.
- mcp-client (classic): minimal dependencies, straightforward control flow, good for quick CLI use and debugging tool availability.
- mcp-agentic (LangGraph): explicit graph (LLM → tool → normalization → LLM), safer tool name handling, heuristics to infer missing args (tickers, dates, CIKs), and tool output normalization to stabilize responses.
- mcp-deep-agents (LangGraph + planning): adds TODO planning, scratch files (
runs/), and heuristics for missing args; designed for multi-step tasks and revisitable context.