npm package: @modeltoolsprotocol/mtpcli
Description: The command-line interface for the [Model Tools Protocol](https://github.com/modeltoolsprotocol/modeltoolsprotocol) (MTP). Discover, authenticate, and bridge tools that implement the `--mtp-describe` convention.
Latest version: 1.3.4

# mtpcli

The command-line interface for the [Model Tools Protocol](https://github.com/modeltoolsprotocol/modeltoolsprotocol) (MTP). Discover, authenticate, and bridge tools that implement the `--mtp-describe` convention.

CLI tools are composable but not LLM-discoverable. MCP tools are discoverable but not composable. MTP bridges the gap with a single `--mtp-describe` flag. **mtpcli** turns any `--mtp-describe` CLI into an MCP server, turns any MCP server into a composable CLI, and handles discovery, auth, and validation along the way. See the [protocol README](https://github.com/modeltoolsprotocol/modeltoolsprotocol) for the full rationale.

## Install

```bash
npm install -g @modeltoolsprotocol/mtpcli
```

## Usage

### Serve CLI tools over MCP

Any CLI that supports `--mtp-describe` becomes an MCP server:

```bash
$ mtpcli serve --tool atlasctl --tool mytool

mtpcli serve: serving 6 tool(s) from 2 CLI tool(s)
  - atlasctl__confluence page get
  - atlasctl__config set
  - atlasctl__config get
  - mytool__convert
  ...
```

Drop it into your Claude Desktop config and it works like any other MCP server. The bridge reads `--mtp-describe`, translates commands to MCP tools, and shells out to the real CLI when the host calls a tool.

### Wrap an MCP server as a CLI

Atlassian ships an MCP server at `mcp.atlassian.com`. With `mtpcli wrap`, it's a CLI:

```bash
# Discover what tools the server offers
$ mtpcli wrap --url "https://mcp.atlassian.com/v1/mcp" --mtp-describe

# Fetch a Confluence page
$ mtpcli wrap --url "https://mcp.atlassian.com/v1/mcp" \
    getConfluencePage -- --cloudId "$CLOUD_ID" --pageId 12345 --contentFormat markdown

# Pipe it into jq, grep, or anything else
$ mtpcli wrap --url "https://mcp.atlassian.com/v1/mcp" \
    getConfluencePage -- --cloudId "$CLOUD_ID" --pageId 12345 --contentFormat markdown \
    | jq -r '.body'

# Works with stdio servers too
$ mtpcli wrap --server "npx @mcp/server-github" --mtp-describe
```

The 2,500+ MCP servers people have built? They're all CLI tools now. Pipe their output, use them in scripts, compose them with other tools.

### Search for tools and commands

```bash
# Search specific tools
mtpcli search "convert files" -- filetool mytool

# Search all cached tools
mtpcli search "deploy"

# Scan PATH for describe-compatible tools and search
mtpcli search --scan-path "git commit"
```

### Authenticate with a tool

```bash
# OAuth2 login (opens browser, handles callback)
mtpcli auth login mytool

# API key / bearer token login
mtpcli auth login mytool --token sk-xxx

# Check auth status
mtpcli auth status mytool

# Inject token into env
eval $(mtpcli auth env mytool)

# Log out
mtpcli auth logout mytool
```

See [AUTH.md](AUTH.md) for details on token storage, usage patterns, and bridge integration.

### Validate a tool's --mtp-describe output

```bash
# Validate a tool against the MTP spec
mtpcli validate mytool

# Validate JSON from stdin (for CI)
cat describe.json | mtpcli validate --stdin

# JSON output
mtpcli validate mytool --json
```

### Generate shell completions

```bash
# Bash
eval $(mtpcli completions bash mytool)

# Zsh
eval $(mtpcli completions zsh mytool)

# Fish
mtpcli completions fish mytool | source
```

### Describe self

```bash
# mtpcli is itself an MTP-compliant tool
mtpcli --mtp-describe
```

## Development

Requires [Bun](https://bun.sh/).

```bash
# Install dependencies
bun install

# Run tests
bun test

# Type check
bun run typecheck

# Build
bun run build
```

## License

Apache-2.0