Bentrix Docs
HomePricingDashboard

Connect step by step

From nothing to a tool's answer with curl — find the endpoint, pair, list the tools, call one, read a resource.

This page speaks the protocol by hand, with curl (on Windows it is curl.exe, installed with Windows 10 and 11). Every request is an HTTP POST of a JSON-RPC 2.0 message. Bentrix must be open.

011. Find the endpoint

Read endpoint.json from the agents folder:

# Linux and macOS
cat ~/.local/share/bentrix/agents/endpoint.json
# Windows (PowerShell)
Get-Content $env:LOCALAPPDATA\BENTRIX\agents\endpoint.json
{"url": "http://127.0.0.1:52817/mcp", "pid": 18240, "catalogue_version": "3.2.0"}

The port is this run's; use the url exactly as it is written.

022. Pair, and keep the token

Send the secret once, with your program's name:

SECRET=$(cat ~/.local/share/bentrix/agents/local.secret)
curl -s http://127.0.0.1:52817/mcp/pair \
  -H "Content-Type: application/json" \
  -d "{\"secret\": \"$SECRET\", \"client\": {\"name\": \"my-first-agent\"}}"
{"token": "…"}

The answer is a token for that name. Pairing again under the same name replaces the token; my-first-agent now appears in Settings › Agents.

StatusMeans
200{"token": …}
403 wrong_secretthe secret is from an earlier run — Bentrix writes a new one at every start
429 rate_limitedtoo many pairing attempts; wait and try again

033. Ask what there is

Every request from here carries the token, the protocol version in a header and in _meta, and the method in a header:

TOKEN=…   # the token the pair call answered: an opaque text, kept as it is
curl -s http://127.0.0.1:52817/mcp \
  -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
  -H "Authorization: Bearer $TOKEN" \
  -H "MCP-Protocol-Version: 2026-07-28" -H "Mcp-Method: tools/list" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list",
       "params": {"_meta": {"io.modelcontextprotocol/protocolVersion": "2026-07-28",
                            "io.modelcontextprotocol/clientInfo": {"name": "my-first-agent"},
                            "io.modelcontextprotocol/clientCapabilities": {}}}}'

The answer lists every tool your pairing's scopes and plan admit, each with its JSON Schema of arguments. Mcp-Method must equal the body's method; a difference is refused with -32020.

044. Call a tool

tools/call with the tool's name — which also goes in the Mcp-Name header — and its arguments:

curl -s http://127.0.0.1:52817/mcp \
  -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
  -H "Authorization: Bearer $TOKEN" \
  -H "MCP-Protocol-Version: 2026-07-28" -H "Mcp-Method: tools/call" -H "Mcp-Name: get_state" \
  -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call",
       "params": {"name": "get_state", "arguments": {"depth": "benches"},
                  "_meta": {"io.modelcontextprotocol/protocolVersion": "2026-07-28",
                            "io.modelcontextprotocol/clientCapabilities": {}}}}'

The result's structuredContent is the tool's answer as JSON — here the workspace: its laboratories, their workbenches with their uris, the accounts, which workbench is selected. The same answer is in content as text, for clients that read only that.

055. Read a resource

A workbench, its bars, its book and its Journal are resources, read by their address:

curl -s http://127.0.0.1:52817/mcp \
  -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
  -H "Authorization: Bearer $TOKEN" \
  -H "MCP-Protocol-Version: 2026-07-28" -H "Mcp-Method: resources/read" \
  -H "Mcp-Name: bentrix://lab/lab-1/bench/bench-2/bars/SYN-CALM/H1?limit=5" \
  -d '{"jsonrpc": "2.0", "id": 3, "method": "resources/read",
       "params": {"uri": "bentrix://lab/lab-1/bench/bench-2/bars/SYN-CALM/H1?limit=5",
                  "_meta": {"io.modelcontextprotocol/protocolVersion": "2026-07-28",
                            "io.modelcontextprotocol/clientCapabilities": {}}}}'

Take the workbench's uri from step 4's answer. Every address is listed in resources and streams.

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed