@a1st/mcp-registry-client 0.0.6 → 0.1.0
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.
- package/README.md +29 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,12 +11,12 @@ npm install @a1st/mcp-registry-client
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { McpRegistryClient } from
|
|
14
|
+
import { McpRegistryClient } from "@a1st/mcp-registry-client";
|
|
15
15
|
|
|
16
16
|
const client = new McpRegistryClient();
|
|
17
17
|
|
|
18
18
|
// Search for servers
|
|
19
|
-
const results = await client.search(
|
|
19
|
+
const results = await client.search("playwright");
|
|
20
20
|
console.log(results.servers);
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -28,8 +28,8 @@ Create a new client instance.
|
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
30
|
const client = new McpRegistryClient({
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
baseUrl: "https://registry.modelcontextprotocol.io", // default
|
|
32
|
+
fetch: customFetch, // optional custom fetch implementation
|
|
33
33
|
});
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -38,7 +38,7 @@ const client = new McpRegistryClient({
|
|
|
38
38
|
Search for servers by name. Returns latest versions by default.
|
|
39
39
|
|
|
40
40
|
```typescript
|
|
41
|
-
const results = await client.search(
|
|
41
|
+
const results = await client.search("github");
|
|
42
42
|
// { servers: [...], metadata: { count: 5, nextCursor: '...' } }
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -48,9 +48,9 @@ List servers with optional filtering and pagination.
|
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
50
|
const results = await client.list({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
limit: 10,
|
|
52
|
+
version: "latest",
|
|
53
|
+
updatedSince: "2024-01-01T00:00:00Z",
|
|
54
54
|
});
|
|
55
55
|
```
|
|
56
56
|
|
|
@@ -59,10 +59,10 @@ const results = await client.list({
|
|
|
59
59
|
Get a specific server by name. Defaults to latest version.
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
|
-
const server = await client.getServer(
|
|
63
|
-
console.log(server.server.name);
|
|
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
64
|
console.log(server.server.description); // 'GitHub API integration'
|
|
65
|
-
console.log(server.server.packages);
|
|
65
|
+
console.log(server.server.packages); // Package configurations
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
### `client.getServerVersions(name)`
|
|
@@ -70,9 +70,9 @@ console.log(server.server.packages); // Package configurations
|
|
|
70
70
|
Get all versions of a server.
|
|
71
71
|
|
|
72
72
|
```typescript
|
|
73
|
-
const versions = await client.getServerVersions(
|
|
73
|
+
const versions = await client.getServerVersions("io.github.anthropics/mcp-server-github");
|
|
74
74
|
for (const entry of versions.servers ?? []) {
|
|
75
|
-
|
|
75
|
+
console.log(entry.server.version);
|
|
76
76
|
}
|
|
77
77
|
```
|
|
78
78
|
|
|
@@ -81,8 +81,8 @@ for (const entry of versions.servers ?? []) {
|
|
|
81
81
|
Async generator that handles pagination automatically.
|
|
82
82
|
|
|
83
83
|
```typescript
|
|
84
|
-
for await (const server of client.listAll({ version:
|
|
85
|
-
|
|
84
|
+
for await (const server of client.listAll({ version: "latest" })) {
|
|
85
|
+
console.log(server.server.name);
|
|
86
86
|
}
|
|
87
87
|
```
|
|
88
88
|
|
|
@@ -92,13 +92,13 @@ The package exports full TypeScript types for the MCP Registry API:
|
|
|
92
92
|
|
|
93
93
|
```typescript
|
|
94
94
|
import type {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
} from
|
|
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
102
|
```
|
|
103
103
|
|
|
104
104
|
## Error Handling
|
|
@@ -106,16 +106,16 @@ import type {
|
|
|
106
106
|
The client throws `McpRegistryError` for API errors:
|
|
107
107
|
|
|
108
108
|
```typescript
|
|
109
|
-
import { McpRegistryClient, McpRegistryError } from
|
|
109
|
+
import { McpRegistryClient, McpRegistryError } from "@a1st/mcp-registry-client";
|
|
110
110
|
|
|
111
111
|
try {
|
|
112
|
-
|
|
112
|
+
await client.getServer("nonexistent/server");
|
|
113
113
|
} catch (error) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
119
|
}
|
|
120
120
|
```
|
|
121
121
|
|