Conversation
…ation Adds a new `smithery tools` command with three subcommands: - `smithery tools search <query>` - Fuzzy search tools by intent - `smithery tools call <connection/tool> '<args>'` - Direct tool invocation - `smithery tools list [connection]` - List connections and tools Key features: - Optimized for agent efficiency (2 steps vs 10+ steps) - Search returns full schema inline (no separate fetch needed) - Three-tier output handling: small outputs inline, large outputs written to temp file with preview (prevents JSON truncation issues) - Uses Smithery Connect API for MCP tool discovery and invocation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
cross-spawn is marked as external in the esbuild config (to avoid bundling issues), which means it must be installed at runtime. Adding it as a direct dependency fixes the "Cannot find package" error when running the built CLI. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use SDK types for Connection and ConnectionsListResponse instead of defining our own - Use SDK client for all API calls instead of direct fetch - Switch from MiniSearch to FlexSearch for consistency with rest of codebase - Remove hardcoded CONNECT_URL (SDK handles base URL) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
## Namespace Commands (cross-cutting context) - `smithery namespace list` - List available namespaces - `smithery namespace use <name>` - Set current namespace (persisted) - `smithery namespace show` - Show current namespace - `smithery namespace create <name>` - Create and claim a new namespace ## Connect Commands (server-centric) - `smithery connect add <mcp-url>` - Add an MCP server connection - `smithery connect list` - List connected servers - `smithery connect remove <id>` - Remove a server connection - `smithery connect auth <id>` - Handle OAuth for a server - `smithery connect tools [server]` - List tools - `smithery connect search <query>` - Search tools by intent - `smithery connect call <id> [args]` - Call a tool The namespace is now persisted in settings and used by all connect commands, similar to kubectl config context. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add documentation for: - Namespace commands (list, use, show, create) - Connect commands (add, list, remove, auth, tools, search, call) - Smithery Connect examples section Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create shared `createSmitheryClient()` helper in lib/smithery-client.ts that ensures consistent client configuration across all commands. The SDK automatically respects SMITHERY_BASE_URL env var for development, so all commands now properly support pointing to a local/staging API. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7ccf1d4 to
a22da1a
Compare
The Smithery SDK automatically handles SMITHERY_BASE_URL env var, so we don't need to explicitly pass baseURL. This consolidates all base URL configuration to use the SDK's built-in support. - Remove explicit baseURL passing in lib/registry.ts and deploy.ts - Update index.ts login flow to use SMITHERY_BASE_URL - Update lib/tunnel.ts to use SMITHERY_BASE_URL - Remove unused _REGISTRY_ENDPOINT from constants.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
a22da1a to
0639978
Compare
The SDK has a default base URL, so we no longer need to keep this env var dynamic at runtime. This simplifies the build configuration. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When no namespace is set and none exist, automatically create one using the SDK's namespaces.create() which generates a server-assigned name. Also persist the namespace selection to settings when falling back to the first available namespace. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove the tool count fetch when adding a server since it adds unnecessary latency and may fail if the server needs authentication. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace raw JSON-RPC calls with the MCP SDK's ergonomic Client API. Use StreamableHTTPClientTransport directly to avoid type mismatch issues with pnpm's dependency resolution. Also upgrades @modelcontextprotocol/sdk from 1.25.1 to 1.25.3. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When adding a server that requires OAuth, include the authorizationUrl in the output so users can authenticate immediately. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Introduce ConnectSession class that creates a single Smithery client and caches MCP clients by connectionId within a command execution. This avoids redundant client creation when iterating over multiple connections. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove toolCount from server listing (unnecessary overhead) - Add cursor-based pagination to listConnections() to fetch all pages - Remove unused legacy wrapper functions from api.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduce README from 240 to 85 lines while preserving all key information. Group commands logically, remove redundant flag descriptions, and streamline examples to show practical workflows. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Trigger on push to main instead of tags - Auto-detect version bump from commit message: - feat!: or BREAKING CHANGE → major - feat: → minor - everything else → patch - Skip release commits to prevent infinite loops - Bot commits version bump with tag and pushes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- If PR title contains explicit version (e.g., "v3.8.0"), use it - Otherwise default to patch bump - Developers can edit PR title before merge to control version Examples: - "feat: add namespace commands v3.8.0" → 3.8.0 - "fix: typo" → patch bump (3.7.1) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Only PRs with title "release: X.Y.Z" will trigger a publish. Non-release PRs are merged without publishing. To release: 1. Create PR with title "release: 3.8.0" 2. Merge to main 3. CI bumps version, tags v3.8.0, publishes to npm Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove `connect auth` command (auth URL shown on `connect add`) - Skip `listConnections()` when operating on specific server ID - Remove redundant wrapper functions (createRegistry, createSDKOptions) - Let SDK handle API key and base URL from env vars - Remove unused types (StreamableHTTPDeploymentConnection, ValidationResponse) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace MCP SDK client with direct HTTP POST for tools/list - Skip protocol handshake overhead - Add 5s timeout per connection to fail fast on broken servers Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SMITHERY_BASE_URL is for the API (api.smithery.ai) SMITHERY_URL is for the website auth flow (smithery.ai) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add required Accept header for MCP endpoint - Increase timeout from 5s to 30s (API is slow on cold start) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Author
Merge activity
|
Comment on lines
+111
to
+121
| }, | ||
| body: JSON.stringify({ | ||
| jsonrpc: "2.0", | ||
| id: 1, | ||
| method: "tools/list", | ||
| params: {}, | ||
| }), | ||
| signal: controller.signal, | ||
| }) | ||
|
|
||
| clearTimeout(timeout) |
There was a problem hiding this comment.
Bug: If fetch() fails due to a network error, the corresponding clearTimeout() is not called, causing a timer leak that can delay process exit.
Severity: MEDIUM
Suggested Fix
Move the clearTimeout(timeout) call into a finally block associated with the try...catch. This will guarantee that the timeout is cleared whether the fetch operation succeeds or fails.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/commands/connect/api.ts#L103-L121
Potential issue: In the `listToolsForConnection` function, a `setTimeout` is used to
create a 30-second timeout for a `fetch` request. If the `fetch` call throws an error,
such as a network failure, the code jumps to the `catch` block, skipping the
`clearTimeout()` call. This causes a resource leak, as the timer remains active in the
event loop. When listing tools from multiple connections, each failed connection will
leave a timer running, which can delay the CLI process from exiting for up to 30 seconds
per failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
smithery namespaceandsmithery connectcommands for managing cloud-hosted MCP servers via Smithery Connect.Namespace commands - Kubernetes-style context management
namespace list/use/show/create- Set and persist namespace contextConnect commands - Manage MCP server connections
connect add/remove/list/auth- Server lifecycle managementconnect tools/search/call- Tool discovery and invocationKey Features
ConnectSessioncaches Smithery and MCP clients within a command@modelcontextprotocol/sdkClient API instead of raw JSON-RPCTest plan
pnpm build- Builds successfullypnpm test- All 262 tests pass🤖 Generated with Claude Code