Files
agentic-coding-workflow/internal/mcp/server.go
T
2026-06-09 23:44:31 +08:00

44 lines
1.3 KiB
Go

package mcp
import (
mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/yan1h/agent-coding-workflow/internal/chat"
"github.com/yan1h/agent-coding-workflow/internal/project"
"github.com/yan1h/agent-coding-workflow/internal/workspace"
)
// ServerDeps 是装配 mcp.Server 所需的下游 service 集合。
type ServerDeps struct {
Caller *CallerResolver
Projects project.ProjectService
Reqs project.RequirementService
Issues project.IssueService
Prototypes project.PrototypeService
Workspaces workspace.WorkspaceService
Templates chat.TemplateService
Messages chat.MessageService
Conversations chat.ConversationService
}
// NewMCPServer 装配 SDK Server 实例并注册所有工具/prompts/resources。
func NewMCPServer(deps ServerDeps) *mcpsdk.Server {
srv := mcpsdk.NewServer(&mcpsdk.Implementation{
Name: "agent-coding-workflow",
Version: "0.1.0",
}, nil)
// Phase F: 16 PM 工具
registerPMTools(srv, deps)
// Phase G: chat / prompts / resources
registerChatTools(srv, deps)
registerPrompts(srv, deps)
registerResources(srv, deps)
return srv
}
// registerChatTools 已在 tools_chat.go 中实现。
// registerResources 已在 resources.go 中实现。
// registerPMTools 已在 tools_pm.go 中实现。