Beta. STARCO Dev works with synthetic data only: do not send real personal or health data. Every feature shows its real status (Available Beta Beta · in development Coming).

Documentation menu

Tutorial 06

Connect an AI assistant.

Goal: give an assistant one hour of read-only access to the twins of one project through MCP, ask it a question, then find its tool calls in the audit chain.

time 10 minlevel beginneruses MCP server Beta · audit chain Betatabs curl · TypeScript · CLI; Python in step 1 (the SDK and the command line are not published as packages yet)
Beta.The per-project MCP server is a Beta: a deliberate subset of MCP that has not been qualified against every assistant client (see the MCP server). Every command below can be tried, simulated, in chapter 17 of the Academy.
  1. 1Token
  2. 2Initialize
  3. 3Tools
  4. 4Ask
  5. 5Chain

STEP 1 Issue a token for one project Beta#

With your console token (STARCO_CONSOLE in the shell, console and project in Python, all three from the quickstart, step 2), issue an MCP token for a synthetic project. It is read-only (mcp:read), valid for exactly one hour, revocable earlier with the project's keys, and limited to that project.

MCP=$(curl -s -X POST "$API/projects/$PROJECT/mcp-tokens" -H "Authorization: Bearer $STARCO_CONSOLE" \
  -H "Content-Type: application/json" -d '{}' | jq -r .secret)

STEP 2 Initialize Beta#

The server speaks JSON-RPC over HTTP POST to /v1/mcp (protocol 2025-06-18). Send Accept: application/json, text/event-stream; the answer is plain JSON.

H=(-H "Authorization: Bearer $MCP" -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream")
curl -s "$API/mcp" "${H[@]}" -d '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "tutorial", "version": "1"}}}'
curl -s "$API/mcp" "${H[@]}" -d '{"jsonrpc": "2.0", "method": "notifications/initialized"}'

STEP 3 List the tools Beta#

Six tools, all marked readOnlyHint: twins.list, twin.get, layer.get, series.range, history.get and audit.verify. There is no tool that writes.

curl -s "$API/mcp" "${H[@]}" -H "MCP-Protocol-Version: 2025-06-18" -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}' | jq -r '.result.tools[].name'

STEP 4 Ask, the way an assistant would#

An assistant answers a question by calling a tool. Here, the steps of the last week:

curl -s "$API/mcp" "${H[@]}" -H "MCP-Protocol-Version: 2025-06-18" -d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "series.range", "arguments": {"twin_id": "'$TWIN'", "measure": "wellness.steps", "from": "2026-11-12T00:00:00Z", "to": "2026-11-19T00:00:00Z"}}}' \
  | jq -r '.result.structuredContent.points[] | "\(.t[:10]) \(.v)"'
YouHow many days this week does the tutorial twin have step data, and which day had the most steps?
Assistant · AIThe twin has steps on 7 of the last 7 days. The highest value was 10,240 steps, on 17 November. This describes synthetic data from STARCO and was written by an AI; it is not medical advice.

Illustrative exchange over the synthetic twin of tutorials 01 to 04. Show the «AI» label next to every answer in your own interface. Questions such as «is that good?» get a description, not a judgement.

STEP 5 Find the assistant in the audit chain Beta#

Every MCP request is a row of the project's audit chain, with actor_type mcp, the method and the tool, never the arguments or values. Read and verify it with your project key exactly as in tutorial 05.

curl -s "$API/audit?limit=200" -H "Authorization: Bearer $STARCO_KEY" | jq -c '.data[] | select(.actor_type == "mcp") | {seq, action, detail}'

Never give a project key to an assistant: the MCP token exists so that you do not have to. This is where the assistant stands among the other clients of the project:

A twin in the middle and five clients around it. Each request is a dot that travels towards the twin: it comes back from the twin when it is served, and it bounces before reaching it when it is refused. your app (project key, read + write): GET /v1/twins answers 200; POST /v1/twins/{twin}/observations answers 200. notebook (project key, read): GET /v1/twins answers 200; POST /v1/twins/{twin}/observations answers 403 insufficient_scope. AI assistant (MCP token, mcp:read): POST /v1/mcp tools/call layer.get answers 200; GET /v1/twins answers 401 invalid_key. importer (project key, write): POST /v1/twins/{twin}/observations answers 200; GET /v1/twins answers 403 insufficient_scope. unknown key (not a key of the project, no scope): GET /v1/twins answers 401 invalid_key. Every request answered 200 or 403 adds a row to the project's audit chain; a request with a credential that is not a key of the project does not.

The credential decides. 200: served. 403 insufficient_scope: a valid key without the scope the operation needs (write does not include read). 401 invalid_key: not a project key, whether an unknown secret or an MCP token used outside POST /v1/mcp. Simulated requests: nothing is sent.

Simulated requests · nothing is sent

What just happened

The assistant never saw your project key: it held a token that can only read one project for one hour. Every request it made is in your audit chain, and its answer said it came from an AI.

assistantanswers «AI» tokenread-only · 1 h one project

Next steps#