PTENES
Skip to content
MODULE 2.2

🔌 Your first MCP bridge

Clara’s schedule and Sônia’s ERP don’t have APIs. But they can export files. In this module, that file becomes a named tool with rules that Claude Code and Codex call the same way. It’s recipe R3 from the kit.

6
Topics
~35
Minutes
R3
Recipe
Practical
Type
0 of 60%
1

Understand what MCP is

In module 2.1, Claude called a script. It works, but the agent needs to know the file name and construct the command. With MCP it’s different: the agent receives a list of ready-to-use tools, each with a name, description, and fields.

R3 combines two steps on the ladder. Reading the file is a local bridge (step 6). The way to deliver it to the agent is MCP (step 2). The result: a system without an API starts to look, to the agent, like a system with official tools.

🆕 New here? Five words from this module

  • MCP (Model Context Protocol) — an open standard for connecting tools to AI agents. Claude Code and Codex speak MCP, so the same bridge works for both.
  • MCP server — the program that provides the tools. Here, it runs on your machine, opened by the agent itself, with no website or cloud.
  • Tool (tool) — a named action the agent can call, such as listar_horarios_livres.
  • JSON — text organized in “name: value” pairs, inside braces. It’s how the agent and server exchange requests and responses.
  • stdio — chat through the terminal: the agent writes to the server's input and reads its output. No network port is opened.
Claude Code Codex MCP · stdio ponte-modelo server.mjs · 2 tools read-only (N4) 🩺 agenda.csv Clara's clinic 🧾 erp-vendas.csv Sônia’s client’s ERP one bridge, two agents, no API

How to read the diagram: on the left, the person making the request; in the middle, the bridge, which knows the rules; on the right, the files. The dashed arrows to the files are read-only: the bridge never writes to them.

✗ Loose CSV file in the folder

  • ✗ The agent guesses the columns with every request
  • ✗ Each conversation may add things up differently
  • ✗ Nothing prevents the agent from editing the file

✓ CSV behind a tool

  • ✓ Name and description say what it does
  • ✓ The account is always the same, written in the code
  • ✓ Read-only by design
🔌
MCP

open tool pattern

🖥️
Server

runs on your machine

🛠️
Tool

named action

↔️
stdio

without a network port

2

Meet the two tools in the ponte-modelo bridge

The model lives in runtime/pontes/mcp-modelo/server.mjs. It's an MCP server with no dependencies: you don't need to install any packages, just have Node.

It includes two example tools, one for each course character. The description of each tool is what the agent reads to decide when to use it.

ToolReadsFields (optional)Case
listar_horarios_livresagenda.csvdata (YYYY-MM-DD) and profissionalclinic with a spreadsheet schedule
resumo_vendaserp-vendas.csvagrupar_por: cliente or produtoaccountant with ERP export

What to look for in the table: the fields are optional. Without data, the first lists all available times; without agrupar_por, the second groups by client.

📄 Clara’s schedule (runtime/examples/agenda.csv content)
data,hora,profissional,status,paciente
2026-10-06,08:00,Dra. Ana,ocupado,Paciente 01
2026-10-06,09:00,Dra. Ana,livre,
2026-10-06,10:00,Dra. Ana,livre,
2026-10-06,14:00,Dr. Bruno,ocupado,Paciente 02
2026-10-06,15:00,Dr. Bruno,livre,
2026-10-07,08:00,Dra. Ana,livre,
2026-10-07,09:00,Dra. Ana,ocupado,Paciente 03
2026-10-07,16:00,Dr. Bruno,livre,
Notice: there are five lines livre. Three on 06/10 and two on 07/10. You'll find these lines again in the next topics.

💡 The description is half the tool

The agent doesn't read the bridge's code; it reads the description. The first one says: "Lists available appointment times from the clinic's schedule (agenda.csv). Optional filters: date (AAAA-MM-DD) and provider." A clear description helps the agent choose the right tool without you having to tell it.

🗓️
listar_horarios_livres

Clara's calendar

📊
resumo_vendas

Sônia's ERP

🏷️
Description

what the agent reads

📦
No dependencies

only Node

3

Test the bridge by itself

Same rule as module 2.1: start without an agent. The server has a self-test mode, --selftest. It lists the tools, calls each one with sample data, and prints the result.

It doesn't use any quota: no AI model is involved in this test. It's just Node reading the CSVs.

🎯 Objective: prove that the bridge reads both files

In the terminal, from inside the kit folder:

node runtime/pontes/mcp-modelo/server.mjs --selftest

Real output (10/05/2026, Linux):

tools: 2 (listar_horarios_livres, resumo_vendas)
2026-10-06 09:00 · Dra. Ana
2026-10-06 10:00 · Dra. Ana
2026-10-06 15:00 · Dr. Bruno
TOTAL: R$ 856.00
How to verify: appears tools: 2, the three available times on 06/10 and TOTAL: R$ 856.00. That's the proof for R3.

The three times match the lines livre from 10/06 that you saw in the previous section. The total for Sônia still needs to be checked. The self-test shows only the last line of the summary; the table below recalculates it manually, row by row from the erp-vendas.csv.

ClientCSV linesTotal
Mercado Sol10 × 18,50 + 40 × 5,20 = 185 + 208R$ 393,00
Padaria Lua25 × 5,20 + 12 × 18,50 = 130 + 222R$ 352,00
Empório Mar6 × 18,50R$ 111,00
TOTAL393 + 352 + 111R$ 856,00

