claude-code - 💡(How to fix) Fix MCP tools/list pagination (nextCursor) not followed — tools silently truncated [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48126Fetched 2026-04-15 06:32:25
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×3commented ×2closed ×1

Claude Code does not follow nextCursor pagination when calling tools/list on MCP servers. Only the first page of tools is fetched; the nextCursor in the response is silently ignored. Tools beyond the first page are completely invisible and uncallable.

Root Cause

Claude Code does not follow nextCursor pagination when calling tools/list on MCP servers. Only the first page of tools is fetched; the nextCursor in the response is silently ignored. Tools beyond the first page are completely invisible and uncallable.

Fix Action

Fix / Workaround

  • Silent data loss: Users see a subset of tools with no warning that more exist
  • Breaks MCP gateways: Gateways aggregating tools from multiple backend servers commonly paginate — this is a standard enterprise pattern
  • No client-side workaround: Users cannot configure Claude Code to fetch more tools; the only workaround is modifying the server to disable pagination, which isn't always possible

Code Example

cursor = None
all_tools = []
while True:
    response = tools/list(cursor)
    all_tools.extend(response.tools)
    if not response.nextCursor:
        break
    cursor = response.nextCursor
RAW_BUFFERClick to expand / collapse

Summary

Claude Code does not follow nextCursor pagination when calling tools/list on MCP servers. Only the first page of tools is fetched; the nextCursor in the response is silently ignored. Tools beyond the first page are completely invisible and uncallable.

Reproduction

  1. Connect Claude Code to an MCP server (HTTP transport) that exposes more tools than fit in a single tools/list response page
  2. Manually verify the server's full tool count by following nextCursor pagination via curl (or MCP Inspector)
  3. Start a fresh Claude Code session and count the tools it registers from that server

Result: Claude Code only registers tools from the first page. It sends a single tools/list request, receives tools + a nextCursor, and never sends a follow-up request. All tools on subsequent pages are silently dropped with no warning.

Expected Behavior

Per the MCP Specification:

Clients SHOULD support both paginated and non-paginated flows for all list endpoints.

Claude Code should follow the cursor until nextCursor is null:

cursor = None
all_tools = []
while True:
    response = tools/list(cursor)
    all_tools.extend(response.tools)
    if not response.nextCursor:
        break
    cursor = response.nextCursor

Impact

  • Silent data loss: Users see a subset of tools with no warning that more exist
  • Breaks MCP gateways: Gateways aggregating tools from multiple backend servers commonly paginate — this is a standard enterprise pattern
  • No client-side workaround: Users cannot configure Claude Code to fetch more tools; the only workaround is modifying the server to disable pagination, which isn't always possible

Environment

  • Claude Code CLI (latest)
  • Windows 11
  • MCP server connected via HTTP transport

Prior Issues

  • #24785 — Detailed repro with AWS Bedrock AgentCore Gateway, closed by stale bot as "not planned," now locked
  • #8237 — Feature request with screenshots, self-closed by author, now locked
  • #3141 — Resources pagination, auto-closed for inactivity, now locked

None of these were resolved. The bug persists as of April 2026.

extent analysis

TL;DR

Implement pagination support in Claude Code by following the nextCursor in the response from the tools/list endpoint until nextCursor is null.

Guidance

  • Review the MCP Specification for pagination requirements and ensure Claude Code adheres to the guidelines for handling nextCursor.
  • Modify the tools/list request handling in Claude Code to send follow-up requests with the nextCursor until no more cursors are returned, accumulating all tools in the process.
  • Verify the fix by testing against an MCP server with more tools than fit in a single response page and confirm that all tools are registered by Claude Code.
  • Consider adding logging or warnings to handle cases where pagination fails or is not supported by the server.

Example

def fetch_all_tools():
    cursor = None
    all_tools = []
    while True:
        response = tools_list(cursor)
        all_tools.extend(response.tools)
        if not response.nextCursor:
            break
        cursor = response.nextCursor
    return all_tools

Notes

The provided code snippet is based on the expected behavior described in the issue and may need adjustments to fit the actual implementation of Claude Code.

Recommendation

Apply workaround: Implement pagination support as described, to ensure compatibility with MCP servers and prevent silent data loss. This is necessary because the issue persists and there's no clear indication of a fixed version that addresses this problem.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix MCP tools/list pagination (nextCursor) not followed — tools silently truncated [2 comments, 2 participants]