Skip to content

refactor: fix CI, use zod v4, and latest method in mcp#332

Merged
fasttime merged 25 commits intomainfrom
refactor-fix-ci-failure-and-replace-deprecated-mcpserver-tool
Dec 3, 2025
Merged

refactor: fix CI, use zod v4, and latest method in mcp#332
fasttime merged 25 commits intomainfrom
refactor-fix-ci-failure-and-replace-deprecated-mcpserver-tool

Conversation

@lumirlumir
Copy link
Member

@lumirlumir lumirlumir commented Nov 27, 2025

Prerequisites checklist

What is the purpose of this pull request?

In this PR, I've made several updates, particularly for @eslint/mcp.

Unfortunately, some of the problems have recently arisen in the rewrite repository, so this PR includes a bit of changes especially for @eslint/mcp.

This PR includes the following fixes:

1. Upgrade @modelcontextprotocol/sdk to v1.23.0 and zod to v4

Two days ago, @modelcontextprotocol/sdk@1.23.0 was released.

https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/1.23.0

Shortly after that release, our CI began failing with the TS2589: Type instantiation is excessively deep and possibly infinite error.

I tried to resolve it myself but couldn't find a suitable solution, so I opened an issue in @modelcontextprotocol/sdk: modelcontextprotocol/typescript-sdk#1180

The issue was traced to the newly introduced Zod v4 support in @modelcontextprotocol/sdk@1.23.0.

This only affected the eslint/rewrite repository because the dev-dependency knip uses Zod v4 internally, while @eslint/mcp depends on Zod v3, causing a version conflict. The SDK team provided a clear explanation here: modelcontextprotocol/typescript-sdk#1180 (comment)

To avoid the conflict, I've bumped Zod to v4. Zod v4 offers v3 compatibility via zod/v3, so no code changes were necessary.

2. Replace deprecated mcpServer.tool usage with mcpServer.registerTool

Per the JSDoc comments in @modelcontextprotocol/sdk, mcpServer.tool is deprecated, so I've replaced it with the recommended mcpServer.registerTool.

image

3. The recently released prettier@3.7.1 has caused formatting errors:

Yesterday, prettier@3.7.1 was released and caused formatting errors, particularly in .ts files.

I've updated it accordingly, which introduced some additional code diffs.

What changes did you make? (Give an overview)

In this PR, I've fixed CI and use zod v4, and latest method in mcp

Related Issues

Ref: modelcontextprotocol/typescript-sdk#1180 (comment)

Is there anything you'd like reviewers to focus on?

The behavior of MCP has not changed, so I've marked the prefix as refactor, though I'm not sure about that.

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Nov 27, 2025
@lumirlumir lumirlumir changed the title refactor: fix CI failure and use registerTool refactor: fix CI failure and use registerTool in MCP Nov 27, 2025
@lumirlumir
Copy link
Member Author

The CI failure appears to be a regression in @modelcontextprotocol/sdk@1.23.0, which was released yesterday.

I've opened an issue about it in @modelcontextprotocol/sdk: modelcontextprotocol/typescript-sdk#1180

@lumirlumir lumirlumir changed the title refactor: fix CI failure and use registerTool in MCP refactor: replace deprecated tool with registerTool in @eslint/mcp Nov 27, 2025
@lumirlumir lumirlumir moved this from Needs Triage to Implementing in Triage Nov 27, 2025
@lumirlumir lumirlumir changed the title refactor: replace deprecated tool with registerTool in @eslint/mcp fix: use zod v4, v10_config_lookup_from_file and latest method in mcp Nov 28, 2025
@eslint-github-bot

This comment was marked as resolved.

@lumirlumir lumirlumir changed the title fix: use zod v4, v10_config_lookup_from_file and latest method in mcp fix: use zod v4, v10 flag and latest method in mcp Nov 28, 2025
@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Nov 28, 2025
@lumirlumir lumirlumir changed the title fix: use zod v4, v10 flag and latest method in mcp refactor: fix CI and use zod v4, and latest method in mcp Nov 28, 2025
@lumirlumir lumirlumir removed the bug Something isn't working label Nov 28, 2025
@lumirlumir lumirlumir moved this from Implementing to Needs Triage in Triage Nov 28, 2025
Comment on lines +26 to +27
$schema: "http://json-schema.org/draft-07/schema#",
additionalProperties: false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I don't add these two lines, the tests fail, so I've added them.

