Skip to content

Command line

mcpapi runs the three tools from a terminal. An agent with a shell, such as Claude Code, Codex or a CI job, can use every API in your workspace without carrying any tool definitions: it runs a command when it needs one.

It needs Node 20 or later and has no dependencies. Its source is in cli/, and every release is published from there with npm provenance.

Terminal window
npm install -g @mcpapi/cli # or prefix each command with npx @mcpapi/cli

In your browser: mcpapi login opens the sign-in page. You sign in with your MCPAPI email and pick a workspace, as with any MCP client. The login is saved in ~/.config/mcpapi/credentials.json (or under $XDG_CONFIG_HOME), readable only by you, and refreshes itself. It acts with your own access in that workspace and shows on the dashboard’s Connected Agents page, where you can disconnect it.

With a key: set MCPAPI_KEY to a key from the Connected Agents page. Nothing is saved, and the key’s limits apply. Use a key on servers, in CI, and over SSH, where the browser can’t reach the computer running the CLI.

When both are there, the key wins. mcpapi whoami says which one is in use; mcpapi logout deletes the saved login on this computer.

Terminal window
mcpapi search "refund a charge" [--source stripe] [--limit 5]
mcpapi details stripe.PostRefunds [--field metadata]
mcpapi run stripe.PostRefunds --args '{"charge":"ch_123"}' [--connection sandbox] [--search-id <id>]
Command Tool
search <words> search_tools The words are the query.
details <id> get_tool_details --field expands one nested argument.
run <id> execute_tool --args is the arguments as a JSON object; --args - reads it from stdin, which avoids quoting trouble in some shells.

Each command prints the tool’s reply as JSON, indented in a terminal and on one line when piped. The exit code is 1 when the tool answers error or denied, or the CLI can’t sign in or reach MCPAPI, and 0 otherwise. A run that needs a person’s approval answers pending_approval with a link in approve: once they approve, the same mcpapi run with the same arguments runs once.

Variable
MCPAPI_KEY An API key. Used instead of the saved login.
MCPAPI_URL The MCPAPI address. Default https://mcpapi.one. A login is saved per address.