mcp-cli

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 16 Imported by: 0

README

mcp-cli

Test codecov

A single-binary MCP client for the shell. It calls one tool on one MCP server and prints the bare payload — no envelope, no session juggling, no hand-built JSON-RPC.

Servers are not configured twice: mcp-cli reads the same configuration Claude Code uses, so anything in claude mcp list is callable from a script.

echo '{"libraryName": "Go", "query": "http server"}' | mcp-cli context7 resolve-library-id

Install

go install github.com/tkukushkin/mcp-cli@latest

Or grab a prebuilt binary for darwin, linux or windows on amd64/arm64 from the releases page.

Usage

mcp-cli <server> <tool>
  • <server> — the name as it appears in claude mcp list.
  • <tool> — the bare tool name, without the mcp__<server>__ prefix.
  • Arguments are a JSON object on stdin. For a tool that takes none, use < /dev/null — or just run it interactively, since a TTY stdin also means {}.
  • stdout is the tool's payload: structuredContent as compact JSON when the server provides it, otherwise the text content as-is (which may itself be JSON).
  • Exit code is 0 on success, 1 on failure, with the error text on stderr (server not found, connection failure, or the tool's own error message).

Configuration

No config file of its own. Servers are looked up by name, first match wins:

  1. ./.mcp.jsonmcpServers (project scope)
  2. ~/.claude.jsonprojects["$PWD"].mcpServers (local scope)
  3. ~/.claude.jsonmcpServers (user scope)

OAuth

Servers behind claude mcp login work: the access token Claude Code holds for the server is sent as a bearer token.

It is never refreshed, so a token that has expired is reported as such — call the server once from Claude Code and it refreshes itself.

Scope

tools/call only, deliberately. Discovery (tools/list, resources, prompts) is what an MCP host is for; this is the escape hatch for when you're not in one.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL