@1mcp/agent 0.25.5 → 0.26.1
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/build/auth/sdkOAuthClientProvider.d.ts.map +1 -1
- package/build/auth/sdkOAuthClientProvider.js +3 -5
- package/build/auth/sdkOAuthClientProvider.js.map +1 -1
- package/build/auth/sessionTypes.d.ts +10 -0
- package/build/auth/sessionTypes.d.ts.map +1 -1
- package/build/auth/storage/fileStorageService.d.ts +25 -1
- package/build/auth/storage/fileStorageService.d.ts.map +1 -1
- package/build/auth/storage/fileStorageService.js +155 -27
- package/build/auth/storage/fileStorageService.js.map +1 -1
- package/build/auth/storage/oauthStorageService.js +1 -1
- package/build/auth/storage/oauthStorageService.js.map +1 -1
- package/build/commands/mcp/index.d.ts.map +1 -1
- package/build/commands/mcp/index.js +3 -2
- package/build/commands/mcp/index.js.map +1 -1
- package/build/commands/registry/index.d.ts +6 -0
- package/build/commands/registry/index.d.ts.map +1 -0
- package/build/commands/registry/index.js +67 -0
- package/build/commands/registry/index.js.map +1 -0
- package/build/commands/registry/options.d.ts +47 -0
- package/build/commands/registry/options.d.ts.map +1 -0
- package/build/commands/registry/options.js +39 -0
- package/build/commands/registry/options.js.map +1 -0
- package/build/commands/registry/search.d.ts +21 -0
- package/build/commands/registry/search.d.ts.map +1 -0
- package/build/commands/registry/search.js +186 -0
- package/build/commands/registry/search.js.map +1 -0
- package/build/commands/registry/show.d.ts +25 -0
- package/build/commands/registry/show.d.ts.map +1 -0
- package/build/commands/registry/show.js +87 -0
- package/build/commands/registry/show.js.map +1 -0
- package/build/commands/registry/status.d.ts +16 -0
- package/build/commands/registry/status.d.ts.map +1 -0
- package/build/commands/registry/status.js +86 -0
- package/build/commands/registry/status.js.map +1 -0
- package/build/commands/registry/versions.d.ts +21 -0
- package/build/commands/registry/versions.d.ts.map +1 -0
- package/build/commands/registry/versions.js +76 -0
- package/build/commands/registry/versions.js.map +1 -0
- package/build/constants/auth.d.ts +27 -0
- package/build/constants/auth.d.ts.map +1 -1
- package/build/constants/auth.js +31 -0
- package/build/constants/auth.js.map +1 -1
- package/build/constants/mcp.d.ts +1 -1
- package/build/constants/mcp.js +1 -1
- package/build/core/tools/handlers/registryHandler.d.ts +11 -0
- package/build/core/tools/handlers/registryHandler.d.ts.map +1 -0
- package/build/core/tools/handlers/registryHandler.js +49 -0
- package/build/core/tools/handlers/registryHandler.js.map +1 -0
- package/build/core/tools/handlers/searchHandler.d.ts +19 -0
- package/build/core/tools/handlers/searchHandler.d.ts.map +1 -0
- package/build/core/tools/handlers/searchHandler.js +104 -0
- package/build/core/tools/handlers/searchHandler.js.map +1 -0
- package/build/core/tools/handlers/showHandler.d.ts +10 -0
- package/build/core/tools/handlers/showHandler.d.ts.map +1 -0
- package/build/core/tools/handlers/showHandler.js +44 -0
- package/build/core/tools/handlers/showHandler.js.map +1 -0
- package/build/core/tools/handlers/versionsHandler.d.ts +10 -0
- package/build/core/tools/handlers/versionsHandler.d.ts.map +1 -0
- package/build/core/tools/handlers/versionsHandler.js +44 -0
- package/build/core/tools/handlers/versionsHandler.js.map +1 -0
- package/build/domains/preset/manager/presetManager.d.ts.map +1 -1
- package/build/domains/preset/manager/presetManager.js +2 -2
- package/build/domains/preset/manager/presetManager.js.map +1 -1
- package/build/domains/registry/cacheManager.d.ts +61 -0
- package/build/domains/registry/cacheManager.d.ts.map +1 -0
- package/build/domains/registry/cacheManager.js +158 -0
- package/build/domains/registry/cacheManager.js.map +1 -0
- package/build/domains/registry/formatters/commonFormatters.d.ts +34 -0
- package/build/domains/registry/formatters/commonFormatters.d.ts.map +1 -0
- package/build/domains/registry/formatters/commonFormatters.js +154 -0
- package/build/domains/registry/formatters/commonFormatters.js.map +1 -0
- package/build/domains/registry/formatters/serverDetailFormatter.d.ts +6 -0
- package/build/domains/registry/formatters/serverDetailFormatter.d.ts.map +1 -0
- package/build/domains/registry/formatters/serverDetailFormatter.js +310 -0
- package/build/domains/registry/formatters/serverDetailFormatter.js.map +1 -0
- package/build/domains/registry/formatters/versionsFormatter.d.ts +6 -0
- package/build/domains/registry/formatters/versionsFormatter.d.ts.map +1 -0
- package/build/domains/registry/formatters/versionsFormatter.js +84 -0
- package/build/domains/registry/formatters/versionsFormatter.js.map +1 -0
- package/build/domains/registry/mcpRegistryClient.d.ts +101 -0
- package/build/domains/registry/mcpRegistryClient.d.ts.map +1 -0
- package/build/domains/registry/mcpRegistryClient.js +464 -0
- package/build/domains/registry/mcpRegistryClient.js.map +1 -0
- package/build/domains/registry/mcpToolSchemas.d.ts +63 -0
- package/build/domains/registry/mcpToolSchemas.d.ts.map +1 -0
- package/build/domains/registry/mcpToolSchemas.js +52 -0
- package/build/domains/registry/mcpToolSchemas.js.map +1 -0
- package/build/domains/registry/searchFiltering.d.ts +48 -0
- package/build/domains/registry/searchFiltering.d.ts.map +1 -0
- package/build/domains/registry/searchFiltering.js +201 -0
- package/build/domains/registry/searchFiltering.js.map +1 -0
- package/build/domains/registry/types.d.ts +204 -0
- package/build/domains/registry/types.d.ts.map +1 -0
- package/build/domains/registry/types.js +5 -0
- package/build/domains/registry/types.js.map +1 -0
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/transport/http/restorableStreamableTransport.d.ts +52 -0
- package/build/transport/http/restorableStreamableTransport.d.ts.map +1 -0
- package/build/transport/http/restorableStreamableTransport.js +68 -0
- package/build/transport/http/restorableStreamableTransport.js.map +1 -0
- package/build/transport/http/routes/streamableHttpRoutes.d.ts +2 -1
- package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.js +113 -30
- package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
- package/build/transport/http/server.d.ts +2 -0
- package/build/transport/http/server.d.ts.map +1 -1
- package/build/transport/http/server.js +10 -2
- package/build/transport/http/server.js.map +1 -1
- package/build/transport/http/storage/streamableSessionRepository.d.ts +57 -0
- package/build/transport/http/storage/streamableSessionRepository.d.ts.map +1 -0
- package/build/transport/http/storage/streamableSessionRepository.js +156 -0
- package/build/transport/http/storage/streamableSessionRepository.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import { MCP_SERVER_VERSION } from '../../constants.js';
|
|
2
|
+
import logger from '../../logger/logger.js';
|
|
3
|
+
import { withErrorHandling } from '../../utils/core/errorHandling.js';
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { CacheManager } from './cacheManager.js';
|
|
6
|
+
import { OFFICIAL_REGISTRY_KEY, } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* HTTP client for the MCP Registry API
|
|
9
|
+
* https://registry.modelcontextprotocol.io/docs
|
|
10
|
+
* https://registry.modelcontextprotocol.io/openapi.yaml
|
|
11
|
+
*/
|
|
12
|
+
export class MCPRegistryClient {
|
|
13
|
+
baseUrl;
|
|
14
|
+
timeout;
|
|
15
|
+
cache;
|
|
16
|
+
proxyConfig;
|
|
17
|
+
axiosInstance;
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.baseUrl = options.baseUrl.replace(/\/$/, ''); // Remove trailing slash
|
|
20
|
+
this.timeout = options.timeout;
|
|
21
|
+
this.cache = new CacheManager(options.cache);
|
|
22
|
+
this.proxyConfig = options.proxy;
|
|
23
|
+
this.axiosInstance = this.createAxiosInstance();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get servers from the registry with optional filtering
|
|
27
|
+
*/
|
|
28
|
+
async getServers(options = {}) {
|
|
29
|
+
const handler = withErrorHandling(async () => {
|
|
30
|
+
const params = this.buildParams(options);
|
|
31
|
+
return await this.withCache('/servers', params, async () => {
|
|
32
|
+
const url = `${this.baseUrl}/v0/servers${this.buildQueryString(params)}`;
|
|
33
|
+
const response = await this.makeRequest(url);
|
|
34
|
+
// Extract RegistryServer objects from ServerResponse objects
|
|
35
|
+
return (response.servers || []).map((sr) => sr.server);
|
|
36
|
+
}, 300, // 5 minutes TTL
|
|
37
|
+
'servers list');
|
|
38
|
+
}, 'Failed to fetch servers from registry');
|
|
39
|
+
return await handler();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get servers from the registry with full response metadata (including pagination)
|
|
43
|
+
*/
|
|
44
|
+
async getServersWithMetadata(options = {}) {
|
|
45
|
+
const handler = withErrorHandling(async () => {
|
|
46
|
+
const params = this.buildParams(options);
|
|
47
|
+
return await this.withCache('/servers-metadata', params, async () => {
|
|
48
|
+
const url = `${this.baseUrl}/v0/servers${this.buildQueryString(params)}`;
|
|
49
|
+
return await this.makeRequest(url);
|
|
50
|
+
}, 300, // 5 minutes TTL
|
|
51
|
+
'servers list with metadata');
|
|
52
|
+
}, 'Failed to fetch servers from registry with metadata');
|
|
53
|
+
return await handler();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get a specific server by ID
|
|
57
|
+
*/
|
|
58
|
+
async getServerById(id, version) {
|
|
59
|
+
const handler = withErrorHandling(async () => {
|
|
60
|
+
const cacheKey = version ? `/servers/${id}?version=${version}` : `/servers/${id}`;
|
|
61
|
+
return await this.withCache(cacheKey, undefined, async () => {
|
|
62
|
+
let url = `${this.baseUrl}/v0/servers/${encodeURIComponent(id)}`;
|
|
63
|
+
if (version) {
|
|
64
|
+
url += `?version=${encodeURIComponent(version)}`;
|
|
65
|
+
}
|
|
66
|
+
return await this.makeRequest(url);
|
|
67
|
+
}, 600, // 10 minutes TTL for individual servers
|
|
68
|
+
`server: ${id}${version ? ` (v${version})` : ''}`);
|
|
69
|
+
}, `Failed to fetch server with ID: ${id}${version ? ` (version: ${version})` : ''}`);
|
|
70
|
+
return await handler();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get all versions for a specific server
|
|
74
|
+
*/
|
|
75
|
+
async getServerVersions(id) {
|
|
76
|
+
const handler = withErrorHandling(async () => {
|
|
77
|
+
return await this.withCache(`/servers/${id}/versions`, undefined, async () => {
|
|
78
|
+
const url = `${this.baseUrl}/v0/servers/${encodeURIComponent(id)}/versions`;
|
|
79
|
+
// The API returns servers in the same format as the main endpoint
|
|
80
|
+
const response = await this.makeRequest(url);
|
|
81
|
+
// Transform to the expected ServerVersionsResponse format
|
|
82
|
+
const versions = (response.servers || []).map((serverResponse) => {
|
|
83
|
+
const server = serverResponse.server;
|
|
84
|
+
const meta = server._meta[OFFICIAL_REGISTRY_KEY];
|
|
85
|
+
const registryMeta = serverResponse._meta['io.modelcontextprotocol.registry/official'];
|
|
86
|
+
return {
|
|
87
|
+
version: server.version,
|
|
88
|
+
publishedAt: meta.publishedAt,
|
|
89
|
+
updatedAt: meta.updatedAt,
|
|
90
|
+
isLatest: meta.isLatest,
|
|
91
|
+
status: registryMeta.status,
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
// Get server name from the first server (they should all have the same name)
|
|
95
|
+
const serverName = response.servers && response.servers.length > 0 ? response.servers[0].server.name : '';
|
|
96
|
+
return {
|
|
97
|
+
versions,
|
|
98
|
+
serverId: id,
|
|
99
|
+
name: serverName,
|
|
100
|
+
};
|
|
101
|
+
}, 300, // 5 minutes TTL for versions list
|
|
102
|
+
`server versions: ${id}`);
|
|
103
|
+
}, `Failed to fetch versions for server with ID: ${id}`);
|
|
104
|
+
return await handler();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Search servers with advanced filtering
|
|
108
|
+
*/
|
|
109
|
+
async searchServers(searchOptions) {
|
|
110
|
+
const handler = withErrorHandling(async () => {
|
|
111
|
+
const params = this.buildParams(searchOptions);
|
|
112
|
+
return await this.withCache('/search', params, async () => {
|
|
113
|
+
// For search, we'll use the main servers endpoint with filters
|
|
114
|
+
// This assumes the registry API supports these query parameters
|
|
115
|
+
const url = `${this.baseUrl}/v0/servers${this.buildQueryString(params)}`;
|
|
116
|
+
const response = await this.makeRequest(url);
|
|
117
|
+
// Extract RegistryServer objects from ServerResponse objects
|
|
118
|
+
return (response.servers || []).map((sr) => sr.server);
|
|
119
|
+
}, 180, // 3 minutes TTL
|
|
120
|
+
'search');
|
|
121
|
+
}, 'Failed to search servers in registry');
|
|
122
|
+
return await handler();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get registry status and statistics
|
|
126
|
+
*/
|
|
127
|
+
async getRegistryStatus(includeStats = false) {
|
|
128
|
+
const handler = withErrorHandling(async () => {
|
|
129
|
+
return await this.withCache('/status', { includeStats }, async () => {
|
|
130
|
+
const startTime = Date.now();
|
|
131
|
+
try {
|
|
132
|
+
// Check registry availability using health endpoint
|
|
133
|
+
const url = `${this.baseUrl}/v0/health`;
|
|
134
|
+
const healthResponse = await this.makeRequest(url);
|
|
135
|
+
const responseTime = Date.now() - startTime;
|
|
136
|
+
const status = {
|
|
137
|
+
available: true,
|
|
138
|
+
url: this.baseUrl,
|
|
139
|
+
response_time_ms: responseTime,
|
|
140
|
+
last_updated: new Date().toISOString(),
|
|
141
|
+
github_client_id: healthResponse.github_client_id,
|
|
142
|
+
};
|
|
143
|
+
// Calculate statistics if requested
|
|
144
|
+
if (includeStats) {
|
|
145
|
+
const allServers = await this.getAllServersWithPagination();
|
|
146
|
+
status.stats = this.calculateStats(allServers);
|
|
147
|
+
}
|
|
148
|
+
return status;
|
|
149
|
+
}
|
|
150
|
+
catch (_error) {
|
|
151
|
+
const responseTime = Date.now() - startTime;
|
|
152
|
+
return {
|
|
153
|
+
available: false,
|
|
154
|
+
url: this.baseUrl,
|
|
155
|
+
response_time_ms: responseTime,
|
|
156
|
+
last_updated: new Date().toISOString(),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}, 60, // 1 minute TTL
|
|
160
|
+
'registry status');
|
|
161
|
+
}, 'Failed to get registry status');
|
|
162
|
+
return await handler();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Invalidate cache for specific patterns
|
|
166
|
+
*/
|
|
167
|
+
async invalidateCache(pattern) {
|
|
168
|
+
if (pattern) {
|
|
169
|
+
await this.cache.invalidate(pattern);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
await this.cache.clear();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get cache statistics
|
|
177
|
+
*/
|
|
178
|
+
getCacheStats() {
|
|
179
|
+
return this.cache.getStats();
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Clean up resources
|
|
183
|
+
*/
|
|
184
|
+
destroy() {
|
|
185
|
+
this.cache.destroy();
|
|
186
|
+
// Force close any remaining connections
|
|
187
|
+
if (this.axiosInstance && 'defaults' in this.axiosInstance) {
|
|
188
|
+
// Clear any timeout references
|
|
189
|
+
if (this.axiosInstance.defaults?.timeout) {
|
|
190
|
+
delete this.axiosInstance.defaults.timeout;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Generic cache wrapper that handles the cache-check-call-store pattern
|
|
196
|
+
*/
|
|
197
|
+
async withCache(cacheKeyPath, cacheKeyParams, apiCall, ttl, debugDescription) {
|
|
198
|
+
const cacheKey = cacheKeyParams
|
|
199
|
+
? this.cache.generateKey(cacheKeyPath, cacheKeyParams)
|
|
200
|
+
: this.cache.generateKey(cacheKeyPath);
|
|
201
|
+
// Try cache first
|
|
202
|
+
const cached = await this.cache.get(cacheKey);
|
|
203
|
+
if (cached) {
|
|
204
|
+
logger.debug(`Cache hit for ${debugDescription}: ${cacheKey}`);
|
|
205
|
+
return cached;
|
|
206
|
+
}
|
|
207
|
+
// Cache miss - make API call
|
|
208
|
+
const result = await apiCall();
|
|
209
|
+
// Cache the response
|
|
210
|
+
await this.cache.set(cacheKey, result, ttl);
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get all servers using pagination to handle large result sets
|
|
215
|
+
*/
|
|
216
|
+
async getAllServersWithPagination(baseOptions = {}, maxPages = 10) {
|
|
217
|
+
const allServers = [];
|
|
218
|
+
let cursor;
|
|
219
|
+
let pageCount = 0;
|
|
220
|
+
do {
|
|
221
|
+
const params = {
|
|
222
|
+
...baseOptions,
|
|
223
|
+
limit: baseOptions.limit || 100,
|
|
224
|
+
};
|
|
225
|
+
if (cursor) {
|
|
226
|
+
params.cursor = cursor;
|
|
227
|
+
}
|
|
228
|
+
const response = await this.makeRequest(`${this.baseUrl}/v0/servers${this.buildQueryString(this.buildParams(params))}`);
|
|
229
|
+
allServers.push(...(response.servers || []).map((sr) => sr.server));
|
|
230
|
+
cursor = response.metadata.nextCursor;
|
|
231
|
+
pageCount++;
|
|
232
|
+
} while (cursor && pageCount < maxPages);
|
|
233
|
+
return allServers;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Create axios instance with timeout and proxy support
|
|
237
|
+
*/
|
|
238
|
+
createAxiosInstance() {
|
|
239
|
+
const config = {
|
|
240
|
+
timeout: this.timeout,
|
|
241
|
+
headers: {
|
|
242
|
+
Accept: 'application/json',
|
|
243
|
+
'User-Agent': `1mcp-agent/${MCP_SERVER_VERSION}`,
|
|
244
|
+
// Ensure connection is closed after request to prevent hanging
|
|
245
|
+
Connection: 'close',
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
// Add proxy support if configured
|
|
249
|
+
const proxyConfig = this.getProxyConfig();
|
|
250
|
+
if (proxyConfig) {
|
|
251
|
+
try {
|
|
252
|
+
// For axios, we can use the proxy configuration directly
|
|
253
|
+
const proxyUrl = new URL(proxyConfig.url);
|
|
254
|
+
config.proxy = {
|
|
255
|
+
protocol: proxyUrl.protocol.replace(':', ''),
|
|
256
|
+
host: proxyUrl.hostname,
|
|
257
|
+
port: parseInt(proxyUrl.port) || (proxyUrl.protocol === 'https:' ? 443 : 80),
|
|
258
|
+
};
|
|
259
|
+
// Add auth if provided
|
|
260
|
+
if (proxyConfig.auth) {
|
|
261
|
+
config.proxy.auth = {
|
|
262
|
+
username: proxyConfig.auth.username,
|
|
263
|
+
password: proxyConfig.auth.password,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
else if (proxyUrl.username && proxyUrl.password) {
|
|
267
|
+
config.proxy.auth = {
|
|
268
|
+
username: decodeURIComponent(proxyUrl.username),
|
|
269
|
+
password: decodeURIComponent(proxyUrl.password),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
logger.debug(`Using proxy: ${proxyConfig.url}`);
|
|
273
|
+
}
|
|
274
|
+
catch (proxyError) {
|
|
275
|
+
logger.warn(`Failed to configure proxy, proceeding without: ${proxyError}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return axios.create(config);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Make HTTP request with timeout and proxy support
|
|
282
|
+
*/
|
|
283
|
+
async makeRequest(url) {
|
|
284
|
+
try {
|
|
285
|
+
logger.debug(`Making request to: ${url}`);
|
|
286
|
+
const response = await this.axiosInstance.get(url);
|
|
287
|
+
logger.debug(`Request successful: ${url}`);
|
|
288
|
+
return response.data;
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
if (axios.isAxiosError(error)) {
|
|
292
|
+
const errorMessages = {
|
|
293
|
+
ECONNABORTED: `Request timeout after ${this.timeout}ms`,
|
|
294
|
+
response: `HTTP ${error.response?.status}: ${error.response?.statusText}`,
|
|
295
|
+
request: `Network error: ${error.message}`,
|
|
296
|
+
};
|
|
297
|
+
if (error.code === 'ECONNABORTED')
|
|
298
|
+
throw new Error(errorMessages.ECONNABORTED);
|
|
299
|
+
if (error.response)
|
|
300
|
+
throw new Error(errorMessages.response);
|
|
301
|
+
if (error.request)
|
|
302
|
+
throw new Error(errorMessages.request);
|
|
303
|
+
}
|
|
304
|
+
throw error;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Get proxy configuration from options or environment
|
|
309
|
+
*/
|
|
310
|
+
getProxyConfig() {
|
|
311
|
+
if (this.proxyConfig) {
|
|
312
|
+
return this.proxyConfig;
|
|
313
|
+
}
|
|
314
|
+
const proxyUrl = this.findProxyUrlFromEnv();
|
|
315
|
+
if (!proxyUrl) {
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
return this.parseProxyUrl(proxyUrl);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Find proxy URL from environment variables
|
|
322
|
+
*/
|
|
323
|
+
findProxyUrlFromEnv() {
|
|
324
|
+
const proxyEnvVars = ['HTTPS_PROXY', 'https_proxy', 'HTTP_PROXY', 'http_proxy', 'ALL_PROXY', 'all_proxy'];
|
|
325
|
+
return proxyEnvVars.map((envVar) => process.env[envVar]).find((value) => value);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Parse proxy URL and extract configuration
|
|
329
|
+
*/
|
|
330
|
+
parseProxyUrl(proxyUrl) {
|
|
331
|
+
try {
|
|
332
|
+
const proxyUrlObj = new URL(proxyUrl);
|
|
333
|
+
const config = { url: proxyUrl };
|
|
334
|
+
// Extract auth from URL if present
|
|
335
|
+
if (proxyUrlObj.username && proxyUrlObj.password) {
|
|
336
|
+
config.auth = {
|
|
337
|
+
username: decodeURIComponent(proxyUrlObj.username),
|
|
338
|
+
password: decodeURIComponent(proxyUrlObj.password),
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
return config;
|
|
342
|
+
}
|
|
343
|
+
catch (_error) {
|
|
344
|
+
logger.warn(`Invalid proxy URL: ${proxyUrl}`);
|
|
345
|
+
return undefined;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Build query parameters object from options
|
|
350
|
+
*/
|
|
351
|
+
buildParams(options) {
|
|
352
|
+
const params = {};
|
|
353
|
+
// API-supported parameters
|
|
354
|
+
if (options.limit)
|
|
355
|
+
params.limit = String(options.limit);
|
|
356
|
+
if (options.cursor)
|
|
357
|
+
params.cursor = options.cursor;
|
|
358
|
+
if (options.updated_since)
|
|
359
|
+
params.updated_since = options.updated_since;
|
|
360
|
+
if (options.search)
|
|
361
|
+
params.search = options.search;
|
|
362
|
+
if (options.version)
|
|
363
|
+
params.version = options.version;
|
|
364
|
+
// Legacy support - map query to search parameter
|
|
365
|
+
if ('query' in options && options.query && !params.search) {
|
|
366
|
+
params.search = options.query;
|
|
367
|
+
}
|
|
368
|
+
return params;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Build query string from parameters
|
|
372
|
+
*/
|
|
373
|
+
buildQueryString(params) {
|
|
374
|
+
const entries = Object.entries(params);
|
|
375
|
+
if (entries.length === 0)
|
|
376
|
+
return '';
|
|
377
|
+
const searchParams = new URLSearchParams(entries);
|
|
378
|
+
return `?${searchParams.toString()}`;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Calculate statistics from server list
|
|
382
|
+
*/
|
|
383
|
+
calculateStats(servers) {
|
|
384
|
+
const byRegistryType = {};
|
|
385
|
+
const byTransport = {};
|
|
386
|
+
let activeCount = 0;
|
|
387
|
+
let deprecatedCount = 0;
|
|
388
|
+
servers.forEach((server) => {
|
|
389
|
+
if (server.status === 'active')
|
|
390
|
+
activeCount++;
|
|
391
|
+
if (server.status === 'deprecated')
|
|
392
|
+
deprecatedCount++;
|
|
393
|
+
// Count by transport type (remotes contain transport info)
|
|
394
|
+
if (server.remotes) {
|
|
395
|
+
server.remotes.forEach((remote) => {
|
|
396
|
+
byTransport[remote.type] = (byTransport[remote.type] || 0) + 1;
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
// Also count by package transport types
|
|
400
|
+
if (server.packages) {
|
|
401
|
+
server.packages.forEach((pkg) => {
|
|
402
|
+
if (pkg.transport) {
|
|
403
|
+
byTransport[pkg.transport.type] = (byTransport[pkg.transport.type] || 0) + 1;
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
// For now, set registry type count to unknown since the new schema doesn't provide this info
|
|
409
|
+
byRegistryType['unknown'] = servers.length;
|
|
410
|
+
return {
|
|
411
|
+
total_servers: servers.length,
|
|
412
|
+
active_servers: activeCount,
|
|
413
|
+
deprecated_servers: deprecatedCount,
|
|
414
|
+
by_registry_type: byRegistryType,
|
|
415
|
+
by_transport: byTransport,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Convert CLI options to registry client options with defaults
|
|
421
|
+
*/
|
|
422
|
+
function convertCliOptionsToClientOptions(cliOptions = {}) {
|
|
423
|
+
// Parse proxy from CLI options only
|
|
424
|
+
let proxy;
|
|
425
|
+
const proxyUrl = cliOptions.proxy;
|
|
426
|
+
if (proxyUrl) {
|
|
427
|
+
proxy = { url: proxyUrl };
|
|
428
|
+
const proxyAuth = cliOptions.proxyAuth;
|
|
429
|
+
if (proxyAuth && proxyAuth.includes(':')) {
|
|
430
|
+
const [username, password] = proxyAuth.split(':', 2);
|
|
431
|
+
proxy.auth = { username, password };
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
// Fallback to standard proxy environment variables if no CLI proxy is set
|
|
435
|
+
if (!proxy) {
|
|
436
|
+
proxy = parseProxyFromStandardEnv();
|
|
437
|
+
}
|
|
438
|
+
return {
|
|
439
|
+
baseUrl: cliOptions.url || 'https://registry.modelcontextprotocol.io',
|
|
440
|
+
timeout: cliOptions.timeout || 10000,
|
|
441
|
+
cache: {
|
|
442
|
+
defaultTtl: cliOptions.cacheTtl || 300,
|
|
443
|
+
maxSize: cliOptions.cacheMaxSize || 1000,
|
|
444
|
+
cleanupInterval: cliOptions.cacheCleanupInterval || 60000,
|
|
445
|
+
},
|
|
446
|
+
proxy,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Parse proxy configuration from standard environment variables (fallback)
|
|
451
|
+
*/
|
|
452
|
+
function parseProxyFromStandardEnv() {
|
|
453
|
+
const proxyEnvVars = ['HTTPS_PROXY', 'https_proxy', 'HTTP_PROXY', 'http_proxy', 'ALL_PROXY', 'all_proxy'];
|
|
454
|
+
const proxyUrl = proxyEnvVars.map((envVar) => process.env[envVar]).find((value) => value);
|
|
455
|
+
return proxyUrl ? { url: proxyUrl } : undefined;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Create a registry client instance with CLI options or defaults
|
|
459
|
+
*/
|
|
460
|
+
export function createRegistryClient(cliOptions) {
|
|
461
|
+
const clientOptions = convertCliOptionsToClientOptions(cliOptions);
|
|
462
|
+
return new MCPRegistryClient(clientOptions);
|
|
463
|
+
}
|
|
464
|
+
//# sourceMappingURL=mcpRegistryClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpRegistryClient.js","sourceRoot":"","sources":["../../../src/domains/registry/mcpRegistryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,KAA4C,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,qBAAqB,GAStB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IACpB,OAAO,CAAS;IAChB,OAAO,CAAS;IAChB,KAAK,CAAe;IACpB,WAAW,CAAkC;IAC7C,aAAa,CAAgB;IAErC,YAAY,OAA8B;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,wBAAwB;QAC3E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;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gsSchema: {
|
|
5
|
+
readonly type: "object";
|
|
6
|
+
readonly properties: {
|
|
7
|
+
readonly query: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly description: "Search query to match against server names and descriptions";
|
|
10
|
+
};
|
|
11
|
+
readonly status: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly enum: readonly ["active", "archived", "deprecated", "all"];
|
|
14
|
+
readonly default: "active";
|
|
15
|
+
readonly description: "Filter by server status";
|
|
16
|
+
};
|
|
17
|
+
readonly registry_type: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly enum: readonly ["npm", "pypi", "docker"];
|
|
20
|
+
readonly description: "Filter by package registry type";
|
|
21
|
+
};
|
|
22
|
+
readonly transport: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly enum: readonly ["stdio", "sse", "webhook"];
|
|
25
|
+
readonly description: "Filter by transport method";
|
|
26
|
+
};
|
|
27
|
+
readonly limit: {
|
|
28
|
+
readonly type: "integer";
|
|
29
|
+
readonly minimum: 1;
|
|
30
|
+
readonly maximum: 100;
|
|
31
|
+
readonly default: 20;
|
|
32
|
+
readonly description: "Maximum number of results to return";
|
|
33
|
+
};
|
|
34
|
+
readonly cursor: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly description: "Pagination cursor for retrieving next page of results";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly additionalProperties: false;
|
|
40
|
+
};
|
|
41
|
+
export declare const GetRegistryStatusArgsSchema: {
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly properties: {
|
|
44
|
+
readonly include_stats: {
|
|
45
|
+
readonly type: "boolean";
|
|
46
|
+
readonly default: false;
|
|
47
|
+
readonly description: "Include detailed server count statistics in the response";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly additionalProperties: false;
|
|
51
|
+
};
|
|
52
|
+
export interface SearchMCPServersArgs {
|
|
53
|
+
query?: string;
|
|
54
|
+
status?: 'active' | 'archived' | 'deprecated' | 'all';
|
|
55
|
+
registry_type?: 'npm' | 'pypi' | 'docker';
|
|
56
|
+
transport?: 'stdio' | 'sse' | 'webhook';
|
|
57
|
+
limit?: number;
|
|
58
|
+
cursor?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface GetRegistryStatusArgs {
|
|
61
|
+
include_stats?: boolean;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=mcpToolSchemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpToolSchemas.d.ts","sourceRoot":"","sources":["../../../src/domains/registry/mcpToolSchemas.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC7B,CAAC;AAEX,eAAO,MAAM,2BAA2B;;;;;;;;;;CAU9B,CAAC;AAGX,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,KAAK,CAAC;IACtD,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC1C,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema definitions for MCP tools
|
|
3
|
+
*/
|
|
4
|
+
export const SearchMCPServersArgsSchema = {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
query: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
description: 'Search query to match against server names and descriptions',
|
|
10
|
+
},
|
|
11
|
+
status: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
enum: ['active', 'archived', 'deprecated', 'all'],
|
|
14
|
+
default: 'active',
|
|
15
|
+
description: 'Filter by server status',
|
|
16
|
+
},
|
|
17
|
+
registry_type: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
enum: ['npm', 'pypi', 'docker'],
|
|
20
|
+
description: 'Filter by package registry type',
|
|
21
|
+
},
|
|
22
|
+
transport: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
enum: ['stdio', 'sse', 'webhook'],
|
|
25
|
+
description: 'Filter by transport method',
|
|
26
|
+
},
|
|
27
|
+
limit: {
|
|
28
|
+
type: 'integer',
|
|
29
|
+
minimum: 1,
|
|
30
|
+
maximum: 100,
|
|
31
|
+
default: 20,
|
|
32
|
+
description: 'Maximum number of results to return',
|
|
33
|
+
},
|
|
34
|
+
cursor: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Pagination cursor for retrieving next page of results',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
additionalProperties: false,
|
|
40
|
+
};
|
|
41
|
+
export const GetRegistryStatusArgsSchema = {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
include_stats: {
|
|
45
|
+
type: 'boolean',
|
|
46
|
+
default: false,
|
|
47
|
+
description: 'Include detailed server count statistics in the response',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
additionalProperties: false,
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=mcpToolSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpToolSchemas.js","sourceRoot":"","sources":["../../../src/domains/registry/mcpToolSchemas.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6DAA6D;SAC3E;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,CAAC;YACjD,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,yBAAyB;SACvC;QACD,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC;YAC/B,WAAW,EAAE,iCAAiC;SAC/C;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC;YACjC,WAAW,EAAE,4BAA4B;SAC1C;QACD,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,qCAAqC;SACnD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,uDAAuD;SACrE;KACF;IACD,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,aAAa,EAAE;YACb,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,0DAA0D;SACxE;KACF;IACD,oBAAoB,EAAE,KAAK;CACnB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { RegistryServer } from '../../domains/registry/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Search and filtering utilities for MCP servers
|
|
4
|
+
*/
|
|
5
|
+
export declare class SearchEngine {
|
|
6
|
+
/**
|
|
7
|
+
* Perform fuzzy search on server name and description
|
|
8
|
+
*/
|
|
9
|
+
fuzzySearch(query: string, servers: RegistryServer[]): RegistryServer[];
|
|
10
|
+
/**
|
|
11
|
+
* Filter servers by status
|
|
12
|
+
*/
|
|
13
|
+
filterByStatus(servers: RegistryServer[], status: string): RegistryServer[];
|
|
14
|
+
/**
|
|
15
|
+
* Filter servers by registry type
|
|
16
|
+
*/
|
|
17
|
+
filterByRegistryType(servers: RegistryServer[], type: string): RegistryServer[];
|
|
18
|
+
/**
|
|
19
|
+
* Filter servers by transport method
|
|
20
|
+
*/
|
|
21
|
+
filterByTransport(servers: RegistryServer[], transport: string): RegistryServer[];
|
|
22
|
+
/**
|
|
23
|
+
* Rank search results by relevance and recency
|
|
24
|
+
*/
|
|
25
|
+
rankResults(servers: RegistryServer[], query?: string): RegistryServer[];
|
|
26
|
+
/**
|
|
27
|
+
* Calculate relevance score for a server against a search query
|
|
28
|
+
*/
|
|
29
|
+
private calculateRelevanceScore;
|
|
30
|
+
/**
|
|
31
|
+
* Calculate fuzzy matching score using simplified Levenshtein approach
|
|
32
|
+
*/
|
|
33
|
+
private calculateFuzzyScore;
|
|
34
|
+
/**
|
|
35
|
+
* Apply all filters and search to a server list
|
|
36
|
+
*/
|
|
37
|
+
applyFilters(servers: RegistryServer[], options: {
|
|
38
|
+
query?: string;
|
|
39
|
+
status?: string;
|
|
40
|
+
registry_type?: string;
|
|
41
|
+
transport?: string;
|
|
42
|
+
}): RegistryServer[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create a search engine instance
|
|
46
|
+
*/
|
|
47
|
+
export declare function createSearchEngine(): SearchEngine;
|
|
48
|
+
//# sourceMappingURL=searchFiltering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchFiltering.d.ts","sourceRoot":"","sources":["../../../src/domains/registry/searchFiltering.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAE3G;;GAEG;AACH,qBAAa,YAAY;IACvB;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE;IAkBvE;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE;IAqB3E;;OAEG;IACH,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE;IAQ/E;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,cAAc,EAAE;IAWjF;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE;IAmBxE;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAuE/B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;OAEG;IACH,YAAY,CACV,OAAO,EAAE,cAAc,EAAE,EACzB,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,cAAc,EAAE;CAyBpB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAEjD"}
|