Technical reference.
Every detail.
Set up your research desk, connect an assistant, and make your first evidence-backed tool call.
One computer. One assistant.
One company.
Start locally with Python 3.12 and access to the private repository. A brokerage account is optional.
Start installationThese instructions follow the project’s first-research-demo guide. Broker adapters have simulated test coverage; live quotes and the regular ChatGPT OAuth workflow still need verification or implementation.
Quant Brain gives an AI assistant tools for looking up filings, reading historical prices and comparing strategies. The assistant explains the results. You choose which sources it can use. Start with one computer, one assistant and one company. Add hosting when you want to use the server from somewhere else.
Shortest route: Install Quant Brain → connect Hermes or Codex → ask it to list your saved companies → enable historical prices → compare two strategies on Apple → repeat for Reliance. You can do this without a brokerage account.
1. Pick the version and gather what you need
| Goal | What you need | Implementation and verification status |
|---|---|---|
| Run the main project | Access to the private GitHub repo, Git, Python 3.12 and one MCP-capable assistant | Codex completed 17 tool calls on synthetic stored US and NSE data on a recorded release candidate. Verification record Hermes discovered the 100-tool catalog before the broker quote was added. |
| Read US filings | A contact email you are willing to send to the SEC, or a supported filing you already have | The main code supports SEC discovery and importing evidence. Live access depends on the SEC and the host. |
| Read Indian filings | A supported official NSE results document or permitted access to fetch it | The main code supports imports and reports missing periods. |
| Compare trading strategies | Historical prices, available through the optional Yahoo provider | A broker's current quote alone cannot run a historical backtest. |
| Get Reliance's last price from your broker | The broker tool and your own Kotak or Kite credentials | Both adapters passed simulated tests. Live broker prices are pending. |
| Use regular ChatGPT privately | An eligible ChatGPT account, reachable MCP server and private OAuth integration | The main repo has bearer-token HTTP. Its ChatGPT OAuth integration is pending. |
Which copy? The main branch includes Docker Compose, the Code Mode integration and the broker quote tool as of merge commit 1da7f457. In an older installation, check the server's tool list for nse_broker_quote. The current Python MCP catalog contains 101 tools. Packaged tool catalog
2. Install on one computer
These commands use Terminal on macOS or Linux. On Windows, using Ubuntu in WSL lets you follow the same commands for a client running inside WSL. For a native Windows desktop client, install native Python 3.12 and use the virtual environment's Scripts\quant-brain-stdio.exe and Windows paths in its configuration.
- Install Git and Python 3.12. Open Terminal and run
git --versionandpython3.12 --version. - If this is a fresh installation, run the first block. Private repository access uses your authorized GitHub account. If you already have the intended checkout, open Terminal in that folder and skip the clone.
- Run the second block there. A virtual environment is a folder that keeps this project's Python packages together.
git clone https://github.com/paarths-collab/quant-brain-mcp.git
cd quant-brain-mcppython3.12 -m venv .venv
.venv/bin/python -m pip install --require-hashes -r requirements/research.txt
.venv/bin/python -m pip install --no-deps .
QB_CONFIG="$HOME/.local/share/quant-brain"
.venv/bin/python scripts/ops/setup_research_desk.py --directory "$QB_CONFIG"
printf 'Server executable: %s\nPrivate settings: %s\n' "$PWD/.venv/bin/quant-brain-stdio" "$QB_CONFIG"Save the last two printed paths. Below, SERVER_PATH and CONFIG_PATH mean those full paths. The private folder contains research-desk.env and, as you use the server, a SQLite database holding your research. The setup script creates private credentials for HTTP and preserves them on subsequent runs. Keep secrets out of screenshots, chat messages and Git. In a new terminal set QB_CONFIG="$HOME/.local/share/quant-brain" again.
First check without a key or assistant
From the project folder, run the built-in example after installing the research environment:
.venv/bin/python scripts/demos/demo_research_desk.pyIt uses a temporary database and invented filings. Look for the final message confirming that financials, screening, peer comparison, valuation, guidance and a filing-driven thesis breach completed. This checks the research software before you troubleshoot an assistant or a live source. To check extraction against saved official Apple and Reliance documents, follow the real-document test instructions.
3. Connect one assistant
Local stdio means the assistant starts Quant Brain on your computer. You need neither a public address nor a broker token for the first check. Pick one client. All local examples use the same executable and private folder.
Hermes Agent
Open ~/.hermes/config.yaml. Add the entry below to its existing mcp_servers section, retaining your other servers. Replace both example paths.
mcp_servers:
quant-brain:
command: "/FULL/SERVER_PATH"
args: ["--config-directory", "/FULL/CONFIG_PATH"]Run hermes mcp test quant-brain. Success means Connected and a list of tools. Then run hermes chat. Tool discovery and a successful research call are two separate checks. Hermes instructions
Codex or Claude Code
From the installed project folder, run the pair for your client. These commands expand the paths for you. If it already has a server named quant-brain, inspect that entry first so you know which version it launches.
# Codex
codex mcp add quant-brain -- "$PWD/.venv/bin/quant-brain-stdio" --config-directory "$QB_CONFIG"
codex mcp list
# Claude Code
claude mcp add --scope user --transport stdio quant-brain -- "$PWD/.venv/bin/quant-brain-stdio" --config-directory "$QB_CONFIG"
claude mcp listStart a new client session. Claude Code also shows connection status with /mcp. Codex MCP · Claude Code MCP
Claude Desktop, Gemini CLI or GitHub Copilot
- Claude Desktop: Open Settings → Developer → Edit Config. Add the JSON entry below, save and fully quit and reopen Claude Desktop when you are ready. Desktop setup
- Gemini CLI: Add the same
mcpServersentry to your user~/.gemini/settings.json. Start a new session and use/mcpto inspect the server. Gemini MCP guide - GitHub Copilot in VS Code: Open the Command Palette → MCP: Add Server → Command (stdio). Use SERVER_PATH as the executable and two arguments,
--config-directoryand CONFIG_PATH. Start the server from the MCP controls. Project walkthrough
{
"mcpServers": {
"quant-brain": {
"command": "/FULL/SERVER_PATH",
"args": ["--config-directory", "/FULL/CONFIG_PATH"]
}
}
}First prompt for any client: “Use Quant Brain to list companies already saved for me. Show the tool name and the returned count. If there are none, say so.” An empty result is a successful first call on a fresh database. If the assistant answers from memory, select or enable the server and repeat.
4. US research with Apple and SEC EDGAR
The SEC is the US securities regulator. EDGAR is where companies file reports. A 10-K is an annual filing and a 10-Q is quarterly. EDGAR supplies filing evidence. Historical stock prices come from the separate setup in step 6.
- To enable live requests, run the command below. Enter an email you control and are willing to send to the SEC in the request header. This is an identifying contact. There is no SEC API key. Leave the prompt blank if you prefer to work from downloaded filings.
- Restart the local MCP client so it reads the new private
research-sec.env. - Ask: “Use Quant Brain to search the US directory for AAPL with refresh enabled. Find the exact Apple Inc. row and show its ticker and SEC issuer ID. Pass that returned US issuer ID to sync_company_filings with max_filings=2. If the directory returns no exact match, stop and report the gap. Show filing dates, source links and any errors.”
- Then ask: “From the filings actually saved, show the latest available revenue, reporting period, currency and source. If the financial figure is missing, show the gap.” The tool result should identify evidence for the number.
- If the SEC blocks the host, download a supported official filing from EDGAR and give it to a file-capable local assistant. Ask it to import the file with
ingest_company_filings, preserving the issuer, official source and publication date. A client that cannot read attachments will need the supported document input described in the tool reference.
.venv/bin/python scripts/ops/setup_research_desk.py --directory "$QB_CONFIG" --configure-secSEC filing search · SEC data APIs · Project tool reference
5. Indian research with Reliance and NSE
NSE is India's National Stock Exchange. For this example the cash-equity symbol is RELIANCE. The price provider uses RELIANCE.NS. The broker tool uses RELIANCE. A consolidated result covers the group; standalone results cover the individual company. Compare periods on the same basis.
- Start from an official Reliance financial-results document. Save its source URL, publication date and reporting period. If needed, ask the assistant to register the local listing as NSE, symbol RELIANCE, entity ID
IN:RELIANCE, type EQUITY, currency INR and the exact company name printed on the official filing. NSE history import uses the registered name to check the document. The registration records your input; the filing provides evidence. - Manual path: Give the local assistant a supported official Indian financial-results PDF you are permitted to use. Ask it to import the document using
ingest_company_filingsand report accepted and skipped facts. Mention consolidated or standalone as shown on the document. NSE financial results - Optional direct access: If NSE permits your use, add
export QUANT_EXCHANGE_FETCH_ENABLED=1on its own line in the privateresearch-desk.envand restart the MCP client. Ask it to usense_load_results_historyon the resolved entity. When the response includesclient_search, follow its official-link instructions and usense_import_results_pages. Paid search providers are optional. NSE history walkthrough - Ask: “Show Reliance's two latest available consolidated quarters from saved filings. Include period end, revenue, unit, source and any missing quarter.” Check lakh/crore and INR before comparing. If only one quarter was imported, report one.
Optional automatic checks: First configure a filing watch in the assistant. On the same computer, in the project folder, run the commands below to poll once for the default local owner. Read the per-source outcomes. To keep polling, replace --once with --interval 300 and keep the process running. The worker and assistant must use the same database and owner. After polling, ask Quant Brain to call get_system_status and show the worker heartbeat, last attempt and last success. An empty poll can succeed before any new filing arrives. Worker setup
. "$QB_CONFIG/research-desk.env"
if [ -f "$QB_CONFIG/research-sec.env" ]; then . "$QB_CONFIG/research-sec.env"; fi
.venv/bin/quant-brain-filing-worker --db "$QUANT_RESEARCH_DB" --owner local-research --once6. Turn on price history and compare strategies in both markets
Run this inside the same checkout and virtual environment the assistant uses:
.venv/bin/python -m pip install --require-hashes -r requirements/yfinance.txtOpen the private research-desk.env from step 2 in a text editor. Add export QUANT_YFINANCE_ENABLED=1 on its own line, save, and restart the MCP client. The optional provider uses Yahoo Finance through yfinance. Provider access and coverage can change. Price provider setup
Use this prompt twice, first for AAPL, then for RELIANCE.NS:
Use Quant Brain first. Run backtest_sma_crossover and backtest_rsi_mean_reversion on AAPL, both with period 2y. Show the actual dates and metrics each tool returned, including return, drawdown and trade count where available. Flag differences in usable dates or warm-up. If a tool or data source fails, tell me which one. Label any fallback separately.
A backtest applies a rule to historical prices. The SMA strategy follows a moving-average crossover; the RSI strategy looks for mean reversion. Compare the two rules within each ticker. Look for two tool calls per ticker. A result with no trades can be valid. Report missing data or a timeout explicitly.
Optional Code Mode demo: For a repeatable comparison without a price feed, run the Cloudflare Code Mode walkthrough. Its one MCP call runs both strategies on the same 504 synthetic trading days.
7. Optional Reliance quotes from Kotak Neo and Zerodha Kite
Use the same installation and private settings directory from step 2. In your client, verify that the tool list includes nse_broker_quote.
| Broker | What to get | Where it comes from |
|---|---|---|
| Kotak Neo | consumer_key and base_url | Activate Neo Trade API access, get the plain API token from the Neo API dashboard, complete the broker's login validation and copy the assigned baseUrl from its response. Use that exact HTTPS host. Activation · Quote API |
| Zerodha Kite | api_key and a current access_token | Create/select a Kite Connect app with market-data access and a redirect URL you control. Open the app's Kite login, sign in, then have the app's login client exchange the returned request_token using the app secret. Save the resulting access token here. Complete login again when it expires. Kite developer dashboard · Login walkthrough and token exchange · Quote API |
Where to paste the values: in Terminal, with QB_CONFIG set to the broker demo's directory, run the commands below. They open a private text file. Put the example line in it, replace each placeholder on your own machine, then press Ctrl+O, Enter, Ctrl+X in nano. Keep the broker passwords, Kite app secret, MPIN and one-time codes in the broker login flow.
touch "$QB_CONFIG/research-brokers.env"
chmod 600 "$QB_CONFIG/research-brokers.env"
nano "$QB_CONFIG/research-brokers.env"export QUANT_BROKER_ACCOUNTS='{"local-research":{"kotak":{"consumer_key":"YOUR_NEO_TOKEN","base_url":"YOUR_ASSIGNED_HTTPS_BASE_URL"},"zerodha":{"api_key":"YOUR_KITE_KEY","access_token":"YOUR_CURRENT_KITE_TOKEN"}}}'Restart the broker-enabled MCP. Ask: “Use Quant Brain to get Reliance's last-traded price from Kotak and then Zerodha. Show broker, symbol, INR price and retrieval time for each. If one fails, show its error.” Check that each call uses ticker=RELIANCE and the respective broker=kotak or broker=zerodha. Two calls can observe different prices. Retrieval time is when the MCP received the quote; the trade timestamp is unavailable here.
Each user can connect either broker or both. The operator maps credentials to that user's authenticated owner ID. For hosted HTTP, enter the raw JSON in the host's private QUANT_BROKER_ACCOUNTS variable and match its owner IDs to MCP_API_KEYS. The demo reads prices only. Kotak currently maps Reliance only; these adapters do not supply the historical series for step 6.
8. Host the server when you want a remote client
Choose one hosting route. Local stdio already serves Hermes, Codex and Claude. For a remote assistant the addresses have different jobs: /health checks that a process is up; /mcp is where the client connects. Hosted credentials belong in the provider's private environment settings.
| Route | When to choose it | Instructions |
|---|---|---|
| Local stdio | First demo on your own computer | Steps 2–3 |
| Docker Compose | Test authenticated HTTP on your computer | Compose recipe |
| Linux/systemd | Keep the server and optional worker on a machine you manage | Linux and HTTPS |
| Railway | Managed HTTPS with a persistent volume | Railway recipe |
| Fly.io | One hosted machine with its own volume | Fly.io recipe |
| AWS Lightsail | A virtual machine with a domain and HTTPS proxy | Lightsail recipe |
| Render | Deploy from a private GitHub repo with a browser dashboard | Recipe below |
Render, without a Render file in the repo
- In Render, choose New → Web Service, connect your authorized private repo, select the intended branch and choose the Python runtime. Use the repo root. Select Python 3.12 using a Render-supported full 3.12 patch version. Python version setting
- Set Build Command to
python -m pip install --require-hashes -r requirements/research.txt && python -m pip install --no-deps .. For the historical-price demo, add&& python -m pip install --require-hashes -r requirements/yfinance.txtto the build command. - Set Start Command to
python -m uvicorn quant_brain.mcp.http:app --host 0.0.0.0 --port "$PORT" --workers 1. Set Health Check Path to/health. - For saved research, attach a persistent disk at
/var/dataand set the private variableQUANT_RESEARCH_DB=/var/data/research.sqlite3. Render requires a paid service for a persistent disk. Files on its free service can disappear at restart or redeploy. Choose a plan yourself before creating resources. Render disks - Set
MCP_API_KEYSto the JSON digest map from the private file created in step 2. Copy only the JSON value using a private editor. The matching raw token,QUANT_CLIENT_TOKEN, stays with the client. SetMCP_ALLOWED_HOSTSto the actual hostname Render assigns, withouthttps://or a path. For SEC access, setQUANT_SEC_USER_AGENTto the identifying value from your private SEC file. For historical prices, also setQUANT_YFINANCE_ENABLED=1after installing the Yahoo profile. For broker quotes, setQUANT_BROKER_ACCOUNTSto the raw owner-keyed JSON from step 7. In dashboard variable fields, omit the shell’sexportprefix and surrounding single quotes. Deploy. Render web service guide - Open
https://YOUR-HOST/health. For an authenticated test from your terminal, source the matching private settings file, then register the remote server in Codex with the command below. In Codex, ask it to list saved companies, save one permitted test record and retrieve it after restarting the host. A separate Render worker cannot share the web service's attached disk. For this SQLite setup, the Linux worker recipe keeps the scheduler and server on the same disk.
. "$QB_CONFIG/research-desk.env"
codex mcp add quant-brain-hosted --url https://YOUR-HOST/mcp --bearer-token-env-var QUANT_CLIENT_TOKEN
codexDocker users: the supplied Compose recipe forwards the auth map and allowed hosts and mounts a named research volume. Desktop configuration files and optional providers are separate. To use SEC or exchange fetching, pass the corresponding variables explicitly to the service. To use Yahoo in the image, also install requirements/yfinance.txt in its Dockerfile and rebuild. The Compose health, authentication, discovery and record persistence checks passed locally. Each cloud installation needs its own checks. Container guide
9. Connect regular ChatGPT on the web
You can keep the GitHub repo private. ChatGPT needs a reachable running server. The GitHub repo URL does not start one.
- Check your account. On ChatGPT web, open Plugins → + → Add custom MCP server. Business or Enterprise/Edu workspace permissions can control this action. OpenAI lists read/fetch connections for Pro. The older interface uses Settings → Apps → Create. Current account and setup instructions
- Choose a connection. Enter the public HTTPS URL ending in
/mcp, or select a configured Secure MCP Tunnel when available. A tunnel handles network reachability; user sign-in is a separate step. - Private sign-in requires an implementation. The reviewed main server recognizes static bearer-token hashes. Before using the OAuth option you chose, a developer must connect a supported identity provider, publish MCP authorization discovery metadata, validate issued access tokens and map each user to a stable Quant Brain owner ID. Configure the provider's allowed redirect URI from the actual ChatGPT connection screen. Test that two signed-in users see only their own records. An identity-provider account by itself does not add OAuth to the server. OpenAI authentication guide
- After OAuth is working, name the connection Quant Brain, select OAuth, enter any required OAuth client details in the connection settings, sign in, create the plugin and review the tools ChatGPT discovers. In a new chat select Quant Brain and use the prompt in step 6. Verify the tool calls. This native ChatGPT workflow is pending for the main build.
10. Know when the demo has passed
| What you see | What it proves or what to check |
|---|---|
| Hermes says Connected or Codex lists the server, but a prompt has no tool call | Discovery worked. Enable/select Quant Brain and ask for a named tool. Inspect its result in the conversation. |
| SEC reports a missing contact or a forbidden request | Confirm the MCP loaded the private SEC setting. A host can still be blocked upstream. Use an official downloaded filing you have permission to import. |
| NSE reports missing quarters | Check the company, consolidated/standalone basis, source permissions and accepted documents. Show the available quarters and gaps. |
| A backtest reports a disabled or missing provider | Install the Yahoo profile in the server's own environment, pass the opt-in variable to the server and restart. Verify history for the exact ticker first. |
Broker tool missing, or broker_not_connected | Check the build first, then the private file, owner ID and selected broker. Reauthenticate an expired Kite session. |
| Hosted endpoint returns 401 or 503 | 401: check the client's raw token against the configured owner's digest. 503 on an unauthenticated MCP request can mean the digest map is missing. Check server configuration and logs. |
| Research disappears after a restart | Confirm the database path points inside the persistent disk or volume and reconnect as the same owner. |
| ChatGPT opens a login page but cannot list tools | Verify OAuth discovery, callback URL, token audience and owner mapping. Test the complete sign-in and tool call from ChatGPT. |
A short portfolio recording: Show the assistant connecting, one sourced Apple filing figure, one sourced Reliance figure, then two strategy calls on the same ticker and period. If live broker credentials are available, finish with the two Reliance quotes. Label simulated results, unavailable sources and untested integrations on screen. Keep private settings closed during recording.
11. Where to go after the first demo
| If you want to… | What to set up |
|---|---|
| Review companies, screen peers, build valuation scenarios or track management guidance | Import sourced financial facts, then use the research tools. For a saved thesis, choose a baseline fact and a measurable assumption before setting up a watch. Research Desk · Thesis Watch |
| Save your own criteria and reuse a sequence of research steps | Use the rules and workflow tools with the same owner each time. The normal local setup uses SQLite. For PostgreSQL-backed rules and workflows, configure QUANT_RULES_DATABASE_URL in the server process environment. Filings and facts still need the persistent SQLite disk. Deployment settings · Tool reference |
| Use a local dashboard or export charts | The optional local Research Desk UI needs the desk dependency profile. For chart image export, provision Chrome or Chromium and run the chart smoke check in that environment. Dashboard setup · Chart verification |
| Read a scanned filing or check the source of a figure | Install the optional PDF profile for preprocessing. OCR also needs Tesseract and its English language data. Review extracted text against the original before importing it. PDF setup · Filing and evidence workflow |
| Set a durable price alert | Configure PostgreSQL with DATABASE_URL, enable the price source and schedule a client to poll for triggered alerts. The filing worker polls filing watches. Price alert setup |
| Back up research or give someone read-only access | Create and verify a backup, then test restoration to a new file. QUANT_READ_ONLY=1 blocks tools that save data, including imports and some calculations. Backup, restore and access controls |
| Find a specific tool, optional setting or release check | Use the tool reference, configuration example, private CI delivery guide and repository documentation index. |