What to look for in the table: the hand calculation reaches the same TOTAL: R$ 856.00 from the bridge (the period instead of a comma is just the program's format).

💡 Check it by hand once

The first time a bridge handles money, recalculate the amount on a calculator. After that, the self-test becomes your alarm: if the total changes without the CSV changing, something broke.

🧪
--selftest

the proof of R3

2️⃣
tools: 2

the two tools

🧮
R$ 856

manually checked

💳
Without a quota

no model in the test

4

Connect the bridge to Claude Code

In the kit, this part is already set up. Two files handle it: the .mcp.json, at the root, records the bridge; the .claude/settings.json allows its use.

When you open claude in the folder, it reads the .mcp.json and starts the server on its own. You don't need to leave anything running.

📄 .mcp.json (registers)

{
  "mcpServers": {
    "ponte-modelo": {
      "command": "node",
      "args": ["runtime/pontes/mcp-modelo/server.mjs"]
    }
  }
}

📄 .claude/settings.json (enables, excerpt)

"enabledMcpjsonServers": [
  "ponte-modelo"
]

Without this line, Claude Code asks before starting a server that came with the project.

🎯 Objective: see Claude Code connected to the bridge

In the terminal, from inside the kit folder:

claude mcp list

Real output (10/05/2026, Linux), the bridge line:

ponte-modelo: node runtime/pontes/mcp-modelo/server.mjs - ✔ Connected
How to verify: the line ponte-modelo ends in ✔ Connected. If you see Pending approval, open claude in the folder once and approve.
1

Register

.mcp.json says the bridge’s name and the command that connects it.

2

Allow

enabledMcpjsonServers approves this project's bridge, or you approve it the first time it opens.

3

Check

claude mcp list shows ✔ Connected. Only then ask the agent to do something.

🆕 New here? In a project other than the kit

Outside the kit folder, there is no .mcp.json ready. The server.mjs includes, in a comment at the top, the command that registers the bridge: claude mcp add ponte-modelo -- node runtime/pontes/mcp-modelo/server.mjs. Everything after -- it’s the command that starts the server.

5

Use the tool through the agent

Now the agent comes in. The command below uses claude -p: sends a single request without opening the screen and prints the response. It asks for the available times on 07/10, a day different from the self-test.

Changing the day is intentional. If the agent gives the right answer for a day you haven’t tested, that’s a sign it called the tool instead of repeating something it had already seen.

🎯 Objective: the agent responds using the tool

In the terminal, from inside the kit folder:

claude -p "Use a tool listar_horarios_livres da ponte-modelo e diga os horários livres de 2026-10-07."

Result confirmed in CHANGELOG 0.2.0:

The answer includes 08:00 (Dr. Ana) e 16:00 (Dr. Bruno), exactly the lines livre from 10/07 in the CSV. The surrounding text changes from one run to the next; the two timestamps don’t.

How to verify: go back to the agenda.csv from topic 2 and check the two lines from 2026-10-07 with livre.
1 · request "free times" from 2026-10-07" 2 · call listar_horarios_livres { data: 2026-10-07 } 3 · bridge reads the CSV status = free and date = 07/10 4 · response 08:00 Dr. Ana 16:00 Dr. Bruno the model chooses the tool and the field; the bridge always performs the calculation the same way

How to read the diagram: the glowing box is the only point where the AI makes a decision: which tool to call and with what date. The filter in step 3 is code, not a guess.

Sônia does the same with the other tool. With claude open in the kit folder, it prompts: "Use the resumo_vendas tool from ponte-modelo to group by customer and tell me who bought the most." The answer has to match the table in topic 3: Mercado Sol is in the lead, with R$ 393,00.

⚠️ The bridge only reads, and it should stay that way

The two tools are read-only (N4). If one day you create one that marks an appointment or writes to the ERP, it moves up to "modify" in the POLITICA.md: N2, asks every time first. A tool that writes is never set to "always allow".

⌨️
claude -p

request without a screen

📅
07/10

day outside the self-test

📖
Read-only

N4

✍️
If it writes

move up to N2

6

Connect the same bridge to Codex

Codex doesn't read the .mcp.json. It has its own log, created by a command. The bridge is the same: no line from the server.mjs changes.

Take a look at "$PWD/…": the recipe registers the server's full path in Codex, starting from the root of the disk, not the short path that the .mcp.json uses. That way, the record doesn’t depend on where Codex was opened.

🎯 Objective: register the ponte-modelo bridge in Codex

In the terminal, from inside the kit folder:

codex mcp add ponte-modelo -- node "$PWD/runtime/pontes/mcp-modelo/server.mjs"

Expected result (according to the instructions):

R3 doesn’t provide its own proof for this step. The test is to ask Codex for the same thing you asked Claude.

How to verify: open codex in the kit folder and ask: "Use the listar_horarios_livres tool from ponte-modelo and tell me the available times on 2026-10-07." It should return 08:00 (Dr. Ana) and 16:00 (Dr. Bruno).
Claude CodeCodex
Where it records.mcp.json from the project (already included in the kit)command codex mcp add
Server workflowrelative to the kit foldercomplete, with "$PWD/…"
How to checkclaude mcp list → ✔ Connectedask for the times for 07/10
Bridge usedthe same: runtime/pontes/mcp-modelo/server.mjs

What to look for in the table: only the way you register it changes. That’s why MCP is worthwhile: you write the bridge once, and any agent that speaks MCP can use it.

💡 And your own system?

The sample bridge reads the example CSVs. To read your system’s export, the kit provides the variable PONTE_DADOS=/caminho/da/exportacao, in the field env of the .mcp.json. That's the subject of module 2.3, with the columns switched and the log in CAPACIDADES.md.

Quick test (optional): the claude mcp list shows ponte-modelo … ✔ Connected. What does this prove?

🔁
A bridge

two agents

➕
codex mcp add

Codex log

📍
"$PWD/…"

complete path

🏗️
PONTE_DADOS

your system, in 2.3

🎓 Module summary

✓
MCP provides named tools — local bridge (6) exposed through MCP (2).
✓
Two example tools — Clara's calendar and Sônia's sales.
✓
--selftest before the agent — tools: 2 and TOTAL: R$ 856.00, without using any quota.
✓
It’s already enabled in Claude Code — .mcp.json + settings.json, ✔ Connected.
✓
Same bridge in Codex — codex mcp add, without changing the server.

Next module:

2.3 — Your system’s bridge