Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
cdbddd4
feat: add `smithery tools` command for agent-optimized MCP tool invoc…
calclavia Feb 3, 2026
2a233c8
fix: add cross-spawn as direct dependency
calclavia Feb 3, 2026
a056aac
refactor: use SDK types and switch to FlexSearch
calclavia Feb 3, 2026
e08ed2b
feat: add namespace commands and rename tools to connect
calclavia Feb 3, 2026
1dd162d
docs: update README with namespace and connect commands
calclavia Feb 3, 2026
b588d6c
refactor: centralize Smithery client creation
calclavia Feb 3, 2026
0639978
refactor: replace REGISTRY_ENDPOINT with SMITHERY_BASE_URL
calclavia Feb 3, 2026
a3bb774
chore: remove SMITHERY_BASE_URL from build exclusions
calclavia Feb 3, 2026
cd7ad39
feat: auto-create default namespace when none exist
calclavia Feb 3, 2026
bd866a5
refactor: remove tool listing from server add
calclavia Feb 3, 2026
f06cc30
refactor: use MCP SDK Client for tool operations
calclavia Feb 3, 2026
0ba6355
feat: show auth URL when connection requires authorization
calclavia Feb 3, 2026
01e4558
refactor: reuse clients within commands via ConnectSession
calclavia Feb 3, 2026
b13e982
refactor: remove toolCount from list, add pagination support
calclavia Feb 3, 2026
2b740e8
docs: simplify README for clarity
calclavia Feb 3, 2026
7007c29
ci: auto-bump and publish on merge to main
calclavia Feb 3, 2026
44ed35f
ci: use PR title for version control
calclavia Feb 3, 2026
75169b6
ci: use release: prefix for explicit releases
calclavia Feb 3, 2026
600d68c
refactor: simplify CLI by removing redundant code and API calls
calclavia Feb 3, 2026
1b43374
perf: optimize tool listing with direct HTTP and timeout
calclavia Feb 3, 2026
a8d0f02
fix: use correct env var for CLI auth endpoint
calclavia Feb 3, 2026
e24dedc
fix: add Accept header and increase timeout for tool listing
calclavia Feb 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Release

on:
push:
tags:
- v*
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -41,19 +41,22 @@ jobs:
- run: pnpm run build
env:
ANALYTICS_ENDPOINT: ${{ secrets.ANALYTICS_ENDPOINT }}
REGISTRY_ENDPOINT: ${{ secrets.REGISTRY_ENDPOINT }}
- run: pnpm run check

publish:
runs-on: ubuntu-latest
needs: [test, build]

permissions:
contents: read
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
Expand All @@ -62,8 +65,45 @@ jobs:
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
- run: npm publish --provenance --access public

- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Check for release
id: check
run: |
# PR title is the commit message (squash merge uses PR_TITLE)
COMMIT_MSG=$(git log -1 --pretty=%B)
echo "Commit message: $COMMIT_MSG"

# Only release if PR title starts with "release: X.Y.Z"
if echo "$COMMIT_MSG" | grep -qE "^release: [0-9]+\.[0-9]+\.[0-9]+"; then
VERSION=$(echo "$COMMIT_MSG" | grep -oE "^release: [0-9]+\.[0-9]+\.[0-9]+" | sed 's/release: //')
echo "Release detected: $VERSION"
echo "should_release=true" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "Not a release PR, skipping publish"
echo "should_release=false" >> $GITHUB_OUTPUT
fi

- name: Bump version and tag
if: steps.check.outputs.should_release == 'true'
run: |
VERSION=${{ steps.check.outputs.version }}
echo "Setting version to $VERSION"

npm version "$VERSION" --no-git-tag-version --allow-same-version
git add package.json
git commit -m "chore: release v$VERSION [skip ci]"
git tag "v$VERSION"
git push && git push --tags

- name: Publish to npm
if: steps.check.outputs.should_release == 'true'
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
ANALYTICS_ENDPOINT: ${{ secrets.ANALYTICS_ENDPOINT }}
REGISTRY_ENDPOINT: ${{ secrets.REGISTRY_ENDPOINT }}
186 changes: 50 additions & 136 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,170 +1,84 @@
# Smithery CLI [![NPM Version](https://img.shields.io/npm/v/%40smithery%2Fcli)](https://www.npmjs.com/package/@smithery/cli) [![NPM Downloads](https://img.shields.io/npm/dt/%40smithery%2Fcli)](https://www.npmjs.com/package/@smithery/cli)

The Smithery registry installer and manager for Model Context Protocol (MCP) servers, designed to be client-agnostic.

