Connect EODHD to your agent
By the end of this lesson you will have the EODHD MCP server signed in from your agent, one data answer checked against the academy's own call, the measured cost of one question, and that cost written into your PLAN.md.
Left alone, your agent is guessing about this API. It remembers field names from its training data, some of them wrong, and it cannot check. This lesson gives it the real thing — and then shows you what that costs, because an agent with live data spends your calls exactly the way your code does.
Two official tools, one sign-in
The EODHD MCP server. MCP is a standard way to hand an agent a set of tools. EODHD APIs runs one at https://mcp.eodhd.com/v2/mcp, with around seventy tools: historical prices, live quotes, fundamentals, your account details, and the API's own documentation. With it, the agent can call a real endpoint while it writes your code and see the actual response shape instead of predicting one.
In the starter, Claude Code finds the server already wired: .mcp.json in the repo root names it, with a URL and nothing else, and you said yes to it on the first run in lesson 2 (if you did not, /mcp offers it again). Outside the starter, one command from your shell adds the same server to any project:
claude mcp add --transport http eodhd https://mcp.eodhd.com/v2/mcp
Codex does not read .mcp.json. One command from your shell adds the server to Codex for every folder on your machine, in ~/.codex/config.toml, and opens the sign-in straight away:
codex mcp add eodhd --url https://mcp.eodhd.com/v2/mcp
The EODHD plugin for Claude Code. It adds skills that teach the agent the whole API — endpoint references, the symbol format, which plan covers what — plus a few slash commands, such as /eodhd-api:eodhd-analyze AAPL. Install it from inside a Claude Code session:
/plugin marketplace add EodHistoricalData/eodhd-claude-skills
/plugin install eodhd-api@eodhd-claude-skills
The second command opens a panel: choose Install for you, so every project on this machine has it, then run /reload-plugins or restart. The plugin connects the same server; in the starter, the entry in .mcp.json wins, so you sign in once.
Codex has no build of the plugin. The same repository carries a Codex adapter that drives the helper scripts, which want your key in an environment variable; this course does not need it, because the MCP server already carries the API's documentation.
On the alternative path, look for MCP in your editor's settings and add the same URL.
Where the key lives: nowhere you have to type it
The v2 server signs you in with OAuth: a browser page asks you to sign in to your EODHD account and approve access, and your agent keeps the sign-in. In Claude Code, run /mcp, pick the eodhd server and authenticate. In Codex, codex mcp add has already opened that page; codex mcp login eodhd opens it again. There is no key in .mcp.json or ~/.codex/config.toml, and there must never be one — no key goes into a config file, a prompt or the repository.
That makes three homes for credentials in this course, and they never mix:
| Who uses it | Where it lives |
|---|---|
| Your agent, through MCP | the OAuth sign-in your agent keeps — nothing in the repo |
| The plugin's helper scripts, if you use them | EODHD_API_TOKEN in your shell profile, outside the repo |
| Your app | EODHD_API_KEY in .env.local and the host's settings — denied to the agent |
Two traps. The older v1 server takes the key in its URL, ?apikey= — the exact shape lesson 3 warned about, written into a config file that is one git add . from being public. Use v2. And never paste your key into the chat to help the agent along: anything in the conversation can end up in a file it writes.
Build time and runtime are different worlds
One boundary, and it holds for the whole track. The agent queries the API at build time; your deployed tool never does. The agent's calls happen on your machine, under your sign-in, while you watch. Your running application talks to the API through the server-side proxy, and only that way, because it is reachable by strangers. Confusing the two is how keys leak.
Exploration is not free
MCP tools are billed exactly like the API they call. Measured on 6 November 2026:
| What the agent asked for | Calls |
|---|---|
Your account details (/user) |
0 |
| Daily history for one symbol | 1 |
| Live prices for three symbols | 3 |
A live snapshot of a whole exchange (the live-price tool with ex=US) |
100 |
Fundamentals cost what /fundamentals costs, 10 a company. On a plan that has them, one innocent question — which US stocks are up most today? — can cost a hundred calls before your app has made a single request, if the agent answers it with an exchange-wide snapshot, and two fundamentals look-ups cost twenty. The free plan has neither: there they are refused with 403, which is cheaper but answers nothing.
So rule 5 of the house rules applies to the agent's own questions too: before it calls anything, it says what it will cost. Put it in the request — before you call any EODHD tool, tell me which one and how many calls; ask before anything over 5. Most build-time questions, such as which fields /real-time returns, are answered by the documentation the server carries, which costs nothing.
Try it now
The prompt
In Claude Code, install the plugin if you want its skills, then type /mcp, pick eodhd and sign in, as above. In Codex, add the server and sign in as above, start codex in the starter, and type /mcp to see the server listed. Then paste:
Before you call any EODHD tool, tell me which one and how many API
calls it will cost, and ask before anything over 5. First question:
what plan am I on, and how many API calls have I used today?
When it has answered, ask one data question:
How did AAPL.US close each day from 24 to 28 August 2026? Daily closes only.
A good answer names the tool and its price before each call: nothing for your account, one call for a week of daily history. No file in the repository changes. If the sign-in will not complete (a locked-down work browser, for instance), you can still finish the lesson: use the academy's table below for the closes, and in PLAN.md write the cost line as "not measured yet" instead of a figure. A search made without the server is described in lesson 14, "From a demo list to the tool you actually use". Check its closes against the academy's own call for that week:
Show the API answer
Check it yourself
- Write down the count of calls used from the first answer. Reading your account costs nothing.
- The five dates and the first and last closes match the academy's table above. If they do not, find out which of you is wrong before you trust the next answer.
- Wait a few seconds — the account's counter lags behind the requests — then ask for your account again and subtract. That difference is what one question of exploration cost: one call, if it answered from daily history.
- Now ask, without letting it run anything: if I wanted today's biggest movers on the US exchange, which tool would you use and what would it cost? An answer that names the screener at 5 calls, says its figures are from the last completed session, and says the screener needs a plan that includes it (All-In-One or EOD+Intraday — All World Extended; not the free plan), beats one that snapshots the exchange for 100, and an agent that cannot say either way should not be running it unattended.
git diffis empty:.mcp.jsonstill holds a URL and nothing else, and no key was written anywhere. With Codex, theeodhdentry in~/.codex/config.tomlholds a URL and no key.
Compare with ours
What a good session looks like
| Question | The tool it should pick | Calls |
|---|---|---|
| Plan and calls used today | account details | 0 |
| A week of daily closes for one symbol | end-of-day history | 1 |
| Today's biggest US movers, asked but not run | screener (on a plan that includes it; refused on free) | 5 |
And the line we added under Data in PLAN.md:
Development: one question to the agent cost 1 call, from the same 20 a day as the app.
The starter's branch ref/build-your-first-tool/u1 carries the earlier lessons of this unit; the PLAN.md line above is yours to write.

Checkpoint
Add your measured figure under Data in PLAN.md, then:
git status # only the files you expect, and no .env*
git add -A
git commit -m "Plan: what one question to the agent costs, from the same daily calls"
Then answer this lesson's questions.