Practical technical guides / Recent development: Microsoft Agent Framework Python 1.25.0 (PyPI 2026-11-07)

Agent Framework 1.25 Caps MCP Discovery at 100 Pages and 1,000 Items: An Endless Catalog Before and After

Agent Framework 1.25.0 (7 November 2026) caps MCP discovery. Recorded: 1.24.0 listed 8,861 pages of an endless catalog in 20 s; 1.25.0 stopped at page 100.

By Sandeep Belgavi · Published 2026-11-08

Agent Framework 1.25.0 (7 November 2026) caps MCP discovery. Recorded: 1.24.0 listed 8,861 pages of an endless catalog in 20 s; 1.25.0 stopped at page 100.

What changed on 7 November

Microsoft's Agent Framework for Python released 1.25.0 on 7 November 2026; agent-framework-core 1.25.0 was uploaded to PyPI at 15:42 UTC that day. Among several breaking changes, it puts a ceiling on how much an MCP server can make the client discover: tool and prompt catalogs are limited to 100 pages and 1,000 items per fetch, and framework-owned MCP clients now default to a 30-second request timeout. Everything below comes from the published wheels for 1.24.0 and 1.25.0, read directly and exercised against a local MCP server, rather than from a summary of the release notes.

This guide shows what an endless or oversized catalog did to 1.24.0 and what 1.25.0 does instead, explains one limit the new code does not cover, and gives a bounded discovery loop you can use with any MCP client. The examples are recorded on Windows 11 with CPython 3.13.5 and the MCP Python SDK 2.3.0.

The discovery loop, before and after

MCP list methods such as tools/list are paginated: each response may include a nextCursor, and the client asks again with it until no cursor comes back. The specification leaves page size and the number of pages to the server. A client that simply follows cursors trusts the server to stop.

In 1.24.0, the tool loader in agent_framework/_mcp.py does exactly that: it loops while tool_list.next_cursor is truthy, with no count of pages or items, and request_timeout defaults to None. In 1.25.0 the same loader counts both:

_DEFAULT_MCP_DISCOVERY_MAX_PAGES = 100
_DEFAULT_MCP_DISCOVERY_MAX_ITEMS = 1_000

while cursor is not None:
    if self.max_discovery_pages is not None and pages_loaded >= self.max_discovery_pages:
        raise _mcp_tool_execution_exception(
            f"MCP tool discovery exceeded max_discovery_pages={self.max_discovery_pages}; ..."
        )

Items are added up after each page is parsed, and discovery fails as soon as the running total passes the limit. Both limits are constructor arguments on MCPStdioTool, MCPStreamableHTTPTool and MCPWebsocketTool (max_discovery_pages, max_discovery_items), and None disables either; the error message says to do that "only for a trusted MCP server". The same limits apply to prompt discovery. _MCP_DEFAULT_READ_TIMEOUT_SECONDS = 30 is the new default for request_timeout.

What I recorded

The probe starts a stdio MCP server whose catalog shape is chosen on the command line, connects MCPStdioTool from each version, and stops any run that is still listing after 20 seconds. The server counts the pages it serves.

Catalog shape1.24.01.25.0
endless cursor, 10 tools per pagestill listing after 8,861 pages when stopped at 20 srefused after 100 pages
1 page of 1,000 toolsloaded 1,000loaded 1,000
1 page of 1,001 toolsloaded 1,001refused: exceeded max_discovery_items=1000; the server returned 1001 tools
exactly 100 pages of 1 toolloaded 100loaded 100
101 pages of 1 toolloaded 101refused: continuation cursor after page 100

The endless case is the one that matters. In 20 seconds, 1.24.0 had accepted 88,610 tool definitions into memory and would have continued for as long as the process lived, because nothing in the loop could end it. In 1.25.0 the same server produced a clear error after 100 requests and about two seconds. The boundaries behave as the code says: 1,000 items and exactly 100 pages are accepted, one more of either is refused.

The limit that applies after parsing

The 1.25.0 docstring for max_discovery_items is candid: discovery limits apply after the MCP SDK parses each page and do not bound the encoded response size. A single page of 50 MB is read and parsed before any count is checked. The docstring advises connecting only to servers trusted to return reasonably sized responses and configuring transport-specific size limits where available. A separate setting that 1.24.0 already had, max_host_payload_size_bytes (1 MB by default in 1.25.0), limits the encoded result size retained for Host transports; it does not apply to discovery.

