Skip to content

Fixes #39223: MCP connector uses the official MCP Python SDK - #39226

Merged
Vishnuujain merged 5 commits into
mainfrom
mcp-python-sdk
Nov 30, 2026
Merged

Vishnuujain merged 5 commits into
mainfrom
mcp-python-sdk

Conversation

@Vishnuujain

@Vishnuujain Vishnuujain commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #39223

  • The MCP connector's client now runs on the official mcp Python SDK (2.3, a new mcp plugin extra) instead of our own HTTP and SSE code. It negotiates up to 2026-07-28 and falls back for older servers.
  • Tools, resources and prompts are now read across every page, up to 20 pages. Before, only the first page was read.
  • If one item breaks the MCP schema, that whole listing now fails with a clear warning, because the SDK checks each page. The old client kept the bad item.

Companion PRs: https://github.com/open-metadata/ai-platform/pull/2536 (Kotlin SDK for plugin tool calls) and https://github.com/open-metadata/openmetadata-collate/pull/9088 (Collate protocol version bump).

Type of change:

  • Improvement

High-level design:

  • McpClient keeps its public API (connect, initialize, list_*, close), so metadata.py and connection.py don't change.
  • The SDK is async and the connector isn't, so the SDK session runs on an anyio blocking portal from initialize() until close().
  • Listings are requested as raw dicts, so the converters still read the protocol's camelCase keys.
  • Decision record: docs/decisions/2026-11-28-the-mcp-connector-reads-at-most-20-pages-per-listing.md covers the page cap and why the SDK's per-page check stays.

Tests:

Use cases covered

  • Every page of a listing is read, and a server that never stops paging is cut at 20 pages. A repeated cursor also stops the listing.
  • A malformed tool fails the listing with the SDK's validation message.
  • The Bearer credential is sent on both Streamable HTTP and SSE.

Unit tests

  • tests/unit/source/mcp/ (test_mcp_client.py, test_mcp_connection.py, test_connection.py, test_mcp_metadata.py): 83 passed.
  • Coverage of source/mcp/client.py: 89%.
  • ruff check and ruff format --check are clean, and so is check_decision_records.py.

Ingestion integration tests

  • tests/integration/mcp/: 7 passed, 1 skipped ("Requires running HTTP MCP server"), run against a local server.

Manual testing performed

  1. Ran McpClient against an MCP SDK server on localhost over Streamable HTTP and over SSE. Both listed tools (with inputSchema), resources and prompts. Streamable HTTP negotiated 2026-07-28, and Authorization: Bearer reached every request.
  2. Ran the client against a local Collate /mcp (Java SDK server) with a PAT. The SDK fell back to 2025-11-25 and listed 24 tools, 1 resource and 1 prompt.

UI screen recording:

Not applicable: ingestion-only change.

Checklist:

  • I have read CONTRIBUTING.md (the pre-review gate) and the contributor docs.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    • The 🔴 was that the ADR and docstring claimed malformed items were kept, but the SDK rejects them. Fixed by keeping the SDK's check, correcting the ADR and docstring, and adding a test.
    • Also added tests for the transports' Bearer header, the repeated cursor and protocolVersion.
    • Not added: a test for a server that advertises an empty "tools": {} capability.
  • Decision check: docs/decisions/2026-11-28-the-mcp-connector-reads-at-most-20-pages-per-listing.md.

@Vishnuujain
Vishnuujain requested a review from a team as a code owner November 30, 2026 05:41
@Vishnuujain
Vishnuujain requested a review from ulixius9 November 30, 2026 05:41
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@gitar-bot

gitar-bot Bot commented Nov 30, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Switching the MCP connector to the official SDK adds pagination and strict page validation, which could leave listings incomplete when servers return malformed data.

Migrates the MCP connector's client onto the official mcp Python SDK (2.3, new mcp plugin extra), keeping the public McpClient API unchanged and reading tools, resources and prompts across every page up to 20. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@Vishnuujain
Vishnuujain merged commit e680332 into main Nov 30, 2026
38 checks passed
@Vishnuujain
Vishnuujain deleted the mcp-python-sdk branch November 30, 2026 08:32
ulixius9 added a commit that referenced this pull request Dec 1, 2026
… state reset (#39396)

- openmetadata-airflow-apis/uv.lock: relock with uv 0.13.4 for the mcp extra
  ingestion gained in #39226; airflow-apis tests ran with --locked and failed.
- Informix stored-procedure IT: stored_procedure_source_state is now a
  per-instance PerSourceState, so the class-level .clear() raised
  AttributeError and is no longer needed (each workflow builds a fresh source).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP connector reads only the first page of tools and can't follow newer MCP servers

3 participants