Skip to content

feat: 添加 MCP 服务器资源规范支持#14796

Open
1lck wants to merge 4 commits intoalibaba:developfrom
1lck:feat/MCP-service
Open

feat: 添加 MCP 服务器资源规范支持#14796
1lck wants to merge 4 commits intoalibaba:developfrom
1lck:feat/MCP-service

Conversation

@1lck
Copy link
Copy Markdown
Contributor

@1lck 1lck commented Mar 30, 2026

What is the purpose of the change

当前 MCP Server 的注册/导入流程只覆盖了服务本身和工具能力,resourceSpecification 在服务端没有真正打通,导致资源规范会被忽略,detail 查询拿不到资源信息,RESOURCE 能力也无法自动推导。

这个 PR 补齐了 MCP Resource Registry 链路,让 MCP Server 在发布、导入、查询、更新、删除时都能正确处理资源规范。

Brief changelog

  • releaseMcpServer 增加资源规范参数透传
  • 更新 AiService 接口,支持资源规范
  • 增加 MCP 资源相关常量和 dataId 模板
  • McpAdminController 中集成资源规范解析逻辑
  • 扩展 McpDetailFormMcpServerDetailInfo,支持返回资源规范
  • McpRequestUtil 中实现资源规范解析
  • 更新 McpServerImportService,支持导入资源规范
  • 扩展 McpServerOperationService,支持资源规范的创建、更新、删除级联处理
  • 增加单元测试覆盖资源规范相关场景

Verifying this change

已通过本地接口复现和定向测试验证:

  • 变更前:resourceSpecification 会被忽略,detail 中没有 resourceSpeccapabilities 中没有 RESOURCE
  • 变更后:resourceSpecification 可被存储,detail 中可返回 resourceSpeccapabilities 中可自动包含 RESOURCE

@github-actions
Copy link
Copy Markdown

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API新增配置参数修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@KomachiSion
Copy link
Copy Markdown
Collaborator

@luoxiner please review this PR.

@KomachiSion
Copy link
Copy Markdown
Collaborator

@1lck ci未通过

@1lck 1lck force-pushed the feat/MCP-service branch from e0fb1cf to 7352dad Compare April 7, 2026 09:28
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 7, 2026

CLA assistant check
All committers have signed the CLA.

1lck added 2 commits April 7, 2026 17:50
- 在 AiGrpcClient 中添加资源规范参数到 releaseMcpServer 方法
- 更新 AiService 接口以支持资源规范参数
- 添加 MCP 资源常量定义和数据 ID 模板
- 在 McpAdminController 中集成资源规范解析和处理逻辑
- 扩展 McpDetailForm 表单以包含资源规范字段
- 实现 McpRequestUtil 中的资源规范解析功能
- 在 McpServerDetailInfo 中添加资源规范属性
- 更新 McpServerImportService 以处理导入的资源规范
- 扩展 McpServerOperationService 支持资源规范创建和更新操作
- 添加相应的单元测试验证资源规范功能
@1lck 1lck force-pushed the feat/MCP-service branch from 7352dad to 12d2747 Compare April 7, 2026 09:56
@1lck 1lck changed the title feat(ai): 添加 MCP 服务器资源规范支持 feat: 添加 MCP 服务器资源规范支持 Apr 7, 2026
@1lck
Copy link
Copy Markdown
Contributor Author

1lck commented Apr 8, 2026

@KomachiSion 好了

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.95652% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ba/nacos/ai/service/McpServerOperationService.java 75.00% 6 Missing and 3 partials ⚠️
...cos/api/ai/model/mcp/McpResourceSpecification.java 78.94% 4 Missing ⚠️
...ba/nacos/api/ai/model/mcp/McpServerDetailInfo.java 33.33% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@1lck
Copy link
Copy Markdown
Contributor Author

1lck commented Apr 8, 2026

已根据 review 调整代码格式问题,并修复了后续 CI 暴露的测试串扰问题,最新提交如下:

  • 769cb7afb fix(ai): resolve checkstyle issues after rebase
  • e91ac0898 test(api): reset AI service mock exception flag

麻烦帮忙再看下,谢谢。

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.

4 participants