安装方式
手动下载安装
下载 ZIP 后解压到技能目录即可安装。若在桌面客户端 WebView中直接下载出现异常,本站会改为提示页 + 原始链接,请按页内说明操作。
下载 ZIP (oss-superpowers-lab-mcp-cli-v1.0.0.zip)触发指令
/mcp-cli
跨平台安装指引
该技能声明兼容以下 1 个平台,将 ZIP 解压到对应目录即可被识别。
unzip oss-superpowers-lab-mcp-cli-v1.0.0.zip -d ~/.claude/skills/
mkdir -p 创建;启用 Skill 后请重启对应 Agent 让配置生效。
使用指南
MCP CLI:按需使用 MCP 服务
用 mcp 命令行 动态发现并调用 MCP 服务器能力,无需 事先把每个服务都配成常驻集成,也 减少 把大段 MCP 文档预载进上下文。
何时使用
- 探索某 MCP 服务是否值得长期接入
- 一次性 调用,不想改全局配置
- 不想用预加载 MCP 撑爆上下文
- 调试、验证 MCP 服务
- 服务尚未在客户端里预配置
前置:mcp 可执行文件
期望路径 ~/.local/bin/mcp。若无:
cd /tmp && git clone --depth 1 https://github.com/f/mcptools.git
cd mcptools && CGO_ENABLED=0 go build -o ~/.local/bin/mcp ./cmd/mcptools
export PATH="$HOME/.local/bin:$PATH"
发现流程
- 工具列表:
mcp tools <启动服务器的命令…> - 资源列表:
mcp resources <server-command> - 提示词列表:
mcp prompts <server-command> - JSON 详情:
mcp tools --format json或--format pretty
示例启动方式:本地 npx -y @modelcontextprotocol/server-filesystem /path、带 token 的 docker run … github-mcp-server、远程 https://host/mcp 等。
调用工具
mcp call <tool_name> --params '<json>' <server-command>
嵌套 JSON 用单引号包住;复杂参数可写文件再 --params "$(cat params.json)"。
输出格式: 默认表格;-f json / -f pretty 便于解析。
读资源 / 用提示词
mcp read-resource <resource-uri> <server-command>
mcp get-prompt <prompt-name> <server-command>
mcp get-prompt <name> --params '{"arg":"v"}' <server-command>
别名(同一会话反复用)
mcp alias add fs npx -y @modelcontextprotocol/server-filesystem /home/user
mcp call read_file --params '{"path":"README.md"}' fs
mcp alias list
mcp alias remove fs
配置存 ~/.mcpt/aliases.json。
认证
- HTTP Basic:
--auth-user user:pass - Bearer:
--auth-header "Bearer …" - Docker:
-e VAR=value传入 token
传输
stdio(默认,本地 npx 等)、HTTP/HTTPS(自动)、SSE(--transport sse 或 URL 暗示)。
常用服务器(示例命令)
文件系统、memory、GitHub(需 token)、Brave Search、Puppeteer 等——与官方包名一致,用 mcp tools <启动命令> 先看工具表。
最佳实践
先 mcp tools 看清 schema;要解析结果用 -f json;参数类型与表格签名一致(str/num/bool/数组等);失败看退出码与 stderr;同会话多次调用用 alias;可用 mcp guard --allow … --deny … 限制危险工具。
调试
mcp tools --server-logs …;查 ~/.mcpt/aliases.json;--format pretty 看参数问题。
速查
| 动作 | 命令 |
|------|------|
| 列工具 | mcp tools <server> |
| 列资源 | mcp resources <server> |
| 列提示 | mcp prompts <server> |
| 调工具 | mcp call … --params '…' <server> |
| 读资源 | mcp read-resource <uri> <server> |
| 取提示 | mcp get-prompt … |
| 别名 | mcp alias add|remove|list |
故障
command not found → 检查 PATH。JSON 错 → 单引号、转义、或临时文件。超时 → CLI 会等服务就绪。权限 → 检查 filesystem 允许路径。
# MCP CLI: On-Demand MCP Server Usage
Use the `mcp` CLI tool to dynamically discover and invoke MCP server capabilities without pre-configuring them as permanent integrations.
## When to Use This Skill
Use this skill when you need to:
- Explore an MCP server's capabilities before deciding to use it
- Make one-off calls to an MCP server without permanent integration
- Access MCP functionality without polluting the context window
- Test or debug MCP servers
- Use MCP servers that aren't pre-configured
## Prerequisites
The `mcp` CLI must be installed at `~/.local/bin/mcp`. If not present:
```bash
# Clone and build
cd /tmp && git clone --depth 1 https://github.com/f/mcptools.git
cd mcptools && CGO_ENABLED=0 go build -o ~/.local/bin/mcp ./cmd/mcptools
```
Always ensure PATH includes the binary:
```bash
export PATH="$HOME/.local/bin:$PATH"
```
## Discovery Workflow
### Step 1: Discover Available Tools
```bash
mcp tools <server-command>
```
**Examples:**
```bash
# Filesystem server
mcp tools npx -y @modelcontextprotocol/server-filesystem /path/to/allow
# Memory/knowledge graph server
mcp tools npx -y @modelcontextprotocol/server-memory
# GitHub server (requires token)
mcp tools docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
# HTTP-based server
mcp tools https://example.com/mcp
```
### Step 2: Discover Resources (if supported)
```bash
mcp resources <server-command>
```
Resources are data sources the server exposes (files, database entries, etc.).
### Step 3: Discover Prompts (if supported)
```bash
mcp prompts <server-command>
```
Prompts are pre-defined prompt templates the server provides.
### Step 4: Get Detailed Info (JSON format)
```bash
# For full schema details including parameter types
mcp tools --format json <server-command>
mcp tools --format pretty <server-command>
```
## Making Tool Calls
### Basic Syntax
```bash
mcp call <tool_name> --params '<json>' <server-command>
```
### Examples
**Read a file:**
```bash
mcp call read_file --params '{"path": "/tmp/example.txt"}' \
npx -y @modelcontextprotocol/server-filesystem /tmp
```
**Write a file:**
```bash
mcp call write_file --params '{"path": "/tmp/test.txt", "content": "Hello world"}' \
npx -y @modelcontextprotocol/server-filesystem /tmp
```
**List directory:**
```bash
mcp call list_directory --params '{"path": "/tmp"}' \
npx -y @modelcontextprotocol/server-filesystem /tmp
```
**Create entities (memory server):**
```bash
mcp call create_entities --params '{"entities": [{"name": "Project", "entityType": "Software", "observations": ["Uses TypeScript"]}]}' \
npx -y @modelcontextprotocol/server-memory
```
**Search (memory server):**
```bash
mcp call search_nodes --params '{"query": "TypeScript"}' \
npx -y @modelcontextprotocol/server-memory
```
### Complex Parameters
For nested objects and arrays, ensure valid JSON:
```bash
mcp call edit_file --params '{
"path": "/tmp/file.txt",
"edits": [
{"oldText": "foo", "newText": "bar"},
{"oldText": "baz", "newText": "qux"}
]
}' npx -y @modelcontextprotocol/server-filesystem /tmp
```
### Output Formats
```bash
# Table (default, human-readable)
mcp call <tool> --params '{}' <server>
# JSON (for parsing)
mcp call <tool> --params '{}' -f json <server>
# Pretty JSON (readable JSON)
mcp call <tool> --params '{}' -f pretty <server>
```
## Reading Resources
```bash
# List available resources
mcp resources <server-command>
# Read a specific resource
mcp read-resource <resource-uri> <server-command>
# Alternative syntax
mcp call resource:<resource-uri> <server-command>
```
## Using Prompts
```bash
# List available prompts
mcp prompts <server-command>
# Get a prompt (may require arguments)
mcp get-prompt <prompt-name> <server-command>
# With parameters
mcp get-prompt <prompt-name> --params '{"arg": "value"}' <server-command>
```
## Server Aliases (for repeated use)
If using a server frequently during a session:
```bash
# Create alias
mcp alias add fs npx -y @modelcontextprotocol/server-filesystem /home/user
# Use alias
mcp tools fs
mcp call read_file --params '{"path": "README.md"}' fs
# List aliases
mcp alias list
# Remove when done
mcp alias remove fs
```
Aliases are stored in `~/.mcpt/aliases.json`.
## Authentication
### HTTP Basic Auth
```bash
mcp tools --auth-user "username:password" https://api.example.com/mcp
```
### Bearer Token
```bash
mcp tools --auth-header "Bearer your-token-here" https://api.example.com/mcp
```
### Environment Variables (for Docker-based servers)
```bash
mcp tools docker run -i --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN="$GITHUB_TOKEN" \
ghcr.io/github/github-mcp-server
```
## Transport Types
### Stdio (default for npx/node commands)
```bash
mcp tools npx -y @modelcontextprotocol/server-filesystem /tmp
```
### HTTP (auto-detected for http/https URLs)
```bash
mcp tools https://example.com/mcp
```
### SSE (Server-Sent Events)
```bash
mcp tools http://localhost:3001/sse
# Or explicitly:
mcp tools --transport sse http://localhost:3001
```
## Common MCP Servers
### Filesystem
```bash
# Allow access to specific directory
mcp tools npx -y @modelcontextprotocol/server-filesystem /path/to/allow
```
### Memory (Knowledge Graph)
```bash
mcp tools npx -y @modelcontextprotocol/server-memory
```
### GitHub
```bash
export GITHUB_PERSONAL_ACCESS_TOKEN="your-token"
mcp tools docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
```
### Brave Search
```bash
export BRAVE_API_KEY="your-key"
mcp tools npx -y @anthropic/mcp-server-brave-search
```
### Puppeteer (Browser Automation)
```bash
mcp tools npx -y @anthropic/mcp-server-puppeteer
```
## Best Practices
### 1. Always Discover First
Before calling tools, run `mcp tools` to understand what's available and the exact parameter schema.
### 2. Use JSON Format for Parsing
When you need to process results programmatically:
```bash
mcp call <tool> --params '{}' -f json <server> | jq '.field'
```
### 3. Validate Parameters
The table output shows parameter signatures. Match them exactly:
- `param:str` = string
- `param:num` = number
- `param:bool` = boolean
- `param:str[]` = array of strings
- `[param:str]` = optional parameter
### 4. Handle Errors Gracefully
Tool calls may fail. Check exit codes and stderr:
```bash
if ! result=$(mcp call tool --params '{}' server 2>&1); then
echo "Error: $result"
fi
```
### 5. Use Aliases for Multi-Step Operations
If making several calls to the same server:
```bash
mcp alias add tmp-server npx -y @modelcontextprotocol/server-filesystem /tmp
mcp call list_directory --params '{"path": "/tmp"}' tmp-server
mcp call read_file --params '{"path": "/tmp/file.txt"}' tmp-server
mcp alias remove tmp-server
```
### 6. Restrict Capabilities with Guard
For safety, limit what tools are accessible:
```bash
# Only allow read operations
mcp guard --allow 'tools:read_*,list_*' --deny 'tools:write_*,delete_*' \
npx -y @modelcontextprotocol/server-filesystem /home
```
## Debugging
### View Server Logs
```bash
mcp tools --server-logs <server-command>
```
### Check Alias Configuration
```bash
cat ~/.mcpt/aliases.json
```
### Verbose Output
Use `--format pretty` for detailed JSON output to debug parameter issues.
## Quick Reference
| Action | Command |
|--------|---------|
| List tools | `mcp tools <server>` |
| List resources | `mcp resources <server>` |
| List prompts | `mcp prompts <server>` |
| Call tool | `mcp call <tool> --params '<json>' <server>` |
| Read resource | `mcp read-resource <uri> <server>` |
| Get prompt | `mcp get-prompt <name> <server>` |
| Add alias | `mcp alias add <name> <server-command>` |
| Remove alias | `mcp alias remove <name>` |
| JSON output | Add `-f json` or `-f pretty` |
## Example: Complete Workflow
```bash
# 1. Discover what's available
mcp tools npx -y @modelcontextprotocol/server-filesystem /home/user/project
# 2. Check for resources
mcp resources npx -y @modelcontextprotocol/server-filesystem /home/user/project
# 3. Create alias for convenience
mcp alias add proj npx -y @modelcontextprotocol/server-filesystem /home/user/project
# 4. Explore directory structure
mcp call directory_tree --params '{"path": "/home/user/project"}' proj
# 5. Read specific files
mcp call read_file --params '{"path": "/home/user/project/README.md"}' proj
# 6. Search for patterns
mcp call search_files --params '{"path": "/home/user/project", "pattern": "**/*.ts"}' proj
# 7. Clean up alias
mcp alias remove proj
```
## Troubleshooting
### "command not found: mcp"
Ensure PATH is set: `export PATH="$HOME/.local/bin:$PATH"`
### JSON parse errors
- Escape special characters properly
- Avoid shell expansion issues by using single quotes around JSON
- For complex JSON, write to a temp file and use `--params "$(cat params.json)"`
### Server timeout
Some servers take time to start. The mcp CLI waits for initialization automatically.
### Permission denied
For filesystem server, ensure the allowed directory path is correct and accessible.