-
Notifications
You must be signed in to change notification settings - Fork 84
feat: bundle.json mcp server #309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
msslulu
wants to merge
12
commits into
opentiny:develop
Choose a base branch
from
msslulu:mcp_server
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ae5014b
feat: bundle.json mcp server
msslulu 222c572
feat: validate url
msslulu cab7b53
feat: update code
msslulu debe4fb
feat: update code
msslulu 9db1c10
feat: add code doc
msslulu 5e369a4
feat: update code
msslulu c6895e8
feat: update code
msslulu a7063fe
feat: update code
msslulu a0f9982
feat: update code
msslulu 287f6b2
feat: update code
msslulu d43a226
feat: update code
msslulu e012e4b
feat: add Transactional for method
msslulu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 87 additions & 4 deletions
91
app/src/main/resources/sql/h2/init_data_for_test_v1.0.0.sql
Large diffs are not rendered by default.
Oops, something went wrong.
91 changes: 87 additions & 4 deletions
91
app/src/main/resources/sql/mysql/init_data_for_test_v1.0.0.sql
Large diffs are not rendered by default.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
base/src/main/java/com/tinyengine/it/mcp/config/McpToolsConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package com.tinyengine.it.mcp.config; | ||
|
|
||
|
|
||
| import com.tinyengine.it.mcp.tools.GitFileReaderService; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.ai.tool.ToolCallbackProvider; | ||
| import org.springframework.ai.tool.method.MethodToolCallbackProvider; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.context.annotation.Primary; | ||
|
|
||
| @Configuration | ||
| public class McpToolsConfig { | ||
| private static final Logger log = LoggerFactory.getLogger(McpToolsConfig.class); | ||
|
|
||
|
|
||
| /** | ||
| * 方式一:通过 ToolCallbackProvider 批量注册工具 | ||
| */ | ||
| @Bean | ||
| @Primary | ||
| public ToolCallbackProvider toolCallbackProvider(GitFileReaderService gitFileReaderService) { | ||
|
|
||
|
|
||
| MethodToolCallbackProvider provider = MethodToolCallbackProvider.builder() | ||
| .toolObjects(gitFileReaderService) | ||
| .build(); | ||
| // 立即验证 | ||
| log.info("Tool count from provider: " + provider.getToolCallbacks().length); | ||
| return provider; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
高风险:
pom.xml引入spring-ai-starter-mcp-server-webmvc:1.1.4,但项目父 POM 仍是 Spring Boot3.1.9,这是官方未支持的版本组合,存在直接编译/启动失败风险。文件:
pom.xml(新增spring-ai.version和 MCP starter 的 hunk)影响: Spring AI 1.1.x 官方文档写明支持的是 Spring Boot
3.4.x和3.5.x。当前 PR 没有同步升级 Boot,也没有引入 Spring AI BOM 做版本对齐,部署时很可能在依赖解析、自动配置或运行期出现不兼容。依据: https://docs.spring.io/spring-ai/reference/getting-started.html
高风险: 导入流程实际上没有事务边界,失败后会留下部分已写入的数据。
文件:
base/src/main/java/com/tinyengine/it/mcp/tools/GitFileReaderService.java:58,:111,:321,:352影响:
readFileFromRepo()先更新/创建组件库,再在同类内部调用parseBundle()和bulkCreate()。后两者虽然标了@Transactional,但属于 Spring 自调用,事务代理不会生效;入口方法本身也没有事务。只要中途某次createComponent/createMaterialComponent/createMaterialHistoryComponent失败,就会留下半导入状态,后续需要人工清库修复。中风险: 新导入的组件被硬编码关联到
material_id=1和material_history_id=1,会把任意 bundle 的结果写进默认物料记录。文件:
base/src/main/java/com/tinyengine/it/mcp/tools/GitFileReaderService.java:386-396影响: 这会把工具的行为绑定到固定主键,既不跟随导入上下文,也不校验目标物料是否存在。只要环境里不是“永远只有默认物料 1”,就会产生错误关联,污染既有数据。