However, I'm not sure whether this is considered a user-facing change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to re-add these lines. These were removed in commit 45842c0 to fix compatibility with version 1.22.0 of @modelcontextprotocol/sdk.

@lumirlumir lumirlumir marked this pull request as ready for review November 28, 2025 07:10
@lumirlumir lumirlumir changed the title refactor: fix CI and use zod v4, and latest method in mcp refactor: fix CI, use zod v4, and latest method in mcp Nov 28, 2025
@fasttime fasttime moved this from Needs Triage to Triaging in Triage Dec 2, 2025
@fasttime fasttime moved this from Triaging to Evaluating in Triage Dec 2, 2025
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.22.0",
"@modelcontextprotocol/sdk": "^1.23.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With @modelcontextprotocol/sdk 1.23.0, the build completes without issues. Anyway, with version 1.24.1 (latest at the time of writing), I'm getting a type error:

$ npm run build

> @eslint/mcp@0.2.0 build
> tsc

../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts:1:25 - error TS7016: Could not find a declaration file for module 'express'. '.../rewrite/node_modules/express/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/express` if it exists or add a new declaration (.d.ts) file containing `declare module 'express';`

1 import { Express } from 'express';
                          ~~~~~~~~~


Found 1 error in ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts:1

The error can be fixed by installing @types/express as the message suggests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated it in 8ad6bc6 👍

Also, I've added @types/express to the ignoreDependencies for knip in fb2b0dd, because knip reported an error indicating that the dependency was unused.

@fasttime fasttime moved this from Evaluating to Implementing in Triage Dec 2, 2025
Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, my impression is that @modelcontextprotocol/sdk isn't very mature, considering that each of the last three minor releases (1.22.0, 1.23.0 and 1.24.0) seems to introduce a new incompatibility. If this trend continues, I'd suggest shrinking the version range for that package with a tilde.

Copilot AI review requested due to automatic review settings December 3, 2025 03:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses CI failures caused by TypeScript type instantiation errors and updates dependencies to resolve version conflicts. The primary issue stemmed from @modelcontextprotocol/sdk v1.23.0 introducing Zod v4 support, which conflicted with the repository's use of both Zod v3 (in @eslint/mcp) and Zod v4 (used internally by knip). The PR upgrades to Zod v4 with v3 compatibility, updates the MCP SDK to the latest version, and incorporates formatting changes from a newer Prettier release.

Key changes:

  • Upgraded zod from v3.24.4 to v4.1.13 using the zod/v3 compatibility import path
  • Updated @modelcontextprotocol/sdk to v1.24.1 and migrated from deprecated mcpServer.tool() to mcpServer.registerTool()
  • Updated prettier to v3.7.3, resulting in formatting adjustments to TypeScript files

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/mcp/package.json Updated dependencies: @modelcontextprotocol/sdk to v1.24.1, zod to v4.1.13, prettier to v3.7.3; added @types/express devDependency
packages/mcp/src/mcp-server.js Changed zod import to use v3 compatibility layer and migrated to registerTool() API
packages/mcp/tests/mcp-server.test.js Updated JSON schema assertion to include $schema and additionalProperties fields required by new SDK version
packages/core/tests/types/types.test.ts Prettier formatting adjustments to TypeScript generic type declarations
packages/core/src/types.ts Prettier formatting adjustments to TypeScript interface declarations
package.json Updated prettier to v3.7.3 in root package.json

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lumirlumir lumirlumir requested a review from fasttime December 3, 2025 03:28
Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! I've verified that the MCP server behaves as expected after these changes.

@fasttime fasttime merged commit 785573c into main Dec 3, 2025
25 checks passed
@fasttime fasttime deleted the refactor-fix-ci-failure-and-replace-deprecated-mcpserver-tool branch December 3, 2025 11:57
@github-project-automation github-project-automation bot moved this from Implementing to Complete in Triage Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants