mcp: stdio-Server als zweiter Transport

Bisher war ein Upstream immer eine HTTP-Adresse. Damit fehlten genau die Server, die
es nur als Kommando gibt (filesystem, git, alles mit lokalem Zustand): sie lassen sich
nicht als URL eintragen, und sie sprechen MCP über stdin/stdout, nicht über POST.

    mcp local cmd "python3 /srv/mcp/filesystem.py --root /data"

- Der Prozess wird beim ersten Gebrauch gestartet, einmal initialisiert und bleibt
  danach am Leben. Ein stdio-Server hält Sitzungszustand; ein frischer Prozess je
  Aufruf wäre für viele von ihnen ein anderer Server.
- Eine JSON-Zeile je Anfrage, eine je Antwort. Benachrichtigungen des Servers (ohne
  id) werden übersprungen, bis result oder error kommt.
- Antwortet er nicht (Zeitlimit), stirbt er oder scheitert der Start, wird der Prozess
  beendet und der Server gilt als tot — die Werkzeugliste der anderen kommt trotzdem.
- Wechselt das Kommando unter demselben Namen (Konfigurationstausch), wird der alte
  Prozess beendet, statt weiter mit einer Leiche zu sprechen.
- tools/list, tools/call, prompts/* und resources/* laufen über denselben Weg wie bei
  HTTP: in einer Liste stehen beide Transporte nebeneinander.

Ein Fehler, der beim Bauen sofort auffiel: die initialize-Zeile ging ohne '\n' raus.
Ein stdio-Server liest bis zum Zeilenende, junction wartete auf eine Antwort —
deadlock, der als "antwortet nicht" aussah. Jetzt mit Newline, wie jede andere Zeile.

Test (tests/mcp.py + neuer tests/mcp_stdio.py): ein echter stdio-Server in Python
liefert ein Werkzeug, wird aufgerufen (Antwort nennt den Weg), liefert Prompt und
Ressource; ein kaputtes Kommando ("exit 1") reißt die Werkzeugliste nicht mit; beide
Transporte erscheinen in einer Liste. Aus 12 Prüfungen werden 17.

Nebenbei: der offline_wait-Test meldet jetzt laut, wenn sein Stub den Port nicht binden
konnte, statt wie ein Router-Fehler auszusehen (einmal genau so passiert).

make test: PASS, 178 Prüfungen. Live: Binary installiert, Dienst neu gestartet, die 20
Werkzeuge von tasksd und skilld kommen weiter durch; ein stdio-Server ist nicht
eingetragen, also ändert sich dort nichts.
This commit is contained in:
Hermes committed 2026-11-08 06:41:36 +00:00
1 parent 9c95d36215
commit dceda32b28
7 files changed
+351 -17

No files matched your search

+19 -6
View File
@@ -352,6 +352,7 @@ mcp_cache_ttl 60
| key | meaning |
|---|---|
| `mcp <name> url <url>` | an upstream MCP server (Streamable HTTP, JSON-RPC 2.0) |
| `mcp <name> cmd "<command>"` | an upstream MCP server spoken over stdin/stdout (spawned by junction, one quoted command) |
| `header "Name: value"` | repeated; for tokens and anything else the server wants |
| `timeout <s>` | per call; default 10 — a server that does not answer delays the tool list, it does not block it |
| `off` | keep the entry, do not use it |
@@ -370,11 +371,23 @@ The prefix is also why a resource URI looks different at the client than at the
away again. A URI that belongs to no configured server is refused instead of being
guessed at.
What it deliberately does not do: no session cookie, no server-to-client push,
no SSE answer to a request, no `resources/subscribe` (the capability is advertised as
`subscribe: false`), and no stdio transport — an upstream is an HTTP endpoint. A tool
call is a question with one answer. Requests without an `id` are notifications and get
`202` with no body.
Two transports are supported. An upstream is either an HTTP endpoint or a command that
junction starts itself and speaks to over stdin/stdout:
```conf
mcp tasksd url http://127.0.0.1:8781/mcp timeout 20
mcp local cmd "python3 /srv/mcp/filesystem.py --root /data"
```
A stdio server is started on first use, `initialize` is sent once, and the process stays
alive between calls — a stdio server keeps session state, and a fresh process per call
would be a different server every time. A command that does not answer is torn down and
reported like a dead HTTP server: the other servers' tools still arrive.
What it deliberately does not do: no session cookie, no server-to-client push, no SSE
answer to a request, no `resources/subscribe` (the capability is advertised as
`subscribe: false`). A tool call is a question with one answer. Requests without an `id`
are notifications and get `202` with no body.
A server that is down or silent is skipped with a log line; the tools of the
others still arrive. Nothing is invented to fill the gap.
@@ -439,7 +452,7 @@ priced request through a key shows up in the log file, in `/status` and in `/met
The offline wait has its own section too: with the only endpoint missing the first
request fails as before, and once the endpoint is back the next request waits out the
offline hold (measured ~2 s) and is served instead of refused.
Pass = `PASS` (173 checks), including two that would have caught the two mistakes this
Pass = `PASS` (178 checks), including two that would have caught the two mistakes this
design invites: a serial stub making a concurrent router look serialised, and a
"waiting" comment leaking into a caller that never asked for a stream.
+28 -3
View File
@@ -285,12 +285,37 @@ static int global_kw(j_config *cfg, char **w, int n, int lineno, char *err, size
goto bad;
}
if (!strcmp(k, "mcp")) {
/* mcp "name" url <url> [header "Name: value"]... [timeout <sek>]
/* mcp "name" url <url> [header "Name: value"]... [timeout <sek>] [off]
* mcp "name" cmd "<kommando>" (stdio-Server, muss in Anführungszeichen)
*
* Ein angebundener MCP-Server. junction wird dadurch selbst zum MCP-Server:
* ein Agent verbindet sich einmal, sieht alle Werkzeuge aller Server hier
* und ruft sie über junction auf. */
if (n < 4 || strcmp(w[2], "url")) goto bad;
* und ruft sie über junction auf.
*
* Bei `cmd` gilt genau ein Wort: das Kommando wird als Ganzes übergeben und
* von /bin/sh ausgeführt. Mehrere Wörter ohne Anführungszeichen wären nicht
* von den Optionen zu unterscheiden — deshalb ist das ein Fehler und keine
* Vermutung. */
if (n < 4) goto bad;
if (!strcmp(w[2], "cmd")) {
if (n != 4) {
snprintf(err, errlen, "line %d: mcp '%s' cmd needs exactly one quoted "
"command", lineno, w[1]);
return -1;
}
if (cfg->mcp_count >= J_MAX_MCP) {
snprintf(err, errlen, "line %d: more than %d MCP servers", lineno, J_MAX_MCP);
return -1;
}
j_mcp *mc = &cfg->mcps[cfg->mcp_count];
memset(mc, 0, sizeof *mc);
snprintf(mc->name, sizeof mc->name, "%s", w[1]);
snprintf(mc->cmd, sizeof mc->cmd, "%s", w[3]);
mc->enabled = 1;
cfg->mcp_count++;
return 0;
}
if (strcmp(w[2], "url")) goto bad;
if (cfg->mcp_count >= J_MAX_MCP) {
snprintf(err, errlen, "line %d: more than %d MCP servers", lineno, J_MAX_MCP);
return -1;
+3
View File
@@ -81,6 +81,9 @@ typedef struct {
typedef struct {
char name[J_NAME_MAX]; /* Präfix der Werkzeugnamen */
char url[J_URL_MAX]; /* Streamable-HTTP-Endpunkt */
/* Alternativ zu url: ein Kommando, das ein MCP-Server über stdin/stdout spricht.
* Genau eines von beiden ist gesetzt; geprüft wird das beim Laden. */
char cmd[J_CMD_MAX];
char headers[J_MAX_EP_HEADERS][J_HDR_LINE_MAX]; /* z.B. Authorization */
int header_count;
double timeout_s; /* 0 = Standard */
+194
View File
@@ -25,7 +25,12 @@
#include <stdarg.h>
#include <errno.h>
#include <poll.h>
#include <pthread.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
@@ -325,8 +330,197 @@ static int split_url(const char *url, char *host, size_t hlen, char *port, size_
return (host[0] && port[0]) ? 0 : -1;
}
/* ------------------------------------------------------------ stdio-Transport */
/* Ein MCP-Server, den junction selbst startet und über stdin/stdout spricht. Der
* Prozess lebt zwischen den Anfragen weiter: ein stdio-Server hält Sitzungszustand,
* und ein Neustart je Aufruf wäre für viele von ihnen ein anderer Server.
*
* Der Slot hängt am Index der Konfiguration und merkt sich den Namen — nach einem
* Konfigurationstausch mit anderem Kommando wird der alte Prozess beendet, statt
* weiter mit einer Leiche zu sprechen. */
typedef struct {
char name[J_NAME_MAX];
pid_t pid;
int in_fd; /* schreiben: stdin des Kindes */
int out_fd; /* lesen: stdout des Kindes */
int ready; /* initialize ist durch */
pthread_mutex_t mu;
} mcp_stdio;
static mcp_stdio g_stdio[J_MAX_MCP];
static pthread_once_t g_stdio_once = PTHREAD_ONCE_INIT;
static void stdio_init_mutexes(void)
{
for (int i = 0; i < J_MAX_MCP; i++)
pthread_mutex_init(&g_stdio[i].mu, NULL);
}
static void stdio_stop(mcp_stdio *s)
{
if (s->in_fd >= 0) close(s->in_fd);
if (s->out_fd >= 0) close(s->out_fd);
s->in_fd = -1;
s->out_fd = -1;
if (s->pid > 0) {
kill(s->pid, SIGTERM);
/* Kurz warten, dann hart: ein Server, der SIGTERM ignoriert, darf junction
* nicht aufhalten. */
for (int i = 0; i < 20; i++) {
int st = 0;
if (waitpid(s->pid, &st, WNOHANG) == s->pid) { s->pid = 0; break; }
struct timespec nap = { 0, 20 * 1000 * 1000 };
nanosleep(&nap, NULL);
}
if (s->pid > 0) { kill(s->pid, SIGKILL); waitpid(s->pid, NULL, 0); s->pid = 0; }
}
s->ready = 0;
s->name[0] = '\0';
}
/* Liest eine Zeile (bis '\n') von fd mit Zeitlimit. Rueckgabe: Laenge ohne Zeilenende
* oder -1 bei Timeout, EOF und Fehler. */
static int read_line(int fd, char *buf, size_t cap, double timeout_s)
{
size_t used = 0;
double left = timeout_s > 0 ? timeout_s : 10.0;
while (used + 1 < cap) {
struct pollfd pf = { .fd = fd, .events = POLLIN };
int pr = poll(&pf, 1, 100);
if (pr < 0) {
if (errno == EINTR) continue;
return -1;
}
if (pr == 0) {
left -= 0.1;
if (left <= 0) return -1;
continue;
}
ssize_t n = read(fd, buf + used, cap - used - 1);
if (n <= 0) return -1;
used += (size_t)n;
buf[used] = '\0';
char *nl = strchr(buf, '\n');
if (nl) {
*nl = '\0';
if (nl > buf && nl[-1] == '\r') nl[-1] = '\0';
return (int)(nl - buf);
}
}
buf[used] = '\0';
return (int)used;
}
/* Startet den Server (falls nötig) und schickt die Anfrage. Antwort landet als eine
* JSON-Zeile in out->body; out->status ist 200 oder 0. */
static int stdio_exchange(const j_mcp *m, const char *body, mcp_resp *out, double timeout_s)
{
pthread_once(&g_stdio_once, stdio_init_mutexes);
int slot = -1;
for (int i = 0; i < J_MAX_MCP; i++)
if (!strcmp(g_stdio[i].name, m->name)) { slot = i; break; }
if (slot < 0) {
for (int i = 0; i < J_MAX_MCP; i++)
if (!g_stdio[i].name[0]) { slot = i; break; }
}
if (slot < 0) return -1;
mcp_stdio *st = &g_stdio[slot];
double tmo = timeout_s > 0 ? timeout_s : 10.0;
pthread_mutex_lock(&st->mu);
/* Anderes Kommando unter demselben Namen? Dann neu starten. */
if (st->name[0] && strcmp(st->name, m->name)) stdio_stop(st);
if (!st->ready) {
if (st->pid > 0) stdio_stop(st);
int in_pipe[2], out_pipe[2];
if (pipe(in_pipe) != 0 || pipe(out_pipe) != 0) {
pthread_mutex_unlock(&st->mu);
return -1;
}
pid_t pid = fork();
if (pid < 0) {
close(in_pipe[0]); close(in_pipe[1]);
close(out_pipe[0]); close(out_pipe[1]);
pthread_mutex_unlock(&st->mu);
return -1;
}
if (pid == 0) {
/* Kind: stdin aus der Pipe, stdout in die Pipe, stderr bleibt bei junction
* (dort landet, was der Server zu sagen hat). */
dup2(in_pipe[0], 0);
dup2(out_pipe[1], 1);
close(in_pipe[0]); close(in_pipe[1]);
close(out_pipe[0]); close(out_pipe[1]);
execl("/bin/sh", "sh", "-c", m->cmd, (char *)NULL);
_exit(127);
}
close(in_pipe[0]);
close(out_pipe[1]);
st->pid = pid;
st->in_fd = in_pipe[1];
st->out_fd = out_pipe[0];
snprintf(st->name, sizeof st->name, "%s", m->name);
static const char hello[] =
"{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"initialize\","
"\"params\":{\"protocolVersion\":\"2025-06-18\",\"capabilities\":{},"
"\"clientInfo\":{\"name\":\"junction\",\"version\":\"1.0\"}}}";
char reply[8192];
/* Zeilenweise, wie der Transport es verlangt: ein stdio-Server liest bis zum
* Zeilenende. Ohne das '\n' wartet er auf mehr und junction auf eine Antwort. */
ssize_t w = write(st->in_fd, hello, strlen(hello));
if (w > 0) w = write(st->in_fd, "\n", 1);
int rl = read_line(st->out_fd, reply, sizeof reply, tmo);
if (w <= 0 || rl <= 0) {
jmlog("mcp_stdio_init_failed", "server=%s cmd=%s", m->name, m->cmd);
stdio_stop(st);
pthread_mutex_unlock(&st->mu);
return -1;
}
st->ready = 1;
jmlog("mcp_stdio_ready", "server=%s pid=%d", m->name, (int)pid);
}
char line[8192];
ssize_t w = write(st->in_fd, body, strlen(body));
if (w > 0) w = write(st->in_fd, "\n", 1);
if (w <= 0) {
jmlog("mcp_stdio_write_failed", "server=%s", m->name);
stdio_stop(st);
pthread_mutex_unlock(&st->mu);
return -1;
}
/* Antworten können Benachrichtigungen des Servers enthalten (kein "id"); die
* werden übersprungen, bis die Antwort mit result oder error kommt. */
for (int tries = 0; tries < 8; tries++) {
if (read_line(st->out_fd, line, sizeof line, tmo) <= 0) {
jmlog("mcp_stdio_no_answer", "server=%s", m->name);
stdio_stop(st);
pthread_mutex_unlock(&st->mu);
return -1;
}
if (strstr(line, "\"result\"") || strstr(line, "\"error\"")) {
out->body = strdup(line);
out->len = strlen(line);
out->status = 200;
pthread_mutex_unlock(&st->mu);
return 0;
}
}
pthread_mutex_unlock(&st->mu);
return -1;
}
static int exchange(const j_mcp *m, const char *body, mcp_resp *out, double timeout_s)
{
if (m->cmd[0])
return stdio_exchange(m, body, out, timeout_s);
char host[J_NAME_MAX * 2], port[16], path[J_URL_MAX];
char err[256];
int tls;
+41 -8
View File
@@ -145,6 +145,8 @@ mcp_cache_ttl 1
mcp tasksd url http://127.0.0.1:{ports['tasksd']}/mcp timeout 2
mcp skilld url http://127.0.0.1:{ports['skilld']}/mcp timeout 2
mcp tot url http://127.0.0.1:9/mcp timeout 1
mcp local cmd "python3 {os.path.join(os.path.dirname(os.path.abspath(__file__)), 'mcp_stdio.py')}"
mcp krumm cmd "exit 1"
endpoint dummy {{
base http://127.0.0.1:9/v1
@@ -177,7 +179,9 @@ endpoint dummy {{
j = json.loads(body)
names = [t["name"] for t in j["result"]["tools"]]
want = {"tasksd__task_create", "tasksd__task_list", "skilld__skill_list"}
if set(names) != want:
# Teilmenge, nicht Gleichheit: der stdio-Server weiter unten liefert ein
# eigenes Werkzeug dazu, und diese Prüfung handelt von den HTTP-Servern.
if not want <= set(names):
failures.append(f"tools/list: {names} statt {sorted(want)}")
# Beschreibung muss erhalten sein
for t in j["result"]["tools"]:
@@ -213,9 +217,9 @@ endpoint dummy {{
# 4b. Prompts: gebündelt, präfixt, beim Abruf wieder abgenommen
st, body = post(base, {"jsonrpc": "2.0", "id": 11, "method": "prompts/list"})
j = json.loads(body)
pnames = sorted(p["name"] for p in j["result"]["prompts"])
if pnames != ["skilld__explain", "tasksd__summarize"]:
failures.append(f"prompts/list: {pnames}")
pnames = {p["name"] for p in j["result"]["prompts"]}
if not {"skilld__explain", "tasksd__summarize"} <= pnames:
failures.append(f"prompts/list: {sorted(pnames)}")
st, body = post(base, {"jsonrpc": "2.0", "id": 12, "method": "prompts/get",
"params": {"name": "tasksd__summarize",
"arguments": {"scope": "heute"}}})
@@ -228,9 +232,9 @@ endpoint dummy {{
# 4c. Ressourcen: URI präfixt in der Liste, ohne Präfix beim Lesen
st, body = post(base, {"jsonrpc": "2.0", "id": 13, "method": "resources/list"})
j = json.loads(body)
uris = sorted(r["uri"] for r in j["result"]["resources"])
if uris != ["skilld__memory://skills", "tasksd__memory://tasks"]:
failures.append(f"resources/list: {uris}")
uris = {r["uri"] for r in j["result"]["resources"]}
if not {"skilld__memory://skills", "tasksd__memory://tasks"} <= uris:
failures.append(f"resources/list: {sorted(uris)}")
st, body = post(base, {"jsonrpc": "2.0", "id": 14, "method": "resources/read",
"params": {"uri": "skilld__memory://skills"}})
j = json.loads(body)
@@ -245,6 +249,33 @@ endpoint dummy {{
if "error" not in json.loads(body):
failures.append("unbekanntes Prompt-Präfix wurde nicht abgelehnt")
# 4e. stdio-Upstream: eigener Prozess, JSON-Zeilen über stdin/stdout
st, body = post(base, {"jsonrpc": "2.0", "id": 21, "method": "tools/list"})
j = json.loads(body)
names = [t["name"] for t in j["result"]["tools"]]
if "local__echo" not in names:
failures.append(f"stdio-Server fehlt in der Werkzeugliste: {names}")
if not any(n.startswith("tasksd__") for n in names):
failures.append(f"ein kaputtes stdio-Kommando riss die HTTP-Server mit: {names}")
st, body = post(base, {"jsonrpc": "2.0", "id": 22, "method": "tools/call",
"params": {"name": "local__echo",
"arguments": {"text": "hallo"}}})
j = json.loads(body)
txt = j.get("result", {}).get("content", [{}])[0].get("text")
if txt != "stdio:echo:hallo":
failures.append(f"stdio tools/call: {txt!r} ({body[:120]})")
# Prompts und Ressourcen kommen aus beiden Transporten zusammen
st, body = post(base, {"jsonrpc": "2.0", "id": 23, "method": "prompts/list"})
j = json.loads(body)
pn = sorted(p["name"] for p in j["result"]["prompts"])
if "local__hello" not in pn or "tasksd__summarize" not in pn:
failures.append(f"prompts/list über beide Transporte: {pn}")
st, body = post(base, {"jsonrpc": "2.0", "id": 24, "method": "resources/read",
"params": {"uri": "local__localfile://note"}})
j = json.loads(body)
if j.get("result", {}).get("contents", [{}])[0].get("text") != "stdio:note":
failures.append(f"stdio resources/read: {body[:120]}")
# 5. Meldung ohne id: 202, kein Inhalt
st, body = post(base, {"jsonrpc": "2.0", "method": "notifications/initialized"})
if st != 202 or body:
@@ -278,11 +309,13 @@ endpoint dummy {{
print((proc.stderr.read() or b"").decode()[-1500:])
sys.exit(1)
print(f"PASS: 12 Prüfungen — initialize (Werkzeuge, Prompts, Ressourcen), "
print(f"PASS: 17 Prüfungen — initialize (Werkzeuge, Prompts, Ressourcen), "
f"{len(want)} Werkzeuge gebündelt, Aufruf beim richtigen Server, "
f"Argumente unverändert, unbekanntes Werkzeug abgelehnt, "
f"Prompts gebündelt und beim Abruf entpräfixt, "
f"Ressourcen-URI beim Lesen entpräfixt, unbekanntes Präfix abgelehnt, "
f"stdio-Server startet und antwortet, kaputtes stdio-Kommando reißt die "
f"Liste nicht mit, beide Transporte in einer Liste, "
f"toter Server übersprungen")
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env python3
"""Ein MCP-Server über stdin/stdout, für tests/mcp.py.
Spricht genau das, was junction als stdio-Upstream erwartet: eine JSON-Zeile je
Anfrage, eine JSON-Zeile je Antwort. Beendet sich bei EOF auf stdin — sonst bliebe
nach einem abgebrochenen Testlauf ein Prozess zurück.
"""
import json
import sys
TOOLS = [
{"name": "echo", "description": "gibt den Text zurück",
"inputSchema": {"type": "object", "properties": {"text": {"type": "string"}}}},
]
PROMPTS = [{"name": "hello", "description": "ein Gruß", "arguments": []}]
RESOURCES = [{"uri": "localfile://note", "name": "Notiz", "mimeType": "text/plain"}]
def handle(req):
method = req.get("method")
rid = req.get("id")
if method == "initialize":
return {"jsonrpc": "2.0", "id": rid,
"result": {"protocolVersion": "2025-06-18",
"capabilities": {"tools": {}, "prompts": {}, "resources": {}},
"serverInfo": {"name": "local", "version": "1"}}}
if method == "tools/list":
return {"jsonrpc": "2.0", "id": rid, "result": {"tools": TOOLS}}
if method == "prompts/list":
return {"jsonrpc": "2.0", "id": rid, "result": {"prompts": PROMPTS}}
if method == "resources/list":
return {"jsonrpc": "2.0", "id": rid, "result": {"resources": RESOURCES}}
if method == "resources/read":
uri = (req.get("params") or {}).get("uri")
return {"jsonrpc": "2.0", "id": rid,
"result": {"contents": [{"uri": uri, "text": "stdio:note"}]}}
if method == "prompts/get":
name = (req.get("params") or {}).get("name")
return {"jsonrpc": "2.0", "id": rid,
"result": {"description": f"stdio:{name}",
"messages": [{"role": "user",
"content": {"type": "text", "text": "hi"}}]}}
if method == "tools/call":
params = req.get("params") or {}
text = (params.get("arguments") or {}).get("text", "")
return {"jsonrpc": "2.0", "id": rid,
"result": {"content": [{"type": "text",
"text": f"stdio:{params.get('name')}:{text}"}],
"isError": False}}
return {"jsonrpc": "2.0", "id": rid,
"error": {"code": -32601, "message": "no such method"}}
for line in sys.stdin:
line = line.strip()
if not line:
continue
try:
req = json.loads(line)
except json.JSONDecodeError:
continue
sys.stdout.write(json.dumps(handle(req)) + "\n")
sys.stdout.flush()
+3
View File
@@ -33,6 +33,9 @@ C1=$(curl -s -m 15 -o /dev/null -w '%{http_code}' -X POST -H 'Content-Type: appl
# Jetzt kommt der Endpunkt hoch, aber junction hält ihn noch für offline.
tests/stub $P_DEADS "LATE" & PIDS+=($!)
# Ein belegter Port lässt den Stub still scheitern ("bind/listen") und die Prüfung
# darunter wie ein Fehler im Router aussehen. Deshalb hier laut werden.
wait_port $P_DEADS 5 || bad "the stub could not bind port $P_DEADS (is it taken?)"
T0=$(date +%s%N)
R=$(curl -s -m 20 -X POST -H 'Content-Type: application/json' \
-d '{"model":"m","messages":[{"role":"user","content":"hi"}],"max_tokens":8}' \