Skip to content

[BUG] Claude Code does not follow MCP tools/list pagination (nextCursor) #39586

Closed as duplicate

Description

@gpapakyriakopoulos

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Claude Code does not follow nextCursor pagination when calling tools/list on MCP servers. It fetches only the first page of tools and silently discards any nextCursor in the response. This means tools beyond the first page are invisible and uncallable.

What Should Happen?

The MCP Specification (2025-06-18) states:

Clients SHOULD support both paginated and non-paginated flows for all list endpoints.
tools/list is one of the four paginated list endpoints.

Claude Code should follow the MCP pagination protocol:

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

This is the same pattern shown in the AWS AgentCore docs and the MCP specification.

Error Messages/Logs

* Any MCP server or gateway that paginates tools/list will have tools silently dropped
* The built-in x_amz_bedrock_agentcore_search tool can find page-2 tools, but they still cannot be called because Claude Code never registered them
* This breaks the intended workflow for gateways aggregating tools from multiple backend servers (a common enterprise pattern)
* Users see a subset of their tools with no indication that more exist

Steps to Reproduce

  1. Connect Claude Code to an MCP server (or gateway) that exposes more tools than fit on a single page
  2. The server returns page 1 with nextCursor in the response
  3. Claude Code displays only the tools from page 1
  4. Claude Code never sends a follow-up tools/list request with the cursor
  5. All tools on subsequent pages are completely invisible

Concrete example: AWS Bedrock AgentCore Gateway paginates tools/list at 30 tools per page. When connecting through a gateway with multiple MCP server targets totaling 48 tools, Claude Code only sees the first 30. The remaining 18 tools are undiscoverable and uncallable. The AgentCore documentation explicitly shows pagination handling code for tools/list — Claude Code should do the same.

Verified via server-side logs:

{
  "result_keys": ["tools", "nextCursor"],
  "tool_count": 30,
  "has_next_cursor": true
}

Only one tools/list request is ever sent per session — no follow-up with the cursor.

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.84

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

Related