## Requirements
- NodeJS version 20 or above
CLI for installing MCP servers and managing cloud connections via [Smithery](https://smithery.ai).

## Installation

Install globally for easier usage:

```bash
npm install -g @smithery/cli
```

## Usage
Requires Node.js 20+.

```bash
smithery <command>
```
## Commands

Or run directly without installation:
### Local Server Management

```bash
npx @smithery/cli <command>
smithery install <server> # Install a server to an AI client
smithery uninstall <server> # Remove a server
smithery list # List installed servers
smithery search [term] # Search the Smithery registry
smithery inspect <server> # Interactive server testing
smithery run <server> # Run a server locally
```

### Available Commands

- `install <server>` - Install a server (interactive client selection)
- `--client <name>` - Specify the AI client (skips selection)
- `--config <json>` - Provide configuration data as JSON (skips prompts)
- `uninstall <server>` - Uninstall a server (interactive client selection)
- `--client <name>` - Specify the AI client (skips selection)
- `inspect <server-id>` - Inspect a server interactively
- `run <server-id>` - Run a server
- `--config <json>` - Provide configuration for the server
- `list` - List installed servers (interactive client selection)
- `--client <name>` - Specify the AI client (skips selection)
- `search [term]` - Search for servers in the Smithery registry (interactive)
- `login` - Login with an API key (interactive)
- `dev [entryFile]` - Start development server with hot-reload and tunnel
- `--port <port>` - Port to run the server on (default: 8081)
- `--key <apikey>` - Provide an API key
- `--no-open` - Don't automatically open the playground
- `--prompt <prompt>` - Initial message to start the playground with
- `-c, --config <path>` - Path to config file (default: auto-detect smithery.config.js)
- `build [entryFile]` - Build MCP server for production
- `-o, --out <outfile>` - Output file path (default: .smithery/index.cjs)
- `--transport <type>` - Transport type: shttp or stdio (default: shttp)
- `-c, --config <path>` - Path to config file (default: auto-detect smithery.config.js)
- `playground` - Open MCP playground in browser
- `--port <port>` - Port to expose (default: 8081)
- `--key <apikey>` - Provide an API key
- Can pass command after `--` separator
- `--help` - Show help message
- `--verbose` - Show detailed logs for debugging

### Examples

```bash
# Install a server (interactive client selection)
smithery install exa

# Install a server for specific client (skips selection)
smithery install exa --client claude

# Install a server with pre-configured data (skips prompts)
smithery install exa --client claude --config '{"exaApiKey":"you_api_key"}'
Options: `--client <name>` to skip client selection, `--config <json>` to provide configuration.

# Remove a server (interactive client selection)
smithery uninstall exa
### Smithery Connect (Cloud MCP)

# Remove a server from specific client (skips selection)
smithery uninstall exa --client claude
Manage cloud-hosted MCP servers via [Smithery Connect](https://smithery.ai).

# List installed servers (interactive)
smithery list

# List installed servers for claude
smithery list --client claude
```bash
# Namespace context (auto-created on first use)
smithery namespace list # List namespaces
smithery namespace use <name> # Set current namespace
smithery namespace show # Show current namespace

# Server connections
smithery connect add <url> # Add MCP server (--name for display name)
smithery connect list # List connected servers
smithery connect remove <id> # Remove a connection

# Tools
smithery connect tools [server] # List tools (all or for specific server)
smithery connect search <query> # Fuzzy search tools by intent
smithery connect call <id> [args] # Call a tool (format: server/tool-name)
```

# Search for servers in the registry
smithery search "web search"
### Development

# Search interactively (prompts for term)
smithery search
```bash
smithery login # Set API key
smithery dev [entry] # Dev server with hot-reload and tunnel
smithery build [entry] # Build for production
smithery playground # Open interactive testing UI
```

# Inspect a specific server from smithery's registry
smithery inspect exa
## Examples

# Run a server with configuration
smithery run exa --config '{"key":"value"}'
```bash
# Install a server
smithery install exa --client claude --config '{"exaApiKey":"xxx"}'

# Login and set API key
smithery login
# Cloud MCP workflow
smithery connect add https://server.smithery.ai/github
smithery connect search "create issue"
smithery connect call github/create_issue '{"title":"Bug fix","body":"..."}'

# Start development server with hot-reload
smithery dev
# Development
smithery dev server.ts --port 3000

# Build server for production
smithery build
smithery build server.ts --out dist/server.cjs --transport stdio

# Open playground in browser
smithery playground
smithery playground --port 3001 -- node dist/server.js

# Show help menu
smithery --help

# Install with verbose logging for debugging
smithery install mcp-obsidian --client claude --verbose
smithery build --out dist/server.cjs
```

### Important Notes

- Use `login` command to set your Smithery API key (required for some operations)
- Remember to restart your AI client after installing or uninstalling servers
- Use the `inspect` command for interactive server testing
- Run without arguments to see the help menu
- Use `--verbose` flag for detailed logs when troubleshooting
- The `dev` command provides hot-reload for MCP server development
- Use `playground` to test your MCP servers in an interactive web interface

## Development

This guide will help you get started with developing for @smithery/cli.

### Getting Started

1. Clone the repository:
```bash
git clone https://github.com/smithery-ai/cli
cd cli
```

2. Install dependencies:
```bash
npm install
```

3. Build the project:
```bash
npm run build
```

### Development Commands

```bash
# List installed servers
npx . list --client claude

# Search for servers
npx . search obsidian

# Inspect a specific server
npx . inspect <server-id>

# Install a server
npx . install <server-name> --client <client-name>

# Run with verbose logging
npx . <command> --verbose
git clone https://github.com/smithery-ai/cli
cd cli && npm install && npm run build
npx . --help
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
Contributions welcome! Please submit a Pull Request.
1 change: 0 additions & 1 deletion build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ for (const k in process.env) {
"USER",
"XDG_CONFIG_HOME",
"SMITHERY_BEARER_AUTH",
"REGISTRY_ENDPOINT",
"ANALYTICS_ENDPOINT",
].includes(k)
)
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@
},
"dependencies": {
"@anthropic-ai/mcpb": "^1.1.1",
"@modelcontextprotocol/sdk": "^1.25.1",
"@modelcontextprotocol/sdk": "^1.25.3",
"@ngrok/ngrok": "^1.5.1",
"@smithery/api": "0.31.0",
"chalk": "^4.1.2",
"cli-spinners": "^3.3.0",
"commander": "^14.0.0",
"cors": "^2.8.5",
"cross-fetch": "^4.1.0",
"cross-spawn": "^7.0.6",
"esbuild": "^0.25.10",
"express": "^5.1.0",
"fast-glob": "^3.3.3",
"flexsearch": "^0.7.43",
"inquirer": "^8.2.4",
"inquirer-autocomplete-prompt": "^2.0.0",
"jsonc-parser": "^3.3.1",
Expand Down
Loading