Repository navigation
Conversation
Added capa sh which allows the conversion of any MCP into a CLI tool
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.
capa sh— CLI Tool ExecutorSummary
Introduces
capa sh, a non-interactive command-line tool runner that exposes every configured MCP and command tool as a first-class CLI command. Designed to work equally well for humans and AI agents.Also includes server-side improvements to MCP result serialization and new optional metadata fields (
description,group) on servers and tools.What's new
capa shcommand (src/cli/commands/sh.ts,src/cli/index.ts)capa shlists all available commands grouped by MCP server or command tool group.capa sh <group>lists subcommands within that group.capa sh <group> <subcommand> [--arg value ...]executes a tool and prints the result, then exits.capa sh <unknown>passes the command through to the OS shell.--help/-h/helpat every level (top-level, group, subcommand).kebab-case(list_merge_requests→list-merge-requests).expose-all/on-demandmode.Tool metadata fields (
src/types/capabilities.ts)description?: stringadded to bothMCPServerandTool. Displayed incapa shoutput; falls back to a generic label when absent.group?: stringadded toTool. Command tools sharing a group are nested under a parent command incapa sh. A group with only one member is promoted to the top level.Shell tools API endpoint (
src/server/index.ts)GET /api/projects/:id/shell-toolsendpoint returns every tool with its full input schema, server/group metadata, and descriptions — regardless of exposure mode. Used bycapa shat invocation time.MCP result serialization fix (
src/server/mcp-handler.ts)serializeToolResultmethod detects double-encoded MCP proxy results (arrays of{ type, text }content items wheretextis itself a JSON string) and unwraps them: parses the inner JSON, returns a single object if there is only one item, or a JSON array otherwise. Applies to all four tool call response paths.ShellToolInfointerface andgetAllShellToolsmethod for use by the shell tools endpoint.