Commit Graph

18 Commits

Author SHA1 Message Date
Max Isbey ecafdc78d6 Re-scope the codemod to run-on-v2 minimalism
The goal is that migrated v1 code runs on v2 on its legacy paths, not
that it adopts v2 idioms. Applying that bar:

- Leave e.error.code / .message / .data chains alone: v2's MCPError
  keeps a typed .error ErrorData, so the v1 spelling runs and
  type-checks unchanged. The except-binding tracking goes with it.
- Rewrite one-argument McpError(...) calls to MCPError.from_error_data(...)
  instead of flattening the inline ErrorData: the user's expression is
  kept as written and the non-inline form no longer needs a marker.
- Convert v1 positional arguments on the lowlevel Server constructor to
  keywords (v2 is keyword-only after name but kept v1's names and order),
  pinned against the installed signature by a new ratchet test.
- Reword every marker message that pointed at replaced internals or at
  the successor of the removed experimental tasks API; state removals
  plainly instead of steering users onto new surfaces.
- Teach the batch harness that a reportArgumentType error naming a
  detonating argument type (timedelta, AnyUrl) is a real break, never
  v2 strictness drift, and ignore stale work/ directories.
2026-07-01 12:38:23 +00:00
Max Isbey 801095acad Flag removed modules, update dependency files, add a batch-test harness
Three additions to mcp-codemod, closing the gaps a comparison with the
TypeScript codemod surfaced:

Imports of module namespaces v2 deleted outright (the experimental tasks
namespaces, the WebSocket transports, `mcp.shared.progress`) are now
marked with replacement guidance. A new ratchet test freezes the 107
public modules v1 shipped and asserts every one imports on v2, is
renamed, or is in the removed table, so the whole v1 module namespace is
provably accounted for.

The codemod now also updates the `mcp` requirement in `pyproject.toml`
(PEP 621 tables and dependency groups) and `requirements*.txt` to
`>=2,<3` -- only where the current constraint cannot accept any v2
release, and only the version specifier: name, extras, environment
marker, and spacing keep the user's spelling. Poetry tables and the
removed `ws` extra are marked instead of guessed at, under the same
`# mcp-codemod:` contract as source markers.

`scripts/codemod-batch-test/` runs the codemod against pinned real
repositories and audits the marker contract end to end: it type-checks
the pristine clone against the latest v1 and the migrated copy against
this workspace's v2 with identical pyright settings, then requires every
error that exists only on the migrated side to sit next to a marker.
Across the four repos in the manifest every migration-surface error is
covered, and the audit caught two real bugs now fixed here: `Context`
imported from the old `.server` submodule is rehomed to the package (the
submodule holds the name at runtime, but a type checker treats a
non-re-exported name as private), and `request_context` on a receiver
the pre-pass proved holds a lowlevel `Server` is flagged again --
receiver-matched, so the live `ctx.request_context` idiom stays
untouched.
2026-07-01 12:08:22 +00:00
Max f2e63c979a Promote the v2 README to README.md ahead of the first v2 beta (#3014) 2026-06-29 12:01:54 +01:00
Max e942d00b98 Re-vendor 2026-07-28 schema at spec ead35b59 (SubscriptionsListenResult) (#3006) 2026-06-27 10:15:34 +02:00
Max 411a6d3980 Rebuild the docs around tested examples; shrink README.v2.md to a pitch (#2978) 2026-06-26 12:49:19 +02:00
Marcelo Trylesinski 0ee7f1b293 Split protocol types into a standalone mcp-types package (#2973) 2026-06-25 19:18:38 +02:00
Max 510832aa45 Re-vendor 2026-07-28 schema and absorb spec #2907 error-code renumber (#2912) 2026-06-19 15:46:15 +01:00
Max 7703df1539 Expand site-absolute spec links in generated docstrings to full URLs (#2885) 2026-06-16 13:55:43 -07:00
Max 65be5a7147 Protocol types for 2026-07-28: superset monolith, committed per-version packages, and wire-method maps (#2849) 2026-06-16 17:40:14 +01:00
Max f4753440da ci: deploy docs to py.sdk.modelcontextprotocol.io via Pages artifact (v1 at /, v2 at /v2/) (#2634) 2026-05-18 15:28:13 +01:00
Max Isbey ff50351f9e ci: run strict-no-cover in scripts/test to catch stale pragmas locally (#2305) 2026-03-17 19:53:39 +00:00
Max Isbey 7ba41dcfae fix: make local coverage runs reliable (#2236) 2026-03-06 17:24:18 +00:00
Max Isbey 2137c8fbdb fix: revert README to v1.x documentation on main (#1971)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2026-01-29 20:03:01 +00:00
Felix Weinberger d41d0c0128 chore: add D212 lint rule to enforce Google-style docstrings (#1892) 2026-01-16 16:10:52 +00:00
Max Isbey 89e9c43acf Get baseline 100% clean coverage (#1553) 2025-11-11 14:09:32 +01:00
Marcelo Trylesinski c7671e470c Add pyright strict mode on the whole project (#1254) 2025-08-11 18:56:37 +01:00
Inna Harper b2d4322ca0 Fix missing line in generated snippets (#1117) 2025-07-10 10:17:05 +01:00
Inna Harper adf327164a Embed code snippets for README from executable examples (#1055) 2025-07-04 17:25:54 +01:00