Let assistants read twins, safely.
The Model Context Protocol (MCP) lets an AI assistant call tools offered by a server. STARCO has an MCP server per project: an assistant gets one hour of read-only access to the synthetic twins of one project, through six tools, without ever holding your project key.
2025-06-18, tokens issued by hand); it has not been qualified against every assistant client. Try it in the Academy or the API explorer, both simulated.The design#
Read-only by design
Six read tools and nothing else. No tool can write, erase or export; asking for one is an error, not a refusal by the assistant.
One hour, then gone
An MCP token (starco_dm_…) expires exactly one hour after it is issued; its lifetime and scope (mcp:read) cannot be changed. Revoke it earlier like any key.
One project, never another
A token belongs to one synthetic project. Twins of any other project do not exist for it, and it cannot call the REST API.
Chained like any call
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 the values.
AI is labelled
Answers built from the tools must say they come from an AI; show that label to your users.
Same rules as the API
null means no data, values are descriptive, no clinical interpretation. Tool content is data, never instructions.
1. Issue a token#
With a console token, POST /v1/projects/{project}/mcp-tokens with an empty JSON object. Only the owner of a synthetic project can do it. STARCO_CONSOLE is the console token of the quickstart, step 2. The secret is shown once, so the lines below keep it in STARCO_MCP for the next request; the token counts towards the project's active keys and is listed and revoked with them.
RESP=$(curl -s -X POST https://api.starco.dev/v1/projects/$PROJECT/mcp-tokens \
-H "Authorization: Bearer $STARCO_CONSOLE" -H "Content-Type: application/json" -d '{}')
echo "$RESP"
export STARCO_MCP=$(echo "$RESP" | jq -r .secret){"key": {"name": "Read-only MCP", "prefix": "starco_dm_5b1e09c4", "scopes": ["mcp:read"], "state": "active", "expires_at": "2026-11-19T10:00:00Z"},
"secret": "starco_dm_5b1e09c4_…",
"note": "Shown once. Read-only synthetic project MCP; expires in one hour. Revoke through the project keys endpoint."}2. Talk JSON-RPC to the server#
POST /v1/mcp with Authorization: Bearer starco_dm_…, Content-Type: application/json and Accept: application/json, text/event-stream. Methods: initialize, ping, tools/list and tools/call; the notifications/initialized and notifications/cancelled notifications answer 202 with no body. There is no server-sent stream (GET /v1/mcp is 405), no batch, no session and no OAuth discovery; requests are at most 64 KiB and tool data at most 1 MiB.
curl -s -X POST https://api.starco.dev/v1/mcp \
-H "Authorization: Bearer $STARCO_MCP" -H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" -H "MCP-Protocol-Version: 2025-06-18" \
-d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "history.get", "arguments": {"twin_id": "'$TWIN'", "measure": "wellness.mood_level"}}}'A tool's answer comes as content (text) and structuredContent (the same JSON); a domain error (an unknown twin, a bad range) sets isError.
The six tools#
| tool | reads | arguments |
|---|---|---|
twins.list | The twins of the project | limit 1–200, after |
twin.get | One twin | twin_id |
layer.get | The descriptive values of a layer | twin_id, layer |
series.range | A bounded range of a measure's series | twin_id, measure, from, to, limit |
history.get | The versioned changes of one measure | twin_id, measure, after_version, limit |
audit.verify | The verification of the project's audit chain (up to a local safety limit; not external proof) | none |
How a question flows#
An example of the intended use#
sleep_hours on 6 of the last 7 days; 14 November has none. The longest value was 8.0 h, on 17 November. This is a description of synthetic data from STARCO, written by an AI; it is not medical advice.Illustrative exchange over a synthetic twin. The assistant is yours: STARCO supplies the data, your client shows the answer and its AI label.
Good practice#
- Issue one token per session; never reuse a token across people, and never hand a project key to an assistant.
- Show the AI notice next to every answer in your interface.
- Do not ask the assistant to label values as good or bad, or to give medical advice: the data are descriptive.
- Check the audit chain after a session: every MCP request is there.