精简项目:只保留 docker_logs + health + info 三个工具
- 移除 database/middleware 等复杂模块,先聚焦核心功能 - docker_logs:封装 docker logs --tail N <container> - 修复 go.mod 版本为 1.24 匹配 Docker 构建镜像 - Dockerfile 改用 alpine + docker-cli,避免 scratch 无 shell 问题 - docker-compose.yml 简化为单服务定义 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+10
-21
@@ -7,6 +7,16 @@ import (
|
||||
"github.com/mark3labs/mcp-go/server"
|
||||
)
|
||||
|
||||
// Tool 是所有 MCP 工具必须实现的接口。
|
||||
type Tool interface {
|
||||
Name() string
|
||||
Description() string
|
||||
Register(mcpServer *server.MCPServer) error
|
||||
Initialize(ctx context.Context) error
|
||||
Shutdown(ctx context.Context) error
|
||||
HealthCheck(ctx context.Context) error
|
||||
}
|
||||
|
||||
// getArgs 把 req.Params.Arguments 转换为 map[string]any。
|
||||
func getArgs(req mcp.CallToolRequest) map[string]any {
|
||||
if args, ok := req.Params.Arguments.(map[string]any); ok {
|
||||
@@ -14,24 +24,3 @@ func getArgs(req mcp.CallToolRequest) map[string]any {
|
||||
}
|
||||
return map[string]any{}
|
||||
}
|
||||
|
||||
// Tool 是所有 MCP 工具必须实现的接口。
|
||||
// 每个工具模块实现此接口,然后注册到 Registry。
|
||||
type Tool interface {
|
||||
Name() string
|
||||
|
||||
// Description 返回工具的一句话描述
|
||||
Description() string
|
||||
|
||||
// Register 向 MCP Server 注册自己的工具处理器
|
||||
Register(mcpServer *server.MCPServer) error
|
||||
|
||||
// Initialize 建立连接、初始化资源
|
||||
Initialize(ctx context.Context) error
|
||||
|
||||
// Shutdown 释放资源、关闭连接
|
||||
Shutdown(ctx context.Context) error
|
||||
|
||||
// HealthCheck 返回当前工具的连接状态,nil 表示健康
|
||||
HealthCheck(ctx context.Context) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user