[Feature] lithe-mcp 新旧协议回归测试随 #1799 删除后无替代:mcp-protocol.json 无读取方且工具数仍写 17

Open
#2,408 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust, typescript
Domain
devtools, testing

Research direction

Read the protocol contract at rust/contracts/ide-api/v1.md, the existing fixture at rust/fixtures/ide-api/mcp-protocol.json, and rust/crates/ide-host/src/bin/lithe-mcp.rs to understand the current list_tools behavior. Add an integration test in rust/crates/ide-host that launches lithe-mcp over stdio for each fixture mode and checks the protocol metadata and exposed tools. Update the fixture and contract validation command; done means the test covers all three modes and passes on Windows and macOS.

Written by the indexing model from the issue text.

Description

area:ai enhancement P2 platform:cross-platform refactor review: high
Problem to solve / 要解决的问题

Core(Lithe-IDEA/Lithe-core-rust)的 rust/fixtures/ide-api/mcp-protocol.json 已经没有读取方。契约声称的 MCP 协议验证也已经不存在。

  • 以前读取它的是 scripts/ide-mcp/test-ide-mcp.mjs,#1549 起用它在独立的 stdio 会话里分别验证 legacy(2025-11-25)和 modern(2026-07-28)客户端的 tools/list 都带 ttlMs: 0、cacheScope: "private",是 #1544 / #1545 的回归测试。这个脚本在 #1799(0faecba49)随旧客户端一起删除,之后没有补上替代测试。
  • 判定依据:在 Core main 5e69a21 和本仓库 main e813e609e 全仓库搜索 mcp-protocol、providerTools、modernProtocolVersion、test-ide-mcp(含 .github/workflows),只命中文档和功能矩阵:
    • Core rust/contracts/ide-api/v1.md 第 91 行写着 “legacy and modern clients are verified in separate stdio sessions using rust/fixtures/ide-api/mcp-protocol.json”,第 210 行的验证命令仍是 node --test scripts/ide-mcp/test-ide-mcp.mjs。
    • Core rust/contracts/rust-core-api.md 第 461 行、本仓库 docs/viva-migration.md 第 457 行只是提到它。
    • 本仓库 shared/platform-feature-matrix/features/ide-mcp-connection.json 第 63 行把已删除的脚本列为证据。
  • rust/crates/ide-host 现有测试(catalog.rs、lib.rs、failure_log.rs 的单元测试)覆盖工具目录收窄、参数校验和 broker 调度,没有一个测试启动 lithe-mcp 完成 MCP 握手。src/bin/lithe-mcp.rs 里 list_tools 的 with_ttl_ms(0) 和 with_cache_scope(CacheScope::Private) 没有任何测试保护。
  • fixture 内容也已过时:toolCount: 17 是 Core #23(78c065d)删掉 lithe_environment_inspect/configure 和 4 个 lithe_maven_* 工具之前的数量;现在 catalog::tools() 和 host-tool-exposure.json 中 macOS、Windows 两端都是 11 个工具。

保留现状的代价:

  • 升级 rmcp(现在固定 =3.5.0)或修改 list_tools 时,2026-07-28 客户端整体拒连的问题(#1544 / #1545)可能再次出现,而 CI 发现不了。
  • 契约和功能矩阵写的验证方式实际不存在。
  • toolCount: 17 会误导维护者。
  • Agent 设计 #2407 第二阶段要新增 lithe_sessions_search / lithe_sessions_read,届时没有可以同步更新的协议测试。
Proposed solution / 建议方案
  1. 在 rust/crates/ide-host 加集成测试(与二进制一样要求 mcp feature)。用测试临时目录生成连接描述,通过 stdio 启动 lithe-mcp,按 fixture 的三种 modes(legacy、modern、modern-after-initialize)各开一个会话完成握手,断言:
    • tools/list 带 ttlMs: 0 和 cacheScope: "private";
    • 工具数等于 catalog::tools() 在该连接的 toolExposure 下给出的数量;
    • providerTools 列出的工具都在目录里。
      测试不需要真实 IDE。
  2. 修正 fixture:toolCount 改为 11,或者删掉这个字段,改由测试从目录算出,避免以后再次过时。
  3. 把 v1.md 第 91、210 行的验证说明改成新的 cargo test 命令,ide-mcp-connection.json 的证据换成新测试的路径。

风险:测试要等待子进程启动,必须按 write-stable-tests 使用有界等待和超时,并在测试结束时回收进程;Windows 上也要运行。

Target platform / 目标平台

Cross-platform / 跨平台

Area / 模块

AI

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

Alternatives considered / 已考虑的替代方案

删除 mcp-protocol.json,同时删掉契约里关于新旧客户端验证的说明。不推荐:#1544 / #1545 是真实发生过的兼容问题,删掉之后这条回归就完全没有保护。

Additional context / 补充信息
  • 相关:#1544、#1545(缺 ttlMs / cacheScope 导致拒连)、#1549(引入 fixture 和脚本)、#1799(删除脚本)、Core #23(删除 6 个工具)、#2407(Agent 设计,第二阶段新增 MCP 会话工具)。
  • 本单只处理 MCP 协议测试和这个 fixture,不包括功能矩阵中其他指向 #1799 已删除文件的证据。
Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
Dominant language
TypeScript
Stars
1.8k
Forks
151
Avg merge
3h 48m
Merged PRs (30d)
571

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 1lck/Lithe-IDEA

All issues in 1lck/Lithe-IDEA

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.