Repository navigation
Conversation
ashhart
added a commit
that referenced
this pull request
Nov 16, 2026
…ddress, each a serve child loaded on demand A request's model field picks the child, which the router starts if need be and relays byte for byte, with --max-loaded, --idle-unload and each model's memory floor bounding what stays loaded, and --router-config FILE.toml listing the models in [[models]] tables. Single-model serve is unchanged.
…s machine's models and local servers An AI coding assistant starts `tensorfold mcp` and calls seven tools: machine (the benchmark's allowlisted host facts), models (the cache scan `tensorfold models` lists), info (info's own lines, and its floor as the router reads it), pull (tensorfold pull's code, its lines as progress notifications), and serve, stop and status. serve starts `tensorfold serve` through the serve child the router and chat use: a free 127.0.0.1 port, a process group of its own and a fresh key, returned with the base URL and the served name. Every server the session started stops when stdin ends or a stop signal arrives. Windows refuses serve by name; the other tools work there. The server speaks MCP 2026-07-28 (per-request revision in _meta, server/discover) and the initialize handshake of 2025-11-25 and 2025-06-18: one JSON-RPC message a line, batches and bad JSON refused with JSON-RPC errors, tool problems as tool errors, and stdout for protocol messages only.
…e lock one server holds
ashhart
force-pushed
the
lead/cli-mcp
branch
from
November 22, 2026 07:53
b2b548e to
8b06491
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI coding assistants (Claude Code, Codex, Cursor) drive tools through the Model Context Protocol. Today an assistant can only use TensorFold by typing
tensorfold models,pullandservefor the user.tensorfold mcpis an MCP server on stdio, so the assistant can see what this machine runs, download a model, and start or stop a local server by calling tools.What this changes
Protocol: newline-delimited JSON-RPC 2.0 on stdio.
_meta,server/discover), plus theinitializehandshake of 2025-11-25 and 2025-06-18 for clients that open with it. Aninitializeasking for an older revision gets 2025-11-25.Seven tools:
machine: the host factstensorfold benchmarkalready records, with no hostname or serials, plus version, backend and model types.models: the cached checkpoints a family serves, from the same cache scan asserve --router(hub.cachedRepos).info:tensorfold info's own lines and numbers.pull: downloads withtensorfold pull's code. Each printed line becomes a progress notification when the client sent a progress token.serve: startstensorfold serveon a free 127.0.0.1 port with a fresh 64-hexTENSORFOLD_API_KEY, and returns the base URL, the served name and the key, which go only to the client that asked. Serving the same model and settings again returns the running server. A cancelledservestops its loading child.stop: stops a server this session started.status: those servers, without keys. An exited one shows its last log lines.Safety:
pulltakes repo ids only.infoandservetake a cached repo id, or the absolute path of an existing directory holdingconfig.json. Relative paths,~,..and ids the Hub would reject are refused.Threads:
pullandserverun on their own threads (at most 8), so a cancel and stdin's end still get through. Apullcan't be stopped midway, because pull's code has no cancel point; it finishes, and the next pull resumes it.The serve child: started through the shared serve child (
Managed.spawn) with the router's options and nothing added: its own process group, no benchmark guard, a stop flag and a failure reason. It keeps the user'sTENSORFOLD_REQUEST_LOGand seed salt, as the router's children do;docs/mcp.mdsays so.Windows:
serveis refused by name, since the serve child is POSIX. The other tools work, and the native build compiles for Windows and Linux.Docs:
docs/mcp.mdshows how to add it to Claude Code (claude mcp add tensorfold -- tensorfold mcp), Codex (~/.codex/config.toml), Cursor and othermcpServersclients.Issue: n/a. This came from the 16 Nov check of competitor gap docs against main (colibri's
coli mcpand omlx expose hardware, model, install and serve tools to assistants); no issue or PR covered it.Stacked on: server: tensorfold serve --router answers for several models at one address, each a serve child loaded on demand #3540 (
serve --router), which stacks on cli: tensorfold chat talks to a model in the terminal, through a serve child of its own or a running server's --url #3538 (tensorfold chat). This PR addsd6eaa9810aand reuses their shared serve child,hub.cachedReposandinfo'smemory().models.zigandinfo.zigare unchanged, so it doesn't touch cli: tensorfold models lists what fits this machine, with a rough one-stream speed #3483's files.atc overlap --json: to run after review.Specs read: the MCP specification at modelcontextprotocol.io (2026-07-28 and 2025-11-25), and Claude Code's and Codex's MCP setup docs. No MCP implementation's source.
Checks on this head
tools/pr_check.py: 0 errors, 1 advisory warning, the PR number).zig build test-mcp-host(new): 21/21, four runs green.zig build test-server-cpu: 1531/1540 (9 skipped).zig build test-cli test-cli-memory-host test-info-config test-pull-host: 93/108 (the same 15 skips as main).zig build test-golden: 322/335 equal, 0 unexpected; security 55/55.server-cpu, compile. The real binary answers both protocol revisions on stdio, with only JSON on stdout and stderr empty.zig fmt --check,git diff --check: clean.serveon Metal or CUDA, a real Claude Code, Codex or Cursor session, Windows at runtime, and Linux'stest-host.Receipt
n/a: a CLI front for existing commands that can't change what the engine computes. Host checks are above.
Checklist
The title and description match the head commit.
New tests fail before the change, pass after it, and skip cleanly without their dependency.
Comments and docstrings are one line. No measurements or history in the source.
No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
Synthena (Ash's Agent)