No description
  • Go 94.8%
  • Shell 3.4%
  • Makefile 1.8%
Find a file
Kai Siren 4b018487c8
Some checks are pending
ci / test (push) Waiting to run
ci / lint (push) Waiting to run
ci / govulncheck (push) Waiting to run
ci / docs (push) Waiting to run
codeql / analyze (go) (push) Waiting to run
pages / build (push) Waiting to run
pages / deploy (push) Blocked by required conditions
chore(ci): remove codex-review-gate + undraft-and-poke-codex workflows
closes #64
2026-05-16 15:42:05 -07:00
.agent-guard rename: update cross-repo refs after coilyco-ai to agentic-os-kai 2026-05-15 02:28:05 -07:00
.github chore(ci): remove codex-review-gate + undraft-and-poke-codex workflows 2026-05-16 15:42:05 -07:00
deploy Add Streamable HTTP transport + serve-http example + Caddyfile 2026-05-13 05:01:06 -07:00
docs chore: complete trifecta + re-enable catalog-doc-size + catalog-trifecta 2026-05-15 23:44:49 -07:00
examples Add detailed Description fields to every example command, closes #49 2026-05-13 16:29:28 -07:00
scripts chore: adopt coilysiren/agentic-os v0.2.1 upstream-ref pre-commit suite 2026-05-15 23:33:42 -07:00
.gitignore Repository hygiene sweep: tier-A + CONTRIBUTING + godoc-current + auto-merge 2026-05-13 05:48:23 -07:00
.golangci.yaml Adopt coily's strict .golangci.yaml + pre-commit 2026-05-13 05:59:45 -07:00
.pre-commit-config.yaml chore: complete trifecta + re-enable catalog-doc-size + catalog-trifecta 2026-05-15 23:44:49 -07:00
AGENTS.md chore: complete trifecta + re-enable catalog-doc-size + catalog-trifecta 2026-05-15 23:44:49 -07:00
attach.go AttachMCP, dual-mode example, drop root name from tool paths, closes #31 2026-05-13 07:04:58 -07:00
attach_test.go AttachMCP, dual-mode example, drop root name from tool paths, closes #31 2026-05-13 07:04:58 -07:00
climcp.go Plumb _meta.claudeSessionId from MCP tool-call onto action ctx 2026-05-14 04:27:45 -07:00
climcp_test.go feat!: default NameJoiner to '_' for safer MCP client interop 2026-05-13 07:39:06 -07:00
CODE_OF_CONDUCT.md Adopt Contributor Covenant 2.1 as Code of Conduct 2026-05-13 05:31:36 -07:00
CONTRIBUTING.md Move .coily/coily.yaml to .agent-guard/agent-guard.yaml 2026-05-14 06:50:49 -07:00
example_test.go feat!: default NameJoiner to '_' for safer MCP client interop 2026-05-13 07:39:06 -07:00
go.mod Adopt cli-guard audit.WithSessionID as canonical session-id ctx key 2026-05-14 04:32:40 -07:00
go.sum Adopt cli-guard audit.WithSessionID as canonical session-id ctx key 2026-05-14 04:32:40 -07:00
godoc-current.txt Adopt cli-guard audit.WithSessionID as canonical session-id ctx key 2026-05-14 04:32:40 -07:00
LICENSE Scaffold cli-mcp: project urfave/cli v3 command tree as MCP server 2026-05-13 04:31:32 -07:00
Makefile Wire cli-web-docs into docs surface, closes #46 2026-05-13 12:04:33 -07:00
mkdocs-requirements.txt Add mkdocs (urfave palette) + docs CI verification 2026-05-13 05:28:45 -07:00
mkdocs.yml Wire cli-web-docs into docs surface, closes #46 2026-05-13 12:04:33 -07:00
README.md chore: complete trifecta + re-enable catalog-doc-size + catalog-trifecta 2026-05-15 23:44:49 -07:00
schema.go Combine complexity nolints on buildArgv and flagSchema 2026-05-13 06:07:35 -07:00
SECURITY.md Add SECURITY.md (urfave shape) + nav and Support links 2026-05-13 05:36:34 -07:00
serve.go Batteries-included Streamable HTTP runner, closes #30 2026-05-13 06:49:44 -07:00
serve_test.go Batteries-included Streamable HTTP runner, closes #30 2026-05-13 06:49:44 -07:00
session.go Adopt cli-guard audit.WithSessionID as canonical session-id ctx key 2026-05-14 04:32:40 -07:00
session_test.go Adopt cli-guard audit.WithSessionID as canonical session-id ctx key 2026-05-14 04:32:40 -07:00
staticcheck.conf Adopt urfave-shaped README + trifecta + staticcheck.conf 2026-05-13 05:23:20 -07:00

cli-mcp

[![Go Reference][goreference_badge]][goreference_link] [![Go Report Card][goreportcard_badge]][goreportcard_link] [![Tests status][test_badge]][test_link]

cli-mcp turns a [urfave/cli][urfave/cli] v3 command tree into a CLI by default, with a batteries-included [Model Context Protocol][mcp] server attached. One binary, three usage forms, same code path.

app := &cli.Command{Name: "demo", Commands: []*cli.Command{ /* your tree */ }}
climcp.AttachMCP(app, climcp.Options{Name: "demo", Version: "v0.0.0"})
app.Run(ctx, os.Args)

That's it. app is now a regular CLI you can run directly, AND an MCP server when invoked as app mcp serve (stdio) or app mcp serve-http (Streamable HTTP).

The three forms

Given a hello subcommand, the same code is reachable as:

1. Plain CLI — humans run subcommands directly:

./demo hello kai --loud
# HELLO, KAI!

2. MCP server, raw JSON-RPC over the [Streamable HTTP][streamable] transport: start ./demo mcp serve-http --addr 127.0.0.1:8080, POST a tools/call payload to /mcp with the standard MCP headers. Returns "HELLO, KAI!" for the same args.

3. MCP server, called via [mcporter][mcporter] — the client wraps MCP tools as subcommands, so the caller sees a CLI shape again:

# mcporter.json
# {"mcpServers":{"demo":{"command":"./demo","args":["mcp","serve"]}}}
mcporter call demo hello kai --loud
# HELLO, KAI!

Form 1 runs the Action directly. Forms 2 and 3 round-trip through MCP and end up running the same Action with the same flags and args. The mcp subcommand group is auto-excluded from the MCP tool surface so calling MCP doesn't expose "how to start MCP".

See examples/dual-mode for the runnable version.

Features

  • Every leaf command becomes an MCP tool; tool name is the dot-joined path from the root's children.
  • Input schema derived from urfave flags (typed) and positional args.
  • stdio transport for editor/agent integrations, [Streamable HTTP][streamable] (current spec) for remote.
  • Built on the official [modelcontextprotocol/go-sdk][go-sdk].
  • Relays webops.* metadata onto MCP tool.Meta for [cli-web-ops] consumption.
  • Composes with [cli-guard]: Guard-wrapped actions audit and validate every tool call.

Documentation

docs/FEATURES.md inventory, examples/ demos, CLI reference, deploy/Caddyfile.example production posture. Dev verbs in .agent-guard/agent-guard.yaml; agent-guard lint validates against the Makefile.

Support

Bug or feature request: [create a new issue]. Conduct: Code of Conduct. Security: SECURITY.md. Siblings: [cli-guard], [cli-web-docs], [cli-web-ops].

See also

Cross-reference convention from coilysiren/agentic-os#59.