Skip to content
Back to search

clihub

Turn any MCP server into CLI

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/thellimist--clihub/badge.svg)](/listings/thellimist--clihub)

HTML

<a href="/listings/thellimist--clihub"><img src="/api/listings/thellimist--clihub/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

go install github.com/thellimist/clihub@latest

If `clihub` is not found after install, run `export PATH="$(go env GOPATH)/bin:$PATH"` to add Go-installed binaries (usually `~/go/bin`) to your current shell `PATH`.

Or build from source:

git clone https://github.com/thellimist/clihub.git
cd clihub
go build -o clihub .
install -m 755 clihub ~/.local/bin/clihub

If you're contributing, run `bash scripts/install-hooks.sh` once after cloning.

If `~/.local/bin` is not in your `PATH`, add it in your shell config (for example `~/.zshrc`):

export PATH="$HOME/.local/bin:$PATH"

Requires Go 1.24+.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 277 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # clihub
  2. <p align="center">
  3. <img src="assets/cli_vs_mcp.png" alt="MCP vs CLI" width="600">
  4. </p>
  5. Turn any [MCP server](https://modelcontextprotocol.io/) into a compiled CLI binary. One command. Designed for agents.
  6. ```
  7. clihub generate --url https://mcp.linear.app/mcp
  8. # → ./out/linear (6.5MB static binary, zero runtime dependencies)
  9. ```
  10. Every tool the server exposes becomes a subcommand with flags derived from its JSON Schema. Auth is handled automatically — OAuth, bearer tokens, API keys, and more.
  11. [Full blog post](https://kanyilmaz.me/2026/02/23/cli-vs-mcp.html)
  12. ## Install
  13. ```bash
  14. go install github.com/thellimist/clihub@latest
  15. ```
  16. If `clihub` is not found after install, run `export PATH="$(go env GOPATH)/bin:$PATH"` to add Go-installed binaries (usually `~/go/bin`) to your current shell `PATH`.
  17. Or build from source:
  18. ```bash
  19. git clone https://github.com/thellimist/clihub.git
  20. cd clihub
  21. go build -o clihub .
  22. install -m 755 clihub ~/.local/bin/clihub
  23. ```
  24. If you're contributing, run `bash scripts/install-hooks.sh` once after cloning.
  25. If `~/.local/bin` is not in your `PATH`, add it in your shell config (for example `~/.zshrc`):
  26. ```bash
  27. export PATH="$HOME/.local/bin:$PATH"
  28. ```
  29. Requires Go 1.24+.
  30. ## AI Usage
  31. Add the following to your AGENTS.md
  32. ```
  33. ## Tools
  34. - Check if tool exists in `bin`.
  35. - If not, check if official CLI exists. If so, download it and add it to AGENTS.md
  36. - If not, check official MCP exists. If so, use clihub `go run github.com/thellimist/clihub@latest <server>` (see `--help`). to create a CLI and move the executable to bin folder. Then add it to AGENTS.md
  37. - If both failed, give suggestions to create a CLI using official docs and https://clig.dev/
  38. ```
  39. ## Quick Start
  40. ### HTTP MCP server
  41. ```bash
  42. clihub generate --url https://mcp.linear.app/mcp
  43. ./out/linear list-teams
  44. ```
  45. ### HTTP server with OAuth
  46. ```bash
  47. clihub generate --url https://mcp.notion.com/mcp --oauth
  48. ./out/notion notion-search --query "meeting notes"
  49. ```
  50. ### Stdio MCP server
  51. ```bash
  52. clihub generate --stdio "npx @modelcontextprotocol/server-github" \
  53. --env GITHUB_TOKEN=$GITHUB_TOKEN
  54. ./out/github list-repos --owner octocat
  55. ```
  56. ### Cross-compile
  57. ```bash
  58. clihub generate --url https://mcp.stripe.com \
  59. --platform linux/amd64,darwin/arm64,windows/amd64
  60. ```
  61. ### Pass tool input as JSON
  62. Generated CLIs include a `--from-json` flag on each tool command. This lets you pass the full tool input object directly.
  63. ```bash
  64. ./out/linear create-issue --from-json '{"title":"Bug report","priority":"high"}'
  65. ```
  66. Rules:
  67. - `--from-json` bypasses typed tool flags.
  68. - `--from-json` cannot be combined with typed flags in the same call.
  69. - If a tool already has a `--from-json` flag from its schema, clihub uses `--clihub-from-json` for passthrough instead.
  70. ## How It Works
  71. 1. **Connect** to the MCP server (HTTP or stdio)
  72. 2. **Discover** all tools via `tools/list`
  73. 3. **Generate** a Go CLI with one subcommand per tool
  74. 4. **Compile** to a static binary for your target platform(s)
  75. The generated binary is standalone — no runtime dependencies, no config files, no clihub needed.
  76. ## Authentication
  77. Generated CLIs handle auth at runtime. For HTTP servers, the `auth` subcommand manages credentials:
  78. ```bash
  79. # OAuth browser flow (auto-discovers endpoints via RFC 9728 / RFC 8414)
  80. ./out/linear auth
  81. # Manual bearer token
  82. ./out/linear auth --token $TOKEN
  83. # Check status
  84. ./out/linear auth status
  85. # Logout
  86. ./out/linear auth logout
  87. ```
  88. Some MCPs require generatin-time auth. Use
  89. ```bash
  90. clihub generate --help-auth
  91. ```
  92. Auth is resolved in this order:
  93. 1. `--auth-token` flag
  94. 2. `--auth-type` + related flags (`--auth-header-name`, `--auth-key-file`, etc.)
  95. 3. `CLIHUB_AUTH_TOKEN` environment variable
  96. 4. `~/.clihub/credentials.json` (persisted from previous auth)
  97. 5. Unauthenticated
  98. ### Supported Auth Types
  99. | Type | Description |
  100. |------|-------------|
  101. | OAuth 2.0 | Browser flow with PKCE, auto-discovery, token refresh |
  102. | Dynamic Client Registration | RFC 7591 — auto-registers OAuth clients |
  103. | Bearer Token | Static `Authorization: Bearer <token>` |
  104. | API Key | Custom header (e.g. `X-API-Key`) |
  105. | Basic Auth | Username/password |
  106. | S2S OAuth 2.0 | Client credentials grant (no browser) |
  107. | Google Service Account | JWT signed with service account key |
  108. ## Flags
  109. ```
  110. clihub generate [flags]
  111. Connection:
  112. --url string Streamable HTTP URL of an MCP server
  113. --stdio string Shell command that spawns a stdio MCP server
  114. --timeout int Connection timeout in ms (default 30000)
  115. --env strings Environment variables for stdio servers (KEY=VALUE)
  116. Output:
  117. --name string Override the inferred binary name
  118. --output string Output directory (default "./out/")
  119. --platform string Target GOOS/GOARCH pairs or 'all' (default current platform)
  120. Auth (shown via `--help-auth`):
  121. --oauth Use OAuth for authentication (browser flow)
  122. --auth-token string Bearer token
  123. --auth-type string Auth type: bearer, api_key, basic, none
  124. --auth-header-name string Custom header for api_key auth (default X-API-Key)
  125. --auth-key-file string Path to Google service account JSON key
  126. --client-id string Pre-registered OAuth client ID
  127. --client-secret string Pre-registered OAuth client secret
  128. --save-credentials Persist auth token to credential store
  129. Filtering:
  130. --include-tools string Only include these tools (comma-separated)
  131. --exclude-tools string Exclude these tools (comma-separated)
  132. Other:
  133. --help-auth Show authentication flags and exit
  134. --verbose Show detailed progress
  135. --quiet Suppress all output except errors
  136. ```
  137. ## Project Structure
  138. ```
  139. cmd/ CLI commands (root, generate)
  140. internal/
  141. auth/ Auth providers, OAuth flow, credential store
  142. codegen/ Go template for generated CLIs
  143. compile/ Go compiler invocation, cross-compilation
  144. nameutil/ Binary name inference from URLs/commands
  145. schema/ JSON Schema → Go flag mapping
  146. toolfilter/ Tool include/exclude with fuzzy matching
  147. gocheck/ Go installation detection
  148. main.go Entry point
  149. ```
  150. ## Contributing
  151. 1. Fork the repo
  152. 2. Create a feature branch (`git checkout -b feature/my-change`)
  153. 3. Install repo hooks: `bash scripts/install-hooks.sh`
  154. 4. Make your changes
  155. 5. Run tests: `go test ./...`
  156. 6. Commit with conventional format: `feat(scope): description`
  157. 7. Open a PR
  158. ### Hooks
  159. Hook files are tracked in this repo (`.githooks/`), so `git clone` downloads them automatically.
  160. Run this once per clone to activate them:
  161. ```bash
  162. bash scripts/install-hooks.sh
  163. ```
  164. The repo-managed pre-push hook runs:
  165. - `gofmt` formatting check (fails on unformatted `.go` files)
  166. - `go vet ./...`
  167. - `go test ./...`
  168. - `golangci-lint run` (if installed)
  169. Pushes to `main` also require both:
  170. - `VERSION` updated in the pushed commits
  171. - annotated git tag `vX.Y.Z` that matches `VERSION` and points at pushed `main` HEAD
  172. `scripts/install-hooks.sh` also sets `push.followTags=true`, so matching annotated tags are pushed automatically.
  173. Example release bump flow:
  174. ```bash
  175. bash scripts/bump-version.sh --prepare-push patch # bumps VERSION, amends HEAD, creates vX.Y.Z tag
  176. git push --follow-tags origin main
  177. ```
  178. Tag-only repair flow (if VERSION is already correct but tag is missing/misaligned):
  179. ## Docs
  180. Before changing behavior, review docs in `docs/`:
  181. - `docs/project/project.md` for scope and goals
  182. - `docs/architecture/architecture.md` for generation and command flow
  183. - `docs/auth/auth.md` for auth behavior and precedence
  184. - `docs/releasing/releasing.md` for release/version/tag rules
  185. ```bash
  186. bash scripts/bump-version.sh --sync-tag
  187. git push --follow-tags origin main
  188. ```
  189. ### Running Tests
  190. ```bash
  191. go test ./...
  192. ```
  193. ### Building
  194. ```bash
  195. go build -o clihub .
  196. ```
  197. ## License
  198. [MIT](LICENSE)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.