@a1st/mcp-registry-client 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +136 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,136 @@
1
+ # @a1st/mcp-registry-client
2
+
3
+ TypeScript client for the [official MCP Registry API](https://registry.modelcontextprotocol.io).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @a1st/mcp-registry-client
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { McpRegistryClient } from '@a1st/mcp-registry-client';
15
+
16
+ const client = new McpRegistryClient();
17
+
18
+ // Search for servers
19
+ const results = await client.search('playwright');
20
+ console.log(results.servers);
21
+ ```
22
+
23
+ ## API
24
+
25
+ ### `new McpRegistryClient(options?)`
26
+
27
+ Create a new client instance.
28
+
29
+ ```typescript
30
+ const client = new McpRegistryClient({
31
+ baseUrl: 'https://registry.modelcontextprotocol.io', // default
32
+ fetch: customFetch, // optional custom fetch implementation
33
+ });
34
+ ```
35
+
36
+ ### `client.search(query, options?)`
37
+
38
+ Search for servers by name. Returns latest versions by default.
39
+
40
+ ```typescript
41
+ const results = await client.search('github');
42
+ // { servers: [...], metadata: { count: 5, nextCursor: '...' } }
43
+ ```
44
+
45
+ ### `client.list(options?)`
46
+
47
+ List servers with optional filtering and pagination.
48
+
49
+ ```typescript
50
+ const results = await client.list({
51
+ limit: 10,
52
+ version: 'latest',
53
+ updatedSince: '2024-01-01T00:00:00Z',
54
+ });
55
+ ```
56
+
57
+ ### `client.getServer(name, version?)`
58
+
59
+ Get a specific server by name. Defaults to latest version.
60
+
61
+ ```typescript
62
+ const server = await client.getServer('io.github.anthropics/mcp-server-github');
63
+ console.log(server.server.name); // 'io.github.anthropics/mcp-server-github'
64
+ console.log(server.server.description); // 'GitHub API integration'
65
+ console.log(server.server.packages); // Package configurations
66
+ ```
67
+
68
+ ### `client.getServerVersions(name)`
69
+
70
+ Get all versions of a server.
71
+
72
+ ```typescript
73
+ const versions = await client.getServerVersions('io.github.anthropics/mcp-server-github');
74
+ for (const entry of versions.servers ?? []) {
75
+ console.log(entry.server.version);
76
+ }
77
+ ```
78
+
79
+ ### `client.listAll(options?)`
80
+
81
+ Async generator that handles pagination automatically.
82
+
83
+ ```typescript
84
+ for await (const server of client.listAll({ version: 'latest' })) {
85
+ console.log(server.server.name);
86
+ }
87
+ ```
88
+
89
+ ## Types
90
+
91
+ The package exports full TypeScript types for the MCP Registry API:
92
+
93
+ ```typescript
94
+ import type {
95
+ ServerJSON, // Server configuration
96
+ ServerResponse, // Server + registry metadata
97
+ ServerListResponse, // Paginated list response
98
+ Package, // Package configuration (npm, pypi, etc.)
99
+ Transport, // Transport config (stdio, http, sse)
100
+ ListServersOptions, // Options for list/search
101
+ } from '@a1st/mcp-registry-client';
102
+ ```
103
+
104
+ ## Error Handling
105
+
106
+ The client throws `McpRegistryError` for API errors:
107
+
108
+ ```typescript
109
+ import { McpRegistryClient, McpRegistryError } from '@a1st/mcp-registry-client';
110
+
111
+ try {
112
+ await client.getServer('nonexistent/server');
113
+ } catch (error) {
114
+ if (error instanceof McpRegistryError) {
115
+ console.log(error.status); // HTTP status code
116
+ console.log(error.message); // Error message
117
+ console.log(error.response); // Full error response (if available)
118
+ }
119
+ }
120
+ ```
121
+
122
+ ## Usage in aix
123
+
124
+ This package is used by the [aix CLI](https://github.com/a1st-dev/aix/blob/main/README.md)
125
+ to power `aix search` and `aix add mcp` commands. When you run:
126
+
127
+ ```bash
128
+ aix search playwright
129
+ aix add mcp github
130
+ ```
131
+
132
+ The CLI uses this client to query the MCP Registry and fetch server configurations.
133
+
134
+ ## License
135
+
136
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a1st/mcp-registry-client",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "TypeScript client for the official MCP Registry API",
5
5
  "keywords": [
6
6
  "api-client",