mctop

command module
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 5 Imported by: 0

README

mctop

release ci license

A terminal client for MCP servers. Connect to any server, browse its tools, resources, and prompts, call them, and watch the result, without leaving the shell. Then assert the server's contract in CI so a renamed tool or a drifted schema fails the build instead of breaking an agent in production.

Think curl and k9s, but for the Model Context Protocol.

mctop browsing a server, calling a tool, and showing the protocol trace

What it does

  • Explore a server interactively: browse tools, resources, and prompts, fill a tool's arguments in a schema-driven form, and read the result.
  • Script it headless: mctop ls to list, mctop call for one-shot calls.
  • Test it in CI: mctop test spec.yaml runs a contract and exits non-zero when it breaks.

Install

curl -fsSL https://mctop.org/install | sh

Or with Homebrew, or the Go toolchain:

brew install mctop-org/tap/mctop
go install github.com/mctop-org/mctop@latest

Then mctop upgrade keeps it current, however you installed it.

Usage

mctop <target>                 open the interactive client against a server
mctop ls <target>              list tools, resources, and prompts
mctop call <target> <tool>     call one tool and print the result
mctop login <url>              log in to an OAuth-protected server
mctop test <spec.yaml>         run a contract, exit 0 on pass, 1 on fail
mctop upgrade                  update to the latest release

A target is either a command to spawn ("uvx mcp-server-time") or an http(s):// URL. For an older server that needs the legacy SSE transport, add --sse.

mctop call "uvx mcp-server-time" get_current_time timezone=UTC

Arguments are key=value pairs (values that look like JSON, such as numbers, booleans, arrays, and objects, are typed; anything else is a string), or a single --json '{...}' object.

Interactive mode

Run mctop <target> with no subcommand to open the full-screen client: browse tools, resources, and prompts; press enter on a tool to fill its arguments in a schema-driven form and run it; read the result, then go again.

↑↓ move    enter open    / search    tab switch section    T trace    ? keys    q quit

Results render as readable fields and tables instead of raw JSON. When the result is a list of records, / select a row and enter expands it into a full, untruncated view; esc collapses back to the list. Press t for the raw JSON, y to copy, r to re-run, e to edit the arguments, and esc (or ) to go back.

Press T to see the raw protocol: every JSON-RPC frame that crossed the wire, each tagged with its direction, method, and time, above its JSON. It reads like the web Inspector's network pane, without leaving the terminal, so you can see exactly what a server sent back when a call surprises you.

Vim motions (h/j/k/l, g/G) are on by default; V toggles them and the choice is remembered. The arrow keys always work either way. Press ? for the full list of keys.

Authentication

For OAuth-protected servers, log in once and mctop handles the token after that:

mctop login  https://api.example.com/mcp   # opens the browser, caches the token
mctop ls     https://api.example.com/mcp   # uses it automatically
mctop logout https://api.example.com/mcp   # forgets it

The token is cached per host and refreshed as needed, so you log in once per server, not per command. For servers that take a static token instead, pass it with -H (repeatable):

mctop ls https://api.example.com/mcp -H "Authorization: Bearer $TOKEN"

Testing in CI

A spec describes what a server must expose and how its calls must behave. mctop test exits non-zero when the contract breaks, so it gates a build.

server:
  url: "https://api.example.com/mcp"
  # sse: true                          # for a legacy HTTP+SSE server
  headers:
    Authorization: "Bearer ${TOKEN}"   # expanded from the environment
expect:
  tools: [search, fetch]
calls:
  - tool: search
    args: { query: "hello" }
    assert:
      not_error: true
      contains: "results"
mctop test spec.yaml --report json

Examples

The examples/ directory has runnable specs and a small demo server you can point mctop at:

go run ./examples/demoserver
mctop ls http://localhost:8080/mcp

License

MIT, see LICENSE.

Documentation

Overview

Command mctop is a terminal client for MCP servers: explore a server in a TUI, script it headless, or assert its contract in CI. See DESIGN.md.

Directories

Path Synopsis
examples
demoserver command
Command demoserver is a tiny MCP server over streamable HTTP, used to exercise mctop's http transport and as a public endpoint to point mctop at:
Command demoserver is a tiny MCP server over streamable HTTP, used to exercise mctop's http transport and as a public endpoint to point mctop at:
internal
cli
Package cli implements mctop's headless subcommands.
Package cli implements mctop's headless subcommands.
config
Package config persists mctop's small set of user preferences under the OS config dir, next to the cached OAuth credentials.
Package config persists mctop's small set of user preferences under the OS config dir, next to the cached OAuth credentials.
mcp
Package mcp wraps the official MCP Go SDK into the small surface mctop needs: connect to a server, list its tools/resources/prompts, and call a tool.
Package mcp wraps the official MCP Go SDK into the small surface mctop needs: connect to a server, list its tools/resources/prompts, and call a tool.
oauth
Package oauth gives mctop a login flow for OAuth-protected MCP servers: discover the server's authorization server, register a client, run the authorization-code flow with PKCE in the browser, and cache the resulting token so later commands authenticate without logging in again.
Package oauth gives mctop a login flow for OAuth-protected MCP servers: discover the server's authorization server, register a client, run the authorization-code flow with PKCE in the browser, and cache the resulting token so later commands authenticate without logging in again.
spec
Package spec defines mctop's CI contract format and the engine that runs it against a connected server.
Package spec defines mctop's CI contract format and the engine that runs it against a connected server.
tui
Package tui is mctop's interactive terminal client: connect to a server and move through it step by step, browse what it exposes, fill a tool's arguments, run it, and read the result, without leaving the keyboard.
Package tui is mctop's interactive terminal client: connect to a server and move through it step by step, browse what it exposes, fill a tool's arguments, run it, and read the result, without leaving the keyboard.
ui
Package ui holds mctop's terminal styling: ANSI colors that switch off when output is not a terminal, plus the wordmark.
Package ui holds mctop's terminal styling: ANSI colors that switch off when output is not a terminal, plus the wordmark.
upgrade
Package upgrade replaces the running mctop binary with the latest GitHub release: it finds the matching asset, verifies its checksum, and swaps the executable in place.
Package upgrade replaces the running mctop binary with the latest GitHub release: it finds the matching asset, verifies its checksum, and swaps the executable in place.

Jump to

Keyboard shortcuts

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