Skip to content

feat(mcp): hscli mcp serve — Model Context Protocol server - #6

Merged
wavyx merged 2 commits into
mainfrom
feat/mcp-server
Jun 5, 2026
Merged

feat(mcp): hscli mcp serve — Model Context Protocol server#6
wavyx merged 2 commits into
mainfrom
feat/mcp-server

Conversation

@wavyx

@wavyx wavyx commented Jun 5, 2026

Copy link
Copy Markdown
Owner

What

Adds hscli mcp serve — runs hscli as a Model Context Protocol server over stdio so AI agents (Claude Desktop/Code, etc.) drive Help Scout through native tools. One tool per command, generated from the oclif manifest so it stays in sync.

Design

  • Reads by default, writes gated. Only read-only tools are exposed unless started with --allow-writes. Write tools carry MCP destructiveHint/readOnlyHint so clients can confirm dangerous calls. The flag is one-time human setup — zero burden on the agent.
  • Subprocess execution. Each tool call re-invokes the CLI as a child process, keeping the parent's stdout (the stdio JSON-RPC channel) clean and reusing real auth/exit codes.
  • Own commands only. Bundled oclif plugin commands (plugins:*, help), the api escape hatch, and streaming conv watch are excluded.

Surface

mcp topic + src/lib/mcp/{catalog,schema,invoke,server}.js + src/commands/mcp/serve.js. Reads = 48 tools; --allow-writes = 87.

Tests

100% coverage (708 tests). Unit-tested catalog/schema/invoke/server; server round-trips via an in-memory MCP client; verified end-to-end over real stdio with an MCP client (read-only and --allow-writes).

Docs

New MCP guide (automation/mcp.mdx) with Claude Desktop/Code config, README row + quickstart, generated reference (89 commands).

Expose hscli to AI agents as an MCP server over stdio: one tool per
command, manifest-driven so it stays in sync with the CLI.

- catalog: classify commands read/write/destructive; exclude the `api`
  escape hatch and streaming `conv watch`; only the app's own commands.
- schema: command flags/args -> zod input shape (enums, required,
  arrays); drops output-shaping/global flags.
- invoke: run each call as a child process (keeps the stdio protocol
  channel clean), shape stdout into MCP content + structuredContent.
- server: register tools with readOnly/destructive annotations, gated by
  --allow-writes (reads always; writes opt-in, hidden otherwise).
- `mcp serve` command (stdio transport), `mcp` topic, MCP guide, README.

Reads are exposed by default (48 tools); --allow-writes adds the rest
(87). Verified end-to-end over real stdio with an MCP client. 100%
coverage retained (708 tests).
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

MCP server — hscli mcp serve runs the CLI as a Model Context Protocol
server over stdio (read-only by default, --allow-writes to enable
mutations). Regenerate the reference (89 commands).
@wavyx
wavyx merged commit 905fa18 into main Jun 5, 2026
11 checks passed
@wavyx
wavyx deleted the feat/mcp-server branch June 5, 2026 10:11
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.

2 participants