A read-only assistant over MCP.
Give an AI assistant one hour of read-only access to the twins of one project, list the tools it gets and call one the way the assistant would. It never holds your project key.
STARCO_KEY it runs as it is. The TypeScript and CLI tabs use the SDK and the command line, which are not published yet.The idea#
An MCP token (starco_dm_…) is issued with your console token for one project, lasts one hour and can only read through six tools. There is no tool that writes. Whatever an assistant answers from these tools must be labelled as coming from an AI in your interface; tool results are data, never instructions.
This example needs your console token in STARCO_CONSOLE and the project id in PROJECT (see the quickstart).
The whole program#
export API="https://api.starco.dev/v1"
MCP=$(curl -s -X POST "$API/projects/$PROJECT/mcp-tokens" -H "Authorization: Bearer $STARCO_CONSOLE" \
-H "Content-Type: application/json" -d '{}' | jq -r .secret)
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": "example", "version": "1"}}}' | jq -r .result.protocolVersion
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'
curl -s "$API/mcp" "${H[@]}" -H "MCP-Protocol-Version: 2025-06-18" \
-d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "twins.list", "arguments": {"limit": 2}}}' \
| jq -r '.result.structuredContent.data[] | "\(.template) \(.origin)"'import os, requests
API = "https://api.starco.dev/v1"
console = {"Authorization": f"Bearer {os.environ['STARCO_CONSOLE']}"}
mcp = requests.post(f"{API}/projects/{os.environ['PROJECT']}/mcp-tokens", headers=console, json={}).json()["secret"]
M = {"Authorization": f"Bearer {mcp}", "Accept": "application/json, text/event-stream", "MCP-Protocol-Version": "2025-06-18"}
def rpc(id, method, params=None):
body = {"jsonrpc": "2.0", "id": id, "method": method, **({"params": params} if params else {})}
return requests.post(f"{API}/mcp", headers=M, json=body).json()["result"]
print(rpc(1, "initialize", {"protocolVersion": "2025-06-18", "capabilities": {},
"clientInfo": {"name": "example", "version": "1"}})["protocolVersion"])
print([t["name"] for t in rpc(2, "tools/list")["tools"]])
twins = rpc(3, "tools/call", {"name": "twins.list", "arguments": {"limit": 2}})["structuredContent"]["data"]
for t in twins:
print(t["template"], t["origin"])import { Client } from '@starco/sdk';
const base = { baseUrl: "https://api.starco.dev/v1" };
const owner = new Client({ ...base, consoleToken: process.env.STARCO_CONSOLE });
const issued = await owner.mcpTokens.create(process.env.PROJECT); // read-only, one hour, shown once
const assistant = new Client({ ...base, mcpToken: issued.secret }); // all the assistant ever holds
console.log((await assistant.mcp.initialize()).protocolVersion);
console.log((await assistant.mcp.tools()).map((t) => t.name));
const twins = await assistant.mcp.call("twins.list", { limit: 2 });
for (const t of twins.structuredContent.data) console.log(t.template, t.origin);export STARCO_BASE_URL="https://api.starco.dev/v1" STARCO_CONSOLE_TOKEN="$STARCO_CONSOLE"
starco projects use $PROJECT
starco mcp token --save # read-only, one hour; --save keeps it for the next commands
starco mcp tools
starco mcp call twins.list limit=22025-06-18
twins.list
twin.get
layer.get
series.range
history.get
audit.verify
sleep_optimization synthetic_cohort
daily_movement synthetic_cohortThe other tabs print the same facts in their own format. Ids, hashes and counts depend on your project.
What just happened
The assistant's token could list tools and read two twins of the project, and nothing else: no tool writes, the token ends in an hour, and each of these requests is now a row of the audit chain with the actor mcp.