Add interface modes: headless (default), TUI, and MCP server#39
Merged
Conversation
Split the CLI's presentation into three explicit interfaces selectable at
runtime, with headless plain-text as the new default:
- `interface.rs`: an `Interface { Headless, Tui, Mcp }` global mirroring
`ci.rs`, resolved once in `main` from new global `--tui` / `--mcp` flags
(mutually exclusive). `--ci` is unchanged; MCP implies non-interactive.
- Headless is now the default. Read commands (`me`, `project list`/`show`,
`project deployments`, delete confirmations) previously always dropped into
a full-screen ratatui view; they now render plain text (`ui/plain.rs`) and
only enter the TUI under `--tui`. Delete confirmations share a
`prompt::confirm_delete` dispatcher (CI-refuse / TUI dialog / inline).
- `mcp.rs`: a stdio MCP server built on the official `rmcp` SDK, started by
`smb --mcp` instead of one-shot dispatch. Exposes the `me` command as the
first tool (calls the library fetch directly, returns JSON, keeps stdout
clean for JSON-RPC). Diagnostics go to stderr; logging stays file-only.
Verified end-to-end: `--help` lists the flags, clap enforces `--tui`/`--mcp`
exclusivity, and the MCP server completes initialize / tools/list / tools/call
over stdio. CI gate (fmt, clippy -D warnings, tests) is green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019fkbx6fUq1uDR5N75Ph5zi
Expand the MCP server beyond the `me` slice with the read-only project and
deployment tools, all reusing the existing library fetch functions:
- `project_list` — lists the user's projects as JSON.
- `project_show { id }` — a single project by ID (parameterized tool).
- `deployments { project_id }` — a project's deployments as JSON.
Auth handling is factored into `SmbMcpServer::access_token`, and a shared
`json_result` helper serializes any value into a tool result. Parameterized
tools use `schemars`-derived arg structs (added as a direct dependency) so
`tools/list` advertises correct input schemas.
Verified over stdio: `tools/list` shows all four tools with their required
arguments, and a parameterized `project_show` call deserializes and dispatches
correctly. CI gate (fmt, clippy -D warnings, tests) is green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019fkbx6fUq1uDR5N75Ph5zi
Add docs/interfaces.md describing the three runtime interfaces and how to select them: headless (default plain text), --tui (full-screen views), and --mcp (stdio MCP server). Covers the available MCP tools, wiring the server into an MCP client, and a raw JSON-RPC handshake example. Kept generic with placeholders per the public-repo policy. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019fkbx6fUq1uDR5N75Ph5zi
The v0.4.9 version bump updated the Rust crates but left sdk/npm/smbcloud-auth/package.json at 0.4.8, so prepare-package.mjs failed its crate/npm version-match check and reddened the npm SDK CI job. Bump the manifest to 0.4.9 to match the workspace. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019fkbx6fUq1uDR5N75Ph5zi
Extend the MCP server with the project write operations, reusing the same
networking-project calls the CLI handlers use:
- `project_create { name, description? }` — creates a project.
- `project_update { id, description }` — updates the description, fetching the
project first to preserve its runner (which `update_project` requires).
- `project_delete { id }` — deletes a project; destructive and irreversible.
Tools are non-interactive by nature, so writes apply immediately; the tool
descriptions and docs flag `project_delete` accordingly. Verified over stdio:
all seven tools list with correct required-argument schemas and dispatch.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019fkbx6fUq1uDR5N75Ph5zi
Add a "Not exposed as tools (yet)" section to docs/interfaces.md explaining the deliberate omission of `deploy` and `migrate` from the MCP tool set: both are coupled to the local working directory (`.smb/config.toml`, local build toolchains, on-disk SSH keys, streamed progress) in ways a non-interactive stdio tool call cannot satisfy cleanly. Points automated deploys at the headless `smb --ci deploy` path and notes what a future directory-free tool contract would require. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019fkbx6fUq1uDR5N75Ph5zi
keypair34
approved these changes
Jul 18, 2026
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.
Split the CLI's presentation into three explicit interfaces selectable at
runtime, with headless plain-text as the new default:
interface.rs: anInterface { Headless, Tui, Mcp }global mirroringci.rs, resolved once inmainfrom new global--tui/--mcpflags(mutually exclusive).
--ciis unchanged; MCP implies non-interactive.me,project list/show,project deployments, delete confirmations) previously always dropped intoa full-screen ratatui view; they now render plain text (
ui/plain.rs) andonly enter the TUI under
--tui. Delete confirmations share aprompt::confirm_deletedispatcher (CI-refuse / TUI dialog / inline).mcp.rs: a stdio MCP server built on the officialrmcpSDK, started bysmb --mcpinstead of one-shot dispatch. Exposes themecommand as thefirst tool (calls the library fetch directly, returns JSON, keeps stdout
clean for JSON-RPC). Diagnostics go to stderr; logging stays file-only.
Verified end-to-end:
--helplists the flags, clap enforces--tui/--mcpexclusivity, and the MCP server completes initialize / tools/list / tools/call
over stdio. CI gate (fmt, clippy -D warnings, tests) is green.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_019fkbx6fUq1uDR5N75Ph5zi