|
| 1 | +--- |
| 2 | +title: "Smithery CLI" |
| 3 | +description: "You can use the Smithery CLI to install MCP servers from the registry or debug your MCP servers in the Smithery playground" |
| 4 | +--- |
| 5 | + |
| 6 | +<Card |
| 7 | + title="View the Smithery CLI on GitHub" |
| 8 | + icon="github" |
| 9 | + href="https://github.com/smithery-ai/cli" |
| 10 | +> |
| 11 | + The Smithery CLI is a registry installer and manager for Model Context |
| 12 | + Protocol (MCP) servers, designed to be client-agnostic. |
| 13 | +</Card> |
| 14 | + |
| 15 | +The Smithery CLI is really helpful for debugging your MCP servers. You can use it to: |
| 16 | + |
| 17 | +- Install MCP servers from the registry |
| 18 | +- Debug your MCP servers in the Smithery playground |
| 19 | +- Build your MCP servers for production |
| 20 | + |
| 21 | +## Examples |
| 22 | + |
| 23 | +```bash |
| 24 | +# Show the help menu |
| 25 | +npx @smithery/cli --help |
| 26 | + |
| 27 | +# Add the exa MCP server to Cursor |
| 28 | +npx -y @smithery/cli@latest install exa --client cursor --profile your-profile-123456 --key $SMITHERY_API_KEY |
| 29 | + |
| 30 | +# Run a local MCP server running on port 3000 in the Smithery playground |
| 31 | +npx @smithery/cli@latest playground --port 3000 --key $SMITHERY_API_KEY |
| 32 | +``` |
| 33 | + |
| 34 | +## Reference |
| 35 | + |
| 36 | +```bash |
| 37 | +npx @smithery/cli <command> |
| 38 | +``` |
| 39 | + |
| 40 | +### Available Commands |
| 41 | + |
| 42 | +- `install <package>` - Install a package |
| 43 | + - `--client <name>` - Specify the AI client |
| 44 | + - `--config <json>` - Provide configuration data as JSON (skips prompts) |
| 45 | +- `uninstall <package>` - Uninstall a package |
| 46 | + - `--client <name>` - Specify the AI client |
| 47 | +- `inspect <server-id>` - Inspect a server interactively |
| 48 | +- `run <server-id>` - Run a server |
| 49 | + - `--config <json>` - Provide configuration for the server |
| 50 | +- `list clients` - List available clients |
| 51 | +- `list servers --client <name>` - List installed servers for specific AI client |
| 52 | +- `login` - Login with an API key (interactive) |
| 53 | +- `dev [entryFile]` - Start development server with hot-reload and tunnel |
| 54 | + - `--port <port>` - Port to run the server on (default: 8181) |
| 55 | + - `--key <apikey>` - Provide an API key |
| 56 | + - `--no-open` - Don't automatically open the playground |
| 57 | + - `--prompt <prompt>` - Initial message to start the playground with |
| 58 | + - `-c, --config <path>` - Path to config file (default: auto-detect smithery.config.js) |
| 59 | +- `build [entryFile]` - Build MCP server for production |
| 60 | + - `-o, --out <outfile>` - Output file path (default: .smithery/index.cjs) |
| 61 | + - `--transport <type>` - Transport type: shttp or stdio (default: shttp) |
| 62 | + - `-c, --config <path>` - Path to config file (default: auto-detect smithery.config.js) |
| 63 | +- `playground` - Open MCP playground in browser |
| 64 | + - `--port <port>` - Port to expose (default: 3000) |
| 65 | + - `--key <apikey>` - Provide an API key |
| 66 | + - Can pass command after `--` separator |
| 67 | +- `--help` - Show help message |
| 68 | +- `--verbose` - Show detailed logs for debugging |
| 69 | + |
| 70 | +### Examples |
| 71 | + |
| 72 | +```bash |
| 73 | +# Install a server (requires --client flag) |
| 74 | +npx @smithery/cli install mcp-obsidian --client claude |
| 75 | + |
| 76 | +# Install a server with pre-configured data (skips prompts) |
| 77 | +npx @smithery/cli install mcp-obsidian --client claude --config '{"vaultPath":"path/to/vault"}' |
| 78 | + |
| 79 | +# Remove a server |
| 80 | +npx @smithery/cli uninstall mcp-obsidian --client claude |
| 81 | + |
| 82 | +# List available clients |
| 83 | +npx @smithery/cli list clients |
| 84 | + |
| 85 | +# List installed servers for claude |
| 86 | +npx @smithery/cli list servers --client claude |
| 87 | + |
| 88 | +# Inspect a specific server from smithery's registry |
| 89 | +npx @smithery/cli inspect mcp-obsidian |
| 90 | + |
| 91 | +# Run a server with configuration |
| 92 | +npx @smithery/cli run mcp-obsidian --config '{"key":"value"}' |
| 93 | + |
| 94 | +# Login and set API key |
| 95 | +npx @smithery/cli login |
| 96 | + |
| 97 | +# Start development server with hot-reload |
| 98 | +npx @smithery/cli dev |
| 99 | +npx @smithery/cli dev server.ts --port 3000 |
| 100 | + |
| 101 | +# Build server for production |
| 102 | +npx @smithery/cli build |
| 103 | +npx @smithery/cli build server.ts --out dist/server.cjs --transport stdio |
| 104 | + |
| 105 | +# Open playground in browser |
| 106 | +npx @smithery/cli playground |
| 107 | +npx @smithery/cli playground --port 3001 -- node dist/server.js |
| 108 | + |
| 109 | +# Show help menu |
| 110 | +npx @smithery/cli --help |
| 111 | + |
| 112 | +# Install with verbose logging for debugging |
| 113 | +npx @smithery/cli install mcp-obsidian --client claude --verbose |
| 114 | +``` |
| 115 | + |
| 116 | +### Important Notes |
| 117 | + |
| 118 | +- Use `login` command to set your Smithery API key (required for some operations) |
| 119 | +- Remember to restart your AI client after installing or uninstalling servers |
| 120 | +- Use the `inspect` command for interactive server testing |
| 121 | +- Run without arguments to see the help menu |
| 122 | +- Use `--verbose` flag for detailed logs when troubleshooting |
| 123 | +- The `dev` command provides hot-reload for MCP server development |
| 124 | +- Use `playground` to test your MCP servers in an interactive web interface |
0 commit comments