Skip to content

Add interface modes: headless (default), TUI, and MCP server#39

Merged
paydii merged 6 commits into
developmentfrom
feature/cli-crate-interfaces
Jul 18, 2026
Merged

Add interface modes: headless (default), TUI, and MCP server#39
paydii merged 6 commits into
developmentfrom
feature/cli-crate-interfaces

Conversation

@paydii

@paydii paydii commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

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

claude added 6 commits July 17, 2026 12:28
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

@setoelkahfi setoelkahfi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smb mcp

@paydii
paydii merged commit 4d97847 into development Jul 18, 2026
6 checks passed
@paydii
paydii deleted the feature/cli-crate-interfaces branch July 18, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants