You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add non-interactive listing commands for MCP servers
This commit introduces new CLI commands that enable users to inspect MCP server capabilities without entering interactive mode, making mcp-cli more suitable for automation and scripting workflows.
## New Commands
- `mcp-cli list-tools <server-name>` - List all available tools
- `mcp-cli list-resources <server-name>` - List resources and templates
- `mcp-cli list-prompts <server-name>` - List all available prompts
- `mcp-cli list-all <server-name>` - List everything (tools, resources, prompts, capabilities)
## Features
- **Multiple server types**: Config-based, remote HTTP/SSE, and URL servers in config files
- **Output formats**: Human-readable (default), JSON (`--json`), and compact (`--compact`)
- **OAuth integration**: Seamless authentication for protected remote servers
- **Full compatibility**: All existing functionality preserved
## Code Quality Improvements
This implementation includes significant refactoring that eliminates code duplication:
- Unified `listPrimitives` function with filtering support
- Generic connection handler pattern reducing OAuth complexity
- Simplified CLI routing with helper functions
- Consistent transport factory functions
**Impact**: 137 lines eliminated, 5 duplicate functions removed, maintenance complexity significantly reduced.
## Usage Examples
```bash
# List from configured server
mcp-cli list-tools filesystem
# JSON output for automation
mcp-cli --json list-all github > capabilities.json
# Remote server inspection
mcp-cli --url http://localhost:8000/mcp list-resources
# Custom config file
mcp-cli --config ./servers.json list-prompts database
```
## Testing
Verified against multiple MCP servers including GitHub (85 tools), Puppeteer (7 tools), and various transport types. All output formats and server connection methods tested successfully.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
0 commit comments