Skip to content
Quant Brain / DocsBack to website
DOCUMENTATION / GET STARTED

Technical reference.
Every detail.

Set up your research desk, connect an assistant, and make your first evidence-backed tool call.

THE SIMPLEST START

One computer. One assistant.
One company.

Start locally with Python 3.12 and access to the private repository. A brokerage account is optional.

Start installation
Before you begin

These 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

GoalWhat you needImplementation and verification status
Run the main projectAccess to the private GitHub repo, Git, Python 3.12 and one MCP-capable assistantCodex 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 filingsA contact email you are willing to send to the SEC, or a supported filing you already haveThe main code supports SEC discovery and importing evidence. Live access depends on the SEC and the host.
Read Indian filingsA supported official NSE results document or permitted access to fetch itThe main code supports imports and reports missing periods.
Compare trading strategiesHistorical prices, available through the optional Yahoo providerA broker's current quote alone cannot run a historical backtest.
Get Reliance's last price from your brokerThe broker tool and your own Kotak or Kite credentialsBoth adapters passed simulated tests. Live broker prices are pending.
Use regular ChatGPT privatelyAn eligible ChatGPT account, reachable MCP server and private OAuth integrationThe 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.

  1. Install Git and Python 3.12. Open Terminal and run git --version and python3.12 --version.
  2. 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.
  3. Run the second block there. A virtual environment is a folder that keeps this project's Python packages together.
sh
git clone https://github.com/paarths-collab/quant-brain-mcp.git
cd quant-brain-mcp
sh
python3.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:

sh
.venv/bin/python scripts/demos/demo_research_desk.py

It 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.

yaml
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.

sh
# 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 list

Start 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 mcpServers entry to your user ~/.gemini/settings.json. Start a new session and use /mcp to 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-directory and CONFIG_PATH. Start the server from the MCP controls. Project walkthrough
json
{
  "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.

  1. 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.
  2. Restart the local MCP client so it reads the new private research-sec.env.
  3. 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.”
  4. 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.
  5. 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.
sh
.venv/bin/python scripts/ops/setup_research_desk.py --directory "$QB_CONFIG" --configure-sec

SEC 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.

  1. 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.
  2. 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_filings and report accepted and skipped facts. Mention consolidated or standalone as shown on the document. NSE financial results
  3. Optional direct access: If NSE permits your use, add export QUANT_EXCHANGE_FETCH_ENABLED=1 on its own line in the private research-desk.env and restart the MCP client. Ask it to use nse_load_results_history on the resolved entity. When the response includes client_search, follow its official-link instructions and use nse_import_results_pages. Paid search providers are optional. NSE history walkthrough
  4. 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

sh
. "$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 --once

6. Turn on price history and compare strategies in both markets

Run this inside the same checkout and virtual environment the assistant uses:

sh
.venv/bin/python -m pip install --require-hashes -r requirements/yfinance.txt

Open 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.

BrokerWhat to getWhere it comes from
Kotak Neoconsumer_key and base_urlActivate 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 Kiteapi_key and a current access_tokenCreate/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.

sh
touch "$QB_CONFIG/research-brokers.env"
chmod 600 "$QB_CONFIG/research-brokers.env"
nano "$QB_CONFIG/research-brokers.env"
sh
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.

RouteWhen to choose itInstructions
Local stdioFirst demo on your own computerSteps 2–3
Docker ComposeTest authenticated HTTP on your computerCompose recipe
Linux/systemdKeep the server and optional worker on a machine you manageLinux and HTTPS
RailwayManaged HTTPS with a persistent volumeRailway recipe
Fly.ioOne hosted machine with its own volumeFly.io recipe
AWS LightsailA virtual machine with a domain and HTTPS proxyLightsail recipe
RenderDeploy from a private GitHub repo with a browser dashboardRecipe below

Render, without a Render file in the repo

  1. 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
  2. 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.txt to the build command.
  3. 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.
  4. For saved research, attach a persistent disk at /var/data and set the private variable QUANT_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
  5. Set MCP_API_KEYS to 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. Set MCP_ALLOWED_HOSTS to the actual hostname Render assigns, without https:// or a path. For SEC access, set QUANT_SEC_USER_AGENT to the identifying value from your private SEC file. For historical prices, also set QUANT_YFINANCE_ENABLED=1 after installing the Yahoo profile. For broker quotes, set QUANT_BROKER_ACCOUNTS to the raw owner-keyed JSON from step 7. In dashboard variable fields, omit the shell’s export prefix and surrounding single quotes. Deploy. Render web service guide
  6. 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.
sh
. "$QB_CONFIG/research-desk.env"
codex mcp add quant-brain-hosted --url https://YOUR-HOST/mcp --bearer-token-env-var QUANT_CLIENT_TOKEN
codex

Docker 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.

  1. 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
  2. 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.
  3. 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
  4. 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 seeWhat it proves or what to check
Hermes says Connected or Codex lists the server, but a prompt has no tool callDiscovery 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 requestConfirm 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 quartersCheck the company, consolidated/standalone basis, source permissions and accepted documents. Show the available quarters and gaps.
A backtest reports a disabled or missing providerInstall 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_connectedCheck the build first, then the private file, owner ID and selected broker. Reauthenticate an expired Kite session.
Hosted endpoint returns 401 or 503401: 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 restartConfirm the database path points inside the persistent disk or volume and reconnect as the same owner.
ChatGPT opens a login page but cannot list toolsVerify 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 guidanceImport 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 stepsUse 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 chartsThe 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 figureInstall 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 alertConfigure 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 accessCreate 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 checkUse the tool reference, configuration example, private CI delivery guide and repository documentation index.