Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a temporary server-list limit (200) to avoid loading an unbounded number of MCP servers until UI pagination is implemented.
Changes:
- Introduced
SERVER_PAGE_LIMIT = 200and applied it to server-list API calls. - Added
extractServers()helper to normalize/extractV0ServerJson[]from API responses. - Refactored
getServers()/getServersByRegistryName()to use the shared helper and updated variable naming (response).
Comment on lines
+44
to
+54
| const response = await api.getRegistryV01Servers({ | ||
| client: api.client, | ||
| query: { | ||
| version: "latest", | ||
| }, | ||
| query: { version: "latest", limit: SERVER_PAGE_LIMIT }, | ||
| }); | ||
|
|
||
| if (servers.error) { | ||
| console.error("[catalog] Failed to fetch servers:", servers.error); | ||
| throw servers.error; | ||
| } | ||
|
|
||
| if (!servers.data) { | ||
| return []; | ||
| if (response.error) { | ||
| console.error("[catalog] Failed to fetch servers:", response.error); | ||
| throw response.error; | ||
| } | ||
|
|
||
| const data = servers.data; | ||
| const items = Array.isArray(data?.servers) ? data.servers : []; | ||
|
|
||
| // Extract the server objects from the response | ||
| return items | ||
| .map((item) => item?.server) | ||
| .filter((server): server is V0ServerJson => server != null); | ||
| return extractServers(response.data?.servers ?? []); |
There was a problem hiding this comment.
Because the request is now capped with limit: SERVER_PAGE_LIMIT, this function can silently return a truncated server list when the API provides metadata.nextCursor (i.e., more results exist). Consider at least detecting response.data?.metadata?.nextCursor and surfacing it (return it alongside servers, or log a warning/telemetry) so missing servers aren’t mistaken for an empty/complete catalog while UI pagination is still unimplemented.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Temporary limit configuration to 200, remove once UI pagination is implemented