Connect to Codex CLI

Ask about any US public company and get the real numbers back — revenue, margins, segments, a decade of history. Your assistant stops hallucinating figures and answers from live, verified data, grounded in what each company actually reported. So you can dig into a business, size it up against peers, and move fast on what you find — with every number traceable to where it came from.

Codex CLI, OpenAI's terminal coding agent, speaks the Model Context Protocol (MCP), connecting to remote servers so it can pull live fundamentals from OpenCapital while it works. Add the server once and it's available in your terminal from then on.

How to connect

01

Add the OpenCapital MCP server

Two interchangeable ways to register OpenCapital — use whichever you prefer.
Run this once in your terminal. It registers OpenCapital as a remote (streamable-HTTP) MCP server in Codex.
codex mcp add opencapital --url https://api.opencapital.sh/mcp

Either way you need a recent Codex — check with codex --version and update via npm i -g @openai/codex or brew upgrade codexif remote servers aren't picked up. Older builds also require experimental_use_rmcp_client = true under [features].

02

Authenticate with OpenCapital

Codex opens your browser to sign in (Google) and approve read-only access, then stores the token for you.
codex mcp login opencapital

The OAuth callback uses localhost, so run this on a machine with a browser. On a headless or SSH session the login can't complete.

03

Verify the connection

Confirm OpenCapital is registered and authenticated.
codex mcp list

Inside the Codex TUI you can also run /mcp to see active servers and their tools.

04

Start asking about stocks

You're all set. Open Codex in any project and ask about fundamentals, segments, or peer comparisons — it'll call OpenCapital as needed, right alongside your code.

Try these prompts

What's Uber's Mobility take rate over the last 8 quarters?
How does Airbnb's ADR compare across regions?
Show me DoorDash Marketplace GOV every quarter since IPO.
Compare cloud revenue across AWS, Azure, GCP, and Oracle.
Find me 10 large-caps growing revenue over 20% with positive free cash flow and a P/E under 30.
Before Nvidia reports, summarize what their suppliers, hyperscaler customers, and competitors said in their last filings.

Codex CLI calls the OpenCapital tools automatically — no special prefix needed. If it doesn't reach for them, ask it to “use the OpenCapital MCP server”.

Lives in your terminal

The OpenCapital connector works with recent Codex builds that support remote MCP servers. Data is read live from the OpenCapital index — Codex always sees the latest fundamentals and price data while it works.

Read-only by design

The OpenCapital MCP server only exposes read-only stock research data — fundamentals, price performance, and earnings dates derived from public SEC filings. Codex cannot place trades or modify any account state.

Troubleshooting

My AI doesn't see OpenCapital 's tools
Make sure the connector is added andenabled, and that you finished the OAuth sign-in. If it still won't use them, ask it directly to “use the OpenCapital MCP server.” In ChatGPT, start the message with @OpenCapital .
The sign-in window didn't open
Authorization happens in your browser. If it didn't open automatically, allow pop-ups and try again, or copy the URL your client shows and open it manually. In Claude Code, run /mcp and choose Authenticate; in the Codex CLI, run codex mcp login opencapital.
It says “needs login” or stopped working
Sign-in tokens can expire. Re-authorize from your client's connector settings, or remove and re-add the OpenCapital server and sign in again — that resolves most connection issues.
Connection failed or the server is unreachable
Confirm the URL is exactly https://api.opencapital.sh/mcp and that you chose the Streamable HTTP transport (not stdio). Make sure your client is up to date — the older SSE transport is deprecated in favor of HTTP.
Still stuck?
Email support@opencapital.sh and we'll help you get connected.

Disclosures

Informational only — not investment advice

OpenCapital provides financial data and research tools, not recommendations. Nothing surfaced through the MCP server is an offer, solicitation, or recommendation to buy or sell any security, and it is not personalized investment, legal, or tax advice. Do your own research and consider consulting a licensed professional before making decisions.

Data sources and accuracy

Fundamentals are derived from public SEC filings and other third-party sources and processed automatically. Data may contain errors, omissions, or delays and is provided “as is” without warranty of accuracy or completeness. Verify against primary sources before relying on it. See our methodology for how the numbers are built.

Read-only access

The OpenCapital MCP server is read-only. It exposes research data only and cannot place trades, move money, or modify any account — yours or anyone else's.

Third-party AI clients

When you connect an AI client (such as Anthropic Claude, OpenAI ChatGPT or Codex, or Cursor), your prompts and the data returned are processed by that third party under its own terms and privacy policy. OpenCapital does not control and is not responsible for third-party AI behavior, output, or data handling. AI can be inaccurate or incomplete — verify before acting on anything it tells you.

Authorization

Connecting grants your client read access to OpenCapital research data via OAuth. You can revoke that access at any time from your client's connector settings. Use is governed by our Terms and Privacy Policy.