feat(mcp): hscli mcp serve — Model Context Protocol server - #6
Merged
Conversation
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 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).
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.
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
--allow-writes. Write tools carry MCPdestructiveHint/readOnlyHintso clients can confirm dangerous calls. The flag is one-time human setup — zero burden on the agent.plugins:*,help), theapiescape hatch, and streamingconv watchare excluded.Surface
mcptopic +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).