So the framework's caps protect against a server that pages forever or returns too many tools. They do not protect against one enormous page, and they do not detect a server whose cursors cycle (the page cap eventually stops it, after 100 requests). For a server you do not control, add a byte limit at the transport and treat repeated cursors as an error.

A bounded loop for any client

The companion bounded.py applies five ceilings to any paginated list call, with the fetch injected so the policy can be tested without a server:

def list_all(fetch, max_pages=100, max_items=1000, max_page_bytes=1_048_576, max_seconds=30.0, clock=time.monotonic):
    started, cursor, seen, pages, items = clock(), None, set(), 0, []
    while True:
        if max_pages is not None and pages >= max_pages:
            raise DiscoveryLimit('pages', f'continuation cursor after page {pages}; limit is {max_pages}', pages, len(items))
        raw = fetch(cursor)
        pages += 1
        if max_page_bytes is not None and len(raw) > max_page_bytes:
            raise DiscoveryLimit('page_bytes', f'page {pages} is {len(raw)} bytes; limit is {max_page_bytes}', pages, len(items))
        page = json.loads(raw)
        items.extend(page.get('tools', []))
        if max_items is not None and len(items) > max_items:
            raise DiscoveryLimit('items', f'{len(items)} items after page {pages}; limit is {max_items}', pages, len(items))
        if max_seconds is not None and clock() - started > max_seconds:
            raise DiscoveryLimit('time', f'discovery took longer than {max_seconds} s', pages, len(items))
        cursor = page.get('nextCursor')
        if cursor is None:
            return items
        if cursor in seen:
            raise DiscoveryLimit('cursor_repeat', f'cursor {cursor!r} was already returned; the server is looping', pages, len(items))
        seen.add(cursor)

The page-size check runs before json.loads, which is the gap the framework leaves. The repeated-cursor check stops a cycling server at its first repeat (page 4 in the example) instead of after 100 requests. The wall-clock limit bounds a server that answers slowly but within each request's timeout. The same limits apply to prompts/list and resources/list.

How the limits apply over a session

The 1.25.0 docstrings say the limits are accepted "independently for each tool or prompt catalog fetch". Each catalog gets its own budget, and each reload starts again from zero. A server that sends notifications/tools/list_changed causes the client to list tools again, and each of those reloads is bounded on its own. That keeps a misbehaving server from exhausting memory in one fetch, but it does not stop a server from triggering many bounded reloads. If a server announces changes far more often than its catalog plausibly changes, rate-limit reloads on the client and log the server name.

Upgrading to 1.25

  • Large trusted catalogs. If one of your own servers legitimately exposes more than 1,000 tools, discovery now fails at startup. Raise the limit for that server explicitly, with a comment, rather than setting None. A catalog that size is also worth reconsidering, because every tool definition in context costs tokens and dilutes the model's choice.
  • Slow servers. A framework-owned client now times out requests after 30 seconds instead of waiting forever. If a server's first tools/list call is slow because it starts lazily, warm it up or raise request_timeout for that server.
  • Error handling. A refused discovery raises from the connect path. Decide whether the agent should start without that server's tools or fail, and log the server name and the limit that fired.
  • Pinning. These defaults are new in 1.25.0. Pin the version in production and read the release notes before moving to a later one; this guide does not describe any later release.

Why a client should bound this at all

An MCP server is often third-party code, and its catalog flows straight into the model's context and the host's memory. A server that returns an endless or huge catalog, through a bug or on purpose, can exhaust memory, stall agent startup, or push useful tools out of the context window. Bounding discovery is the same discipline as bounding any untrusted input: a ceiling on count, size and time, with an error that names which ceiling was hit. It costs nothing for well-behaved servers, as the 1,000-item and 100-page rows show.

Verifying it

The companion tests check every ceiling at its boundary: an endless cursor stops after page 100 holding 1,000 items, 1,000 items load and 1,001 are refused, exactly 100 pages load and 101 are refused, a cycling cursor is refused at page 4, a 2 MB page is refused before parsing, the wall-clock limit fires from an injected clock, and None disables a limit. The live/ directory holds the server, the probe and the two recordings with their lock files, so the table above can be reproduced against 1.24.0 and 1.25.0.

Primary references and authorship

Sources dated on or before 8 November 2026. Original explanation and synthetic examples by Sandeep Belgavi. Companion code: Sandeep-BA/agent-decision-lab/examples/python/mcp_discovery_bounds. Views are my own and do not represent any employer, past or present.