Skip to content

fix: set limit 200 for getting servers#361

Open
peppescg wants to merge 1 commit intomainfrom
fix-servers-limit
Open

fix: set limit 200 for getting servers#361
peppescg wants to merge 1 commit intomainfrom
fix-servers-limit

Conversation

@peppescg
Copy link
Collaborator

Temporary limit configuration to 200, remove once UI pagination is implemented

@peppescg peppescg self-assigned this Feb 27, 2026
Copilot AI review requested due to automatic review settings February 27, 2026 16:22
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Feb 27, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = 200 and applied it to server-list API calls.
  • Added extractServers() helper to normalize/extract V0ServerJson[] 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 ?? []);
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants