Implementation:1mcp app Agent searchCommand
| Knowledge Sources | |
|---|---|
| Domains | CLI, MCP_Protocol |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete CLI command for searching the MCP server registry by query, status, package type, and transport with paginated, formatted output.
Description
The searchCommand function queries the MCP server registry for servers matching a search query. It supports filtering by status (active, archived, deprecated), package registry type (npm, pypi, docker), and transport type (stdio, sse, http). Results are paginated via cursor and output in table, list, or JSON format. The command delegates to `handleSearchMCPServers` for the actual registry API call and uses formatters for display.
Usage
Import this function when you need to:
- Discover available MCP servers from the registry before installation
- Filter servers by package type, transport, or lifecycle status
- Paginate through large result sets with cursor-based pagination
- Output search results in machine-readable (JSON) or human-readable (table/list) format
Code Reference
Source Location
- Repository: 1MCP Agent
- File: src/commands/registry/search.ts (L38-91)
Signature
export interface SearchCommandArgs extends Arguments, GlobalOptions, RegistryYargsOptions {
query?: string;
status?: 'active' | 'archived' | 'deprecated' | 'all';
type?: 'npm' | 'pypi' | 'docker';
transport?: 'stdio' | 'sse' | 'http';
limit?: number;
cursor?: string;
format?: 'table' | 'list' | 'json';
}
export function buildSearchCommand(searchYargs: Argv): Argv;
export async function searchCommand(argv: SearchCommandArgs): Promise<void>;
Import
import { searchCommand, buildSearchCommand, SearchCommandArgs } from '@src/commands/registry/search.js';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| query | string | No | Search query matching server names and descriptions |
| status | 'archived' | 'deprecated' | 'all' | No | Filter by status (default: active) |
| type | 'pypi' | 'docker' | No | Filter by package registry |
| transport | 'sse' | 'http' | No | Filter by transport method |
| limit | number | No | Max results (default: 20) |
| cursor | string | No | Pagination cursor |
| format | 'list' | 'json' | No | Output format (default: table) |
Outputs
| Name | Type | Description |
|---|---|---|
| stdout | formatted text | Search results printed to stdout |
Usage Examples
Basic Search
import { searchCommand } from '@src/commands/registry/search.js';
await searchCommand({
query: 'file system',
status: 'active',
format: 'table',
// ...global options
});
JSON Output for Scripting
1mcp registry search "database" --format=json --limit=10