Activity

  1. added
    bug
    on Mar 26, 2026
  2. added
    platform:macos
    has repro
    on Mar 26, 2026
  3. github-actions commented on Mar 26, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. Claude Code does not follow MCP tools/list pagination (nextCursor) #24785
    2. [BUG] Claude Code MCP client doesn't follow tools/list pagination cursors #23179
    3. [FEATURE] tools/list support cursor #8237

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  4. gpapakyriakopoulos commented on Mar 26, 2026

    @gpapakyriakopoulos
    Author

    Do not close this, it needs to be addressed at some point.

  5. rrajpuro commented on Apr 6, 2026

    @rrajpuro

    Hi maintainers,

    Before this issue gets closed, I want to flag an important pattern: related issues #8237, #23179, and #24785 were all previously closed without a fix being shipped. I'd respectfully ask that this issue not be closed as a duplicate for the same reason — the underlying bug has never actually been addressed.

    Context: AWS Bedrock AgentCore Use Case

    We are running Claude Code against an AWS Bedrock AgentCore MCP gateway. This gateway exposes a large number of tools and returns a paginated tools/list response that includes a nextCursor field when there are more tools available beyond the first page.

    The problem is that Claude Code only fetches the first 30 tools and does not follow the nextCursor to retrieve subsequent pages. This means any tools beyond the first page are silently invisible to the agent.

    Why This Matters

    This behavior violates the MCP specification, which explicitly requires clients to follow nextCursor pagination until the cursor is absent (i.e., all pages have been fetched). A spec-compliant MCP client must not stop after the first page.

    The impact is significant for gateway-style MCP deployments (like Bedrock AgentCore, or any enterprise tool catalog) where the tool count easily exceeds a single page. Users in these environments have no workaround short of reducing their tool set.

    Request

    Please treat this as a spec compliance bug rather than a feature request, and consider keeping it open until pagination is properly implemented in the MCP client layer.

    Thank you for your time and attention on this.

  6. cdapprich-bt commented on Apr 14, 2026

    @cdapprich-bt

    I was able to reproduce this with a similar AWS Bedrock AgentCore gateway configuration:

    • Server: AWS Bedrock AgentCore Gateway (HTTP transport) returning 81 tools across 3 pages (30/30/21)
    • Client: Claude Code CLI on Windows 11
    • Result: Only 30 tools registered — exactly page 1. Pages 2 and 3 silently dropped.
    • Verification: Manually following nextCursor via curl retrieves all 81 tools correctly.

    This confirms the issue across platforms (Windows v2.1.108) and with higher tool counts spanning 3+ pages.

  7. maekawataiki commented on Apr 15, 2026

    @maekawataiki

    For anyone experiencing the same issue, here's a temporary workaround while we wait for official support in Claude Code.

    I've implemented an API Gateway proxy with AWS Lambda that handles pagination and returns the concatenated tools. You can find my implementation here:

    https://github.com/maekawataiki/sample-agentcore-gateway-claude-code/blob/main/cdk/lambda/mcp_oauth_proxy.py#L482

  8. gpapakyriakopoulos commented on Apr 15, 2026

    @gpapakyriakopoulos
    Author

    The thing is this repository has 9400 open issues at the time of writing. There is no way any development team in the world is ever sorting out through all these, let alone the 5-10 new ones that pop-up every hour. So I don't expect issues like that to ever be fixed.

  9. txtade commented on Apr 17, 2026

    @txtade

    This is not a duplicate of the suggested issues. Those involve tools not loading at all in Claude Code CLI or VS Code. My issue is specific to Claude Desktop Chat loading a partial tool set from a Craft MCP server, while the same endpoint loads all tools correctly in Cowork. The issue is partial tool manifest loading in Claude Desktop specifically, not a general MCP tool registration failure.

  10. rrajpuro commented on Apr 17, 2026

    @rrajpuro

    This is not a duplicate of the suggested issues. Those involve tools not loading at all in Claude Code CLI or VS Code. My issue is specific to Claude Desktop Chat loading a partial tool set from a Craft MCP server, while the same endpoint loads all tools correctly in Cowork. The issue is partial tool manifest loading in Claude Desktop specifically, not a general MCP tool registration failure.

    Might have to dig into the logs of how Claude desktop handles MCP loading, but if its anythin similar to ClaudeCode then probably a pagination issue

  11. added
    stale
    on May 14, 2026
  12. claude commented on May 19, 2026

    @claude
    Contributor

    This is a duplicate of #59538, which was fixed as of version 2.1.144.

  13. griffithsbs commented on Jun 8, 2026

    @griffithsbs

    The same bug has long existed in Claude for Desktop: has it been fixed there too?

    The many related issues mostly seem to be filed against Claude Code but the Desktop MCP client has the identical defect: it sends a single tools/list request and silently discards nextCursor, so any tool past the first page is never registered and can't be called.

    What the problem looks like in our setup (Desktop + AWS Bedrock AgentCore gateway):

    1. Connect Claude for Desktop to an AgentCore gateway. AgentCore paginates tools/list at 30 tools/page and returns nextCursor.
    2. Expose >30 tools across the gateway's targets.
    3. Only the first 30 register. Tools 31+ are invisible and uncallable.
    4. The gateway's built-in x_amz_bedrock_agentcore_search can see the page-2 tools, but since the client never registered them, invoking them fails.
    5. No follow-up tools/list with the cursor is ever sent.

    Impact: We've had to hard-cap every MCP server at 30 tools as a workaround, purely to stay under the gateway's single-page limit. That's a real constraint on tool design and rules out the multi-target gateway aggregation pattern that AgentCore is built for. And it feels a much bigger constraint in the desktop environment than it does in Claude Code, since Claude for Desktop users don't want to have to think about connecting a dozen different small custom connectors and keeping them authenticated

  14. removed
    stale
    on Jun 8, 2026
  15. github-actions commented on Aug 10, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  16. locked as resolved and limited conversation to collaborators on Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mcpbughas reproplatform:macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions