diff --git a/pkg/agentic/commands_setup.go b/pkg/agentic/commands_setup.go index 987cefd..d337bde 100644 --- a/pkg/agentic/commands_setup.go +++ b/pkg/agentic/commands_setup.go @@ -7,6 +7,7 @@ import ( "dappco.re/go/agent/pkg/setup" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -53,8 +54,8 @@ func (s *PrepSubsystem) handleSetup(_ context.Context, options core.Options) cor return result } -func (s *PrepSubsystem) registerSetupTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerSetupTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_setup", Description: "Scaffold a workspace with .core config files and optional templates.", }, s.setupTool) diff --git a/pkg/agentic/commit.go b/pkg/agentic/commit.go index 24b0aac..f6abda5 100644 --- a/pkg/agentic/commit.go +++ b/pkg/agentic/commit.go @@ -7,6 +7,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -37,8 +38,8 @@ func (s *PrepSubsystem) handleCommit(_ context.Context, options core.Options) co return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerCommitTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerCommitTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_commit", Description: "Write the final workspace dispatch record to the local journal after verify completes.", }, s.commitTool) diff --git a/pkg/agentic/content.go b/pkg/agentic/content.go index 1015af3..d9d995c 100644 --- a/pkg/agentic/content.go +++ b/pkg/agentic/content.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -387,53 +388,53 @@ func (s *PrepSubsystem) handleContentSchemaGenerate(ctx context.Context, options return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerContentTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerContentTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_generate", Description: "Generate content from a prompt or a brief/template pair using the platform AI provider abstraction.", }, s.contentGenerate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_batch_generate", Description: "Generate content for a stored batch specification.", }, s.contentBatchGenerate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_batch", Description: "Generate content for a stored batch specification using the legacy MCP alias.", }, s.contentBatchGenerate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_brief_create", Description: "Create a reusable content brief for later generation work.", }, s.contentBriefCreate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_brief_get", Description: "Read a reusable content brief by ID or slug.", }, s.contentBriefGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_brief_list", Description: "List reusable content briefs with optional category and product filters.", }, s.contentBriefList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_status", Description: "Read batch content generation status by batch ID.", }, s.contentStatus) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_usage_stats", Description: "Read AI usage statistics for the content pipeline.", }, s.contentUsageStats) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_from_plan", Description: "Generate content using stored plan context and an optional provider override.", }, s.contentFromPlan) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "content_schema_generate", Description: "Generate SEO schema JSON-LD for article, FAQ, or how-to content.", }, s.contentSchemaGenerate) diff --git a/pkg/agentic/dispatch.go b/pkg/agentic/dispatch.go index 137aa51..80cc7a2 100644 --- a/pkg/agentic/dispatch.go +++ b/pkg/agentic/dispatch.go @@ -9,6 +9,7 @@ import ( "dappco.re/go/agent/pkg/messages" core "dappco.re/go/core" "dappco.re/go/core/process" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -44,8 +45,8 @@ type DispatchOutput struct { OutputFile string `json:"output_file,omitempty"` } -func (s *PrepSubsystem) registerDispatchTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerDispatchTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_dispatch", Description: "Dispatch a subagent (Gemini, Codex, or Claude) to work on a task. Preps a sandboxed workspace first, then spawns the agent inside it. Templates: conventions, security, coding.", }, s.dispatch) diff --git a/pkg/agentic/epic.go b/pkg/agentic/epic.go index 0656515..c03011a 100644 --- a/pkg/agentic/epic.go +++ b/pkg/agentic/epic.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -35,8 +36,8 @@ type ChildRef struct { URL string `json:"url"` } -func (s *PrepSubsystem) registerEpicTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerEpicTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_create_epic", Description: "Create an epic issue with child issues on Forge. Each task becomes a child issue linked via checklist. Optionally auto-dispatch agents to work each child.", }, s.createEpic) diff --git a/pkg/agentic/issue.go b/pkg/agentic/issue.go index c1f3833..661308b 100644 --- a/pkg/agentic/issue.go +++ b/pkg/agentic/issue.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -284,75 +285,75 @@ func (s *PrepSubsystem) handleIssueRecordArchive(ctx context.Context, options co return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerIssueTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerIssueTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "issue_create", Description: "Create a tracked platform issue with title, type, priority, labels, and optional sprint assignment.", }, s.issueCreate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_issue_create", Description: "Create a tracked platform issue with title, type, priority, labels, and optional sprint assignment.", }, s.issueCreate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "issue_get", Description: "Read a tracked platform issue by slug.", }, s.issueGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_issue_get", Description: "Read a tracked platform issue by slug.", }, s.issueGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "issue_list", Description: "List tracked platform issues with optional status, type, sprint, and limit filters.", }, s.issueList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_issue_list", Description: "List tracked platform issues with optional status, type, sprint, and limit filters.", }, s.issueList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "issue_update", Description: "Update fields on a tracked platform issue by slug.", }, s.issueUpdate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_issue_update", Description: "Update fields on a tracked platform issue by slug.", }, s.issueUpdate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "issue_assign", Description: "Assign an agent or user to a tracked platform issue by slug.", }, s.issueAssign) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_issue_assign", Description: "Assign an agent or user to a tracked platform issue by slug.", }, s.issueAssign) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "issue_comment", Description: "Add a comment to a tracked platform issue.", }, s.issueComment) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_issue_comment", Description: "Add a comment to a tracked platform issue.", }, s.issueComment) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "issue_report", Description: "Post a structured report comment to a tracked platform issue.", }, s.issueReport) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_issue_report", Description: "Post a structured report comment to a tracked platform issue.", }, s.issueReport) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "issue_archive", Description: "Archive a tracked platform issue by slug.", }, s.issueArchive) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_issue_archive", Description: "Archive a tracked platform issue by slug.", }, s.issueArchive) diff --git a/pkg/agentic/lang.go b/pkg/agentic/lang.go index 2246975..f07b22a 100644 --- a/pkg/agentic/lang.go +++ b/pkg/agentic/lang.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -74,13 +75,13 @@ func (s *PrepSubsystem) cmdLangList(_ core.Options) core.Result { return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerLanguageTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerLanguageTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "lang_detect", Description: "Detect the primary language for a workspace or repository path.", }, s.langDetect) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "lang_list", Description: "List supported language identifiers.", }, s.langList) diff --git a/pkg/agentic/message.go b/pkg/agentic/message.go index 0e6c305..83ba668 100644 --- a/pkg/agentic/message.go +++ b/pkg/agentic/message.go @@ -9,6 +9,7 @@ import ( "dappco.re/go/agent/pkg/messages" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -125,30 +126,30 @@ func (s *PrepSubsystem) handleMessageConversation(ctx context.Context, options c return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerMessageTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerMessageTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_message_send", Description: "Send a direct message between two agents within a workspace.", }, s.messageSend) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agent_send", Description: "Send a direct message between two agents within a workspace.", }, s.messageSend) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_message_inbox", Description: "List messages delivered to an agent within a workspace.", }, s.messageInbox) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agent_inbox", Description: "List messages delivered to an agent within a workspace.", }, s.messageInbox) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_message_conversation", Description: "List the chronological conversation between two agents within a workspace.", }, s.messageConversation) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agent_conversation", Description: "List the chronological conversation between two agents within a workspace.", }, s.messageConversation) diff --git a/pkg/agentic/mirror.go b/pkg/agentic/mirror.go index 50c7155..03625f3 100644 --- a/pkg/agentic/mirror.go +++ b/pkg/agentic/mirror.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -31,8 +32,8 @@ type MirrorSync struct { Skipped string `json:"skipped,omitempty"` } -func (s *PrepSubsystem) registerMirrorTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerMirrorTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_mirror", Description: "Sync Forge repos to GitHub mirrors. Pushes Forge main to GitHub dev branch and creates a PR. Respects file count limits for CodeRabbit review.", }, s.mirror) diff --git a/pkg/agentic/phase.go b/pkg/agentic/phase.go index d3eebc0..5b7c647 100644 --- a/pkg/agentic/phase.go +++ b/pkg/agentic/phase.go @@ -7,6 +7,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -81,18 +82,18 @@ func (s *PrepSubsystem) handlePhaseAddCheckpoint(ctx context.Context, options co return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerPhaseTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerPhaseTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "phase_get", Description: "Get a phase by plan slug and phase order.", }, s.phaseGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "phase_update_status", Description: "Update a phase status by plan slug and phase order.", }, s.phaseUpdateStatus) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "phase_add_checkpoint", Description: "Append a checkpoint note to a phase.", }, s.phaseAddCheckpoint) diff --git a/pkg/agentic/plan.go b/pkg/agentic/plan.go index 03784bb..27b5ab9 100644 --- a/pkg/agentic/plan.go +++ b/pkg/agentic/plan.go @@ -11,6 +11,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -247,98 +248,98 @@ func (s *PrepSubsystem) handlePlanList(ctx context.Context, options core.Options return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerPlanTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerPlanTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_create", Description: "Create an implementation plan. Plans track phased work with acceptance criteria, status lifecycle (draft → ready → in_progress → needs_verification → verified → approved), and per-phase progress.", }, s.planCreate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_read", Description: "Read an implementation plan by ID. Returns the full plan with all phases, criteria, and status.", }, s.planRead) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_get", Description: "Read an implementation plan by slug with progress details and full phases.", }, s.planGetCompat) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_update", Description: "Update an implementation plan. Supports partial updates — only provided fields are changed. Use this to advance status, update phases, or add notes.", }, s.planUpdate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_delete", Description: "Delete an implementation plan by ID. Permanently removes the plan file.", }, s.planDelete) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_list", Description: "List implementation plans. Supports filtering by status (draft, ready, in_progress, etc.) and repo.", }, s.planList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_create", Description: "Create a plan using the slug-based compatibility surface described by the platform RFC.", }, s.planCreateCompat) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_read", Description: "Read a plan using the legacy plain-name MCP alias.", }, s.planRead) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_get", Description: "Read a plan by slug with progress details and full phases.", }, s.planGetCompat) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_list", Description: "List plans using the compatibility surface with slug and progress summaries.", }, s.planListCompat) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_check", Description: "Check whether a plan or phase is complete using the compatibility surface.", }, s.planCheck) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_check", Description: "Check whether a plan or phase is complete using the compatibility surface.", }, s.planCheck) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_update", Description: "Update a plan using the legacy plain-name MCP alias.", }, s.planUpdate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_update_status", Description: "Update a plan lifecycle status by slug.", }, s.planUpdateStatusCompat) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_update_status", Description: "Update a plan lifecycle status by slug.", }, s.planUpdateStatusCompat) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_delete", Description: "Delete a plan using the legacy plain-name MCP alias.", }, s.planDelete) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_archive", Description: "Archive a plan by slug without deleting the local record.", }, s.planArchiveCompat) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_archive", Description: "Archive a plan by slug without deleting the local record.", }, s.planArchiveCompat) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "plan_from_issue", Description: "Create an implementation plan from a tracked issue slug or ID.", }, s.planFromIssue) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_plan_from_issue", Description: "Create an implementation plan from a tracked issue slug or ID.", }, s.planFromIssue) diff --git a/pkg/agentic/plan_test.go b/pkg/agentic/plan_test.go index 6affb2a..fa8b869 100644 --- a/pkg/agentic/plan_test.go +++ b/pkg/agentic/plan_test.go @@ -8,6 +8,7 @@ import ( "testing" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -201,15 +202,13 @@ func TestPlan_ReadPlan_Ugly_EmptyFile(t *testing.T) { } func TestPlan_RegisterPlanTools_Good_RegistersAgenticCompatibilityAliases(t *testing.T) { - server := mcpsdk.NewServer(&mcpsdk.Implementation{Name: "test", Version: "0.1.0"}, &mcpsdk.ServerOptions{ - Capabilities: &mcpsdk.ServerCapabilities{ - Tools: &mcpsdk.ToolCapabilities{ListChanged: true}, - }, - }) + svc, err := coremcp.New(coremcp.Options{Unrestricted: true}) + require.NoError(t, err) subsystem := &PrepSubsystem{} - subsystem.RegisterTools(server) + subsystem.RegisterTools(svc) + server := svc.Server() client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "test", Version: "0.1.0"}, nil) clientTransport, serverTransport := mcpsdk.NewInMemoryTransports() diff --git a/pkg/agentic/platform_tools.go b/pkg/agentic/platform_tools.go index 83c3eb0..92f1983 100644 --- a/pkg/agentic/platform_tools.go +++ b/pkg/agentic/platform_tools.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -93,103 +94,103 @@ type SubscriptionBudgetUpdateInput struct { Limits map[string]any `json:"limits"` } -func (s *PrepSubsystem) registerPlatformTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerPlatformTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_sync_push", Description: "Push completed dispatch state to the platform API for fleet-wide context sharing.", }, s.syncPushTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_sync_pull", Description: "Pull fleet-wide context from the platform API into the local cache.", }, s.syncPullTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_sync_status", Description: "Read platform sync status for an agent, including queued items and last push/pull times.", }, s.syncStatusTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_auth_provision", Description: "Provision a platform API key for an authenticated agent user.", }, s.authProvisionTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_auth_revoke", Description: "Revoke a platform API key by key ID.", }, s.authRevokeTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_fleet_register", Description: "Register a fleet node with models, capabilities, and platform metadata.", }, s.fleetRegisterTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_fleet_heartbeat", Description: "Send a fleet heartbeat update with status and optional compute budget.", }, s.fleetHeartbeatTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_fleet_deregister", Description: "Deregister a fleet node from the platform API.", }, s.fleetDeregisterTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_fleet_nodes", Description: "List registered fleet nodes with optional status and platform filters.", }, s.fleetNodesTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_fleet_task_assign", Description: "Assign a task to a fleet node.", }, s.fleetTaskAssignTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_fleet_task_complete", Description: "Complete a fleet task and report result, findings, changes, and report data.", }, s.fleetTaskCompleteTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_fleet_task_next", Description: "Ask the platform for the next available fleet task for an agent.", }, s.fleetTaskNextTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_fleet_stats", Description: "Read aggregate fleet activity statistics.", }, s.fleetStatsTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_fleet_events", Description: "Read the next fleet event from the platform SSE stream, falling back to polling when needed.", }, s.fleetEventsTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_credits_award", Description: "Award credits to a fleet node for completed work.", }, s.creditsAwardTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_credits_balance", Description: "Read the current credit balance for a fleet node.", }, s.creditsBalanceTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_credits_history", Description: "List credit history entries for a fleet node.", }, s.creditsHistoryTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_subscription_detect", Description: "Detect provider capabilities available to a fleet node.", }, s.subscriptionDetectTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_subscription_budget", Description: "Read the current compute budget for a fleet node.", }, s.subscriptionBudgetTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_subscription_budget_update", Description: "Update the compute budget limits for a fleet node.", }, s.subscriptionBudgetUpdateTool) diff --git a/pkg/agentic/pr.go b/pkg/agentic/pr.go index 0379b03..a97de98 100644 --- a/pkg/agentic/pr.go +++ b/pkg/agentic/pr.go @@ -7,6 +7,7 @@ import ( core "dappco.re/go/core" forge_types "dappco.re/go/core/forge/types" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -30,8 +31,8 @@ type CreatePROutput struct { Pushed bool `json:"pushed"` } -func (s *PrepSubsystem) registerCreatePRTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerCreatePRTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_create_pr", Description: "Create a pull request from an agent workspace. Pushes the branch to Forge and opens a PR. Links to the source issue if one was tracked.", }, s.createPR) @@ -165,43 +166,43 @@ func (s *PrepSubsystem) createPR(ctx context.Context, _ *mcp.CallToolRequest, in }, nil } -func (s *PrepSubsystem) registerPRTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerPRTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_pr_get", Description: "Read a pull request from Forge by repository and pull request number.", }, s.prGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "pr_get", Description: "Read a pull request from Forge by repository and pull request number.", }, s.prGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_pr_list", Description: "List pull requests across Forge repos. Filter by org, repo, and state.", }, s.prList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "pr_list", Description: "List pull requests across Forge repos. Filter by org, repo, and state.", }, s.prList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_pr_merge", Description: "Merge a pull request on Forge by repository and pull request number.", }, s.prMerge) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "pr_merge", Description: "Merge a pull request on Forge by repository and pull request number.", }, s.prMerge) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_pr_close", Description: "Close a pull request on Forge by repository and pull request number.", }, s.closePR) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "pr_close", Description: "Close a pull request on Forge by repository and pull request number.", }, s.closePR) @@ -362,15 +363,15 @@ type PRInfo struct { URL string `json:"url"` } -func (s *PrepSubsystem) registerListPRsTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerListPRsTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_list_prs", Description: "List pull requests across Forge repos. Filter by org, repo, and state (open/closed/all).", }, s.listPRs) } -func (s *PrepSubsystem) registerClosePRTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerClosePRTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_close_pr", Description: "Close a pull request on Forge by repository and pull request number.", }, s.closePR) diff --git a/pkg/agentic/pr_test.go b/pkg/agentic/pr_test.go index 6c9feab..b5e1201 100644 --- a/pkg/agentic/pr_test.go +++ b/pkg/agentic/pr_test.go @@ -13,6 +13,7 @@ import ( core "dappco.re/go/core" "dappco.re/go/core/forge" forge_types "dappco.re/go/core/forge/types" + coremcp "dappco.re/go/mcp/pkg/mcp" mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -262,15 +263,13 @@ func TestPr_ClosePR_Good_Success(t *testing.T) { } func TestPr_RegisterPRTools_Good_RegistersPRAliases(t *testing.T) { - server := mcpsdk.NewServer(&mcpsdk.Implementation{Name: "test", Version: "0.1.0"}, &mcpsdk.ServerOptions{ - Capabilities: &mcpsdk.ServerCapabilities{ - Tools: &mcpsdk.ToolCapabilities{ListChanged: true}, - }, - }) + svc, err := coremcp.New(coremcp.Options{Unrestricted: true}) + require.NoError(t, err) s := &PrepSubsystem{ServiceRuntime: core.NewServiceRuntime(testCore, AgentOptions{})} - s.registerPRTools(server) + s.registerPRTools(svc) + server := svc.Server() client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "test", Version: "0.1.0"}, nil) clientTransport, serverTransport := mcpsdk.NewInMemoryTransports() diff --git a/pkg/agentic/prep.go b/pkg/agentic/prep.go index 2c716cc..3db2262 100644 --- a/pkg/agentic/prep.go +++ b/pkg/agentic/prep.go @@ -419,52 +419,52 @@ func (s *PrepSubsystem) SetCore(c *core.Core) { } // subsystem := agentic.NewPrep() -// subsystem.RegisterTools(server) -func (s *PrepSubsystem) RegisterTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +// subsystem.RegisterTools(svc) +func (s *PrepSubsystem) RegisterTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_prep_workspace", Description: "Prepare an agent workspace: clone repo, create branch, build prompt with context.", }, s.prepWorkspace) - s.registerDispatchTool(server) - s.registerStatusTool(server) - s.registerResumeTool(server) - mcp.AddTool(server, &mcp.Tool{ + s.registerDispatchTool(svc) + s.registerStatusTool(svc) + s.registerResumeTool(svc) + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_complete", Description: "Run the completion pipeline (QA → PR → Verify → Commit → Ingest → Poke) in the background.", }, s.completeTool) - s.registerCommitTool(server) - s.registerCreatePRTool(server) - s.registerListPRsTool(server) - s.registerClosePRTool(server) - s.registerEpicTool(server) - s.registerMirrorTool(server) - s.registerRemoteDispatchTool(server) - s.registerRemoteStatusTool(server) - s.registerReviewQueueTool(server) - s.registerPlatformTools(server) - s.registerShutdownTools(server) - s.registerSessionTools(server) - s.registerStateTools(server) - s.registerPhaseTools(server) - s.registerTaskTools(server) - s.registerPromptTools(server) - s.registerTemplateTools(server) - s.registerIssueTools(server) - s.registerMessageTools(server) - s.registerSprintTools(server) - s.registerPRTools(server) - s.registerContentTools(server) - s.registerLanguageTools(server) - s.registerSetupTool(server) + s.registerCommitTool(svc) + s.registerCreatePRTool(svc) + s.registerListPRsTool(svc) + s.registerClosePRTool(svc) + s.registerEpicTool(svc) + s.registerMirrorTool(svc) + s.registerRemoteDispatchTool(svc) + s.registerRemoteStatusTool(svc) + s.registerReviewQueueTool(svc) + s.registerPlatformTools(svc) + s.registerShutdownTools(svc) + s.registerSessionTools(svc) + s.registerStateTools(svc) + s.registerPhaseTools(svc) + s.registerTaskTools(svc) + s.registerPromptTools(svc) + s.registerTemplateTools(svc) + s.registerIssueTools(svc) + s.registerMessageTools(svc) + s.registerSprintTools(svc) + s.registerPRTools(svc) + s.registerContentTools(svc) + s.registerLanguageTools(svc) + s.registerSetupTool(svc) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_scan", Description: "Scan Forge repos for open issues with actionable labels (agentic, help-wanted, bug).", }, s.scan) - s.registerPlanTools(server) - s.registerWatchTool(server) + s.registerPlanTools(svc) + s.registerWatchTool(svc) } // subsystem := agentic.NewPrep() diff --git a/pkg/agentic/prep_test.go b/pkg/agentic/prep_test.go index c40e52a..5fd5914 100644 --- a/pkg/agentic/prep_test.go +++ b/pkg/agentic/prep_test.go @@ -12,6 +12,7 @@ import ( core "dappco.re/go/core" "dappco.re/go/core/forge" + coremcp "dappco.re/go/mcp/pkg/mcp" mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -692,15 +693,13 @@ func TestPrep_OnStartup_Good_RegistersPlatformCommandAlias(t *testing.T) { } func TestPrep_RegisterTools_Good_RegistersCompletionTool(t *testing.T) { - server := mcpsdk.NewServer(&mcpsdk.Implementation{Name: "test", Version: "0.1.0"}, &mcpsdk.ServerOptions{ - Capabilities: &mcpsdk.ServerCapabilities{ - Tools: &mcpsdk.ToolCapabilities{ListChanged: true}, - }, - }) + svc, err := coremcp.New(coremcp.Options{Unrestricted: true}) + require.NoError(t, err) subsystem := &PrepSubsystem{} - subsystem.RegisterTools(server) + subsystem.RegisterTools(svc) + server := svc.Server() client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "test", Version: "0.1.0"}, nil) clientTransport, serverTransport := mcpsdk.NewInMemoryTransports() diff --git a/pkg/agentic/prompt_version.go b/pkg/agentic/prompt_version.go index fa23287..c3998f4 100644 --- a/pkg/agentic/prompt_version.go +++ b/pkg/agentic/prompt_version.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -79,13 +80,13 @@ func (s *PrepSubsystem) promptVersion(_ context.Context, _ *mcp.CallToolRequest, }, nil } -func (s *PrepSubsystem) registerPromptTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerPromptTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "prompt_version", Description: "Read the current prompt snapshot for a workspace.", }, s.promptVersionTool) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_prompt_version", Description: "Read the current prompt snapshot for a workspace.", }, s.promptVersionTool) diff --git a/pkg/agentic/remote.go b/pkg/agentic/remote.go index 55d1feb..9106ecf 100644 --- a/pkg/agentic/remote.go +++ b/pkg/agentic/remote.go @@ -5,6 +5,7 @@ package agentic import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -31,8 +32,8 @@ type RemoteDispatchOutput struct { Error string `json:"error,omitempty"` } -func (s *PrepSubsystem) registerRemoteDispatchTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerRemoteDispatchTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_dispatch_remote", Description: "Dispatch a task to a remote core-agent (e.g. Charon). The remote agent preps a workspace and spawns the task locally on its hardware.", }, s.dispatchRemote) diff --git a/pkg/agentic/remote_status.go b/pkg/agentic/remote_status.go index a891d04..84ace79 100644 --- a/pkg/agentic/remote_status.go +++ b/pkg/agentic/remote_status.go @@ -5,6 +5,7 @@ package agentic import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -19,8 +20,8 @@ type RemoteStatusOutput struct { Error string `json:"error,omitempty"` } -func (s *PrepSubsystem) registerRemoteStatusTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerRemoteStatusTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_status_remote", Description: "Check workspace status on a remote core-agent (e.g. Charon). Shows running, completed, blocked, and failed agents.", }, s.statusRemote) diff --git a/pkg/agentic/resume.go b/pkg/agentic/resume.go index 5c96b03..cee894e 100644 --- a/pkg/agentic/resume.go +++ b/pkg/agentic/resume.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -27,8 +28,8 @@ type ResumeOutput struct { Prompt string `json:"prompt,omitempty"` } -func (s *PrepSubsystem) registerResumeTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerResumeTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_resume", Description: "Resume a blocked agent workspace. Writes ANSWER.md if an answer is provided, then relaunches the agent with instructions to read it and continue.", }, s.resume) diff --git a/pkg/agentic/review_queue.go b/pkg/agentic/review_queue.go index 33d0ff1..9b1ac07 100644 --- a/pkg/agentic/review_queue.go +++ b/pkg/agentic/review_queue.go @@ -8,6 +8,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -55,8 +56,8 @@ func compileRetryAfterPattern() *regexp.Regexp { return pattern } -func (s *PrepSubsystem) registerReviewQueueTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerReviewQueueTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_review_queue", Description: "Process the review queue. Supports coderabbit, codex, or both reviewers, auto-merges clean ones on GitHub, dispatches fix agents for findings, and respects rate limits.", }, s.reviewQueue) diff --git a/pkg/agentic/session.go b/pkg/agentic/session.go index dd882fb..3e7dd7f 100644 --- a/pkg/agentic/session.go +++ b/pkg/agentic/session.go @@ -7,6 +7,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -306,102 +307,102 @@ func (s *PrepSubsystem) handleSessionReplay(ctx context.Context, options core.Op return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerSessionTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerSessionTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_start", Description: "Start a new agent session for a plan and capture the initial context summary.", }, s.sessionStart) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_start", Description: "Start a new agent session for a plan and capture the initial context summary.", }, s.sessionStart) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_get", Description: "Read a session by session ID, including saved context, work log, and artifacts.", }, s.sessionGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_get", Description: "Read a session by session ID, including saved context, work log, and artifacts.", }, s.sessionGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_list", Description: "List sessions with optional plan and status filters.", }, s.sessionList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_list", Description: "List sessions with optional plan and status filters.", }, s.sessionList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_continue", Description: "Continue an existing session from its latest saved state.", }, s.sessionContinue) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_continue", Description: "Continue an existing session from its latest saved state.", }, s.sessionContinue) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_end", Description: "End a session with status, summary, and optional handoff notes.", }, s.sessionEnd) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_end", Description: "End a session with status, summary, and optional handoff notes.", }, s.sessionEnd) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_complete", Description: "Mark a session completed with status, summary, and optional handoff notes.", }, s.sessionEnd) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_complete", Description: "Mark a session completed with status, summary, and optional handoff notes.", }, s.sessionEnd) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_log", Description: "Add a typed work log entry to a stored session.", }, s.sessionLog) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_log", Description: "Add a typed work log entry to a stored session.", }, s.sessionLog) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_artifact", Description: "Record a created, modified, deleted, or reviewed artifact for a stored session.", }, s.sessionArtifact) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_artifact", Description: "Record a created, modified, deleted, or reviewed artifact for a stored session.", }, s.sessionArtifact) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_handoff", Description: "Prepare a stored session for handoff and mark it handed_off with summary, blockers, and next-step context.", }, s.sessionHandoff) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_handoff", Description: "Prepare a stored session for handoff and mark it handed_off with summary, blockers, and next-step context.", }, s.sessionHandoff) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_resume", Description: "Resume a paused or handed-off stored session and return handoff context.", }, s.sessionResume) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_resume", Description: "Resume a paused or handed-off stored session and return handoff context.", }, s.sessionResume) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "session_replay", Description: "Build replay context for a stored session from its work log, checkpoints, errors, and artifacts.", }, s.sessionReplay) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_session_replay", Description: "Build replay context for a stored session from its work log, checkpoints, errors, and artifacts.", }, s.sessionReplay) diff --git a/pkg/agentic/shutdown.go b/pkg/agentic/shutdown.go index e246b19..a6653bb 100644 --- a/pkg/agentic/shutdown.go +++ b/pkg/agentic/shutdown.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -18,18 +19,18 @@ type ShutdownOutput struct { Message string `json:"message"` } -func (s *PrepSubsystem) registerShutdownTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerShutdownTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_dispatch_start", Description: "Start the dispatch queue runner. Unfreezes the queue and begins draining.", }, s.dispatchStart) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_dispatch_shutdown", Description: "Graceful shutdown: stop accepting new jobs, let running agents finish. Queue is frozen.", }, s.shutdownGraceful) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_dispatch_shutdown_now", Description: "Hard shutdown: kill all running agents immediately. Queue is cleared.", }, s.shutdownNow) diff --git a/pkg/agentic/sprint.go b/pkg/agentic/sprint.go index 3dacd09..1529809 100644 --- a/pkg/agentic/sprint.go +++ b/pkg/agentic/sprint.go @@ -6,6 +6,7 @@ import ( "context" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -153,48 +154,48 @@ func (s *PrepSubsystem) handleSprintArchive(ctx context.Context, options core.Op return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerSprintTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerSprintTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "sprint_create", Description: "Create a tracked platform sprint with goal, schedule, and metadata.", }, s.sprintCreate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_sprint_create", Description: "Create a tracked platform sprint with goal, schedule, and metadata.", }, s.sprintCreate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "sprint_get", Description: "Read a tracked platform sprint by slug.", }, s.sprintGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_sprint_get", Description: "Read a tracked platform sprint by slug.", }, s.sprintGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "sprint_list", Description: "List tracked platform sprints with optional status and limit filters.", }, s.sprintList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_sprint_list", Description: "List tracked platform sprints with optional status and limit filters.", }, s.sprintList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "sprint_update", Description: "Update fields on a tracked platform sprint by slug.", }, s.sprintUpdate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_sprint_update", Description: "Update fields on a tracked platform sprint by slug.", }, s.sprintUpdate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "sprint_archive", Description: "Archive a tracked platform sprint by slug.", }, s.sprintArchive) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_sprint_archive", Description: "Archive a tracked platform sprint by slug.", }, s.sprintArchive) diff --git a/pkg/agentic/state.go b/pkg/agentic/state.go index 79fd749..500172f 100644 --- a/pkg/agentic/state.go +++ b/pkg/agentic/state.go @@ -7,6 +7,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -141,39 +142,39 @@ func (s *PrepSubsystem) handleStateDelete(ctx context.Context, options core.Opti return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerStateTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerStateTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "state_set", Description: "Set a typed workspace state value for a plan so later sessions can reuse shared context.", }, s.stateSet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_state_set", Description: "Set a typed workspace state value for a plan so later sessions can reuse shared context.", }, s.stateSet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "state_get", Description: "Get a workspace state value for a plan by key.", }, s.stateGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_state_get", Description: "Get a workspace state value for a plan by key.", }, s.stateGet) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "state_list", Description: "List all stored workspace state values for a plan, with optional type or category filtering.", }, s.stateList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_state_list", Description: "List all stored workspace state values for a plan, with optional type or category filtering.", }, s.stateList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "state_delete", Description: "Delete a stored workspace state value for a plan by key.", }, s.stateDelete) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_state_delete", Description: "Delete a stored workspace state value for a plan by key.", }, s.stateDelete) diff --git a/pkg/agentic/status.go b/pkg/agentic/status.go index eba6ac8..a8453db 100644 --- a/pkg/agentic/status.go +++ b/pkg/agentic/status.go @@ -7,6 +7,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -145,8 +146,8 @@ type BlockedInfo struct { Question string `json:"question"` } -func (s *PrepSubsystem) registerStatusTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerStatusTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_status", Description: "List agent workspaces and their status (running, completed, blocked, failed). Supports workspace, status, and limit filters. Shows blocked agents with their questions.", }, s.status) diff --git a/pkg/agentic/task.go b/pkg/agentic/task.go index eda306b..ddddbdd 100644 --- a/pkg/agentic/task.go +++ b/pkg/agentic/task.go @@ -7,6 +7,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -122,30 +123,30 @@ func (s *PrepSubsystem) handleTaskToggle(ctx context.Context, options core.Optio return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerTaskTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerTaskTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "task_create", Description: "Create a plan task by plan slug and phase order.", }, s.taskCreate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_task_create", Description: "Create a plan task by plan slug and phase order.", }, s.taskCreate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "task_update", Description: "Update a plan task status or notes by plan slug, phase order, and task identifier.", }, s.taskUpdate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_task_update", Description: "Update a plan task status or notes by plan slug, phase order, and task identifier.", }, s.taskUpdate) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "task_toggle", Description: "Toggle a plan task between pending and completed.", }, s.taskToggle) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_task_toggle", Description: "Toggle a plan task between pending and completed.", }, s.taskToggle) diff --git a/pkg/agentic/template.go b/pkg/agentic/template.go index 632ee60..e2f02ba 100644 --- a/pkg/agentic/template.go +++ b/pkg/agentic/template.go @@ -10,6 +10,7 @@ import ( "dappco.re/go/agent/pkg/lib" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" "gopkg.in/yaml.v3" ) @@ -148,18 +149,18 @@ func (s *PrepSubsystem) handleTemplateCreatePlan(ctx context.Context, options co return core.Result{Value: output, OK: true} } -func (s *PrepSubsystem) registerTemplateTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerTemplateTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "template_list", Description: "List available plan templates with variables, category, and phase counts.", }, s.templateList) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "template_preview", Description: "Preview a plan template with variable substitution before creating a stored plan.", }, s.templatePreview) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "template_create_plan", Description: "Create a stored plan from an embedded YAML template, with optional activation.", }, s.templateCreatePlan) diff --git a/pkg/agentic/watch.go b/pkg/agentic/watch.go index 838815b..fcd4081 100644 --- a/pkg/agentic/watch.go +++ b/pkg/agentic/watch.go @@ -7,6 +7,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -34,8 +35,8 @@ type WatchResult struct { PRURL string `json:"pr_url,omitempty"` } -func (s *PrepSubsystem) registerWatchTool(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *PrepSubsystem) registerWatchTool(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agentic_watch", Description: "Watch running/queued agent workspaces until they all complete. Sends progress notifications as each agent finishes. Returns summary when all are done.", }, s.watch) diff --git a/pkg/brain/brain.go b/pkg/brain/brain.go index a6a337c..a8e3e7d 100644 --- a/pkg/brain/brain.go +++ b/pkg/brain/brain.go @@ -9,8 +9,8 @@ import ( "dappco.re/go/agent/pkg/agentic" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "dappco.re/go/mcp/pkg/mcp/ide" - "github.com/modelcontextprotocol/go-sdk/mcp" ) // keyPath := core.JoinPath(home, ".claude", "brain.key") @@ -43,9 +43,9 @@ func New(bridge *ide.Bridge) *Subsystem { func (s *Subsystem) Name() string { return "brain" } // subsystem := brain.New(nil) -// subsystem.RegisterTools(server) -func (s *Subsystem) RegisterTools(server *mcp.Server) { - s.registerBrainTools(server) +// subsystem.RegisterTools(svc) +func (s *Subsystem) RegisterTools(svc *coremcp.Service) { + s.registerBrainTools(svc) } // _ = subsystem.Shutdown(context.Background()) diff --git a/pkg/brain/bridge_test.go b/pkg/brain/bridge_test.go index e12ee04..622447e 100644 --- a/pkg/brain/bridge_test.go +++ b/pkg/brain/bridge_test.go @@ -12,9 +12,9 @@ import ( core "dappco.re/go/core" providerws "dappco.re/go/core/ws" + coremcp "dappco.re/go/mcp/pkg/mcp" "dappco.re/go/mcp/pkg/mcp/ide" "github.com/gorilla/websocket" - mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -64,16 +64,18 @@ func testBridge(t *testing.T) *ide.Bridge { func TestBrain_RegisterTools_Good(t *testing.T) { sub := New(nil) - srv := mcpsdk.NewServer(&mcpsdk.Implementation{Name: "test", Version: "0.1.0"}, nil) - sub.RegisterTools(srv) + svc, err := coremcp.New(coremcp.Options{Unrestricted: true}) + require.NoError(t, err) + sub.RegisterTools(svc) } func TestDirect_RegisterTools_Good(t *testing.T) { t.Setenv("CORE_BRAIN_URL", "http://localhost") t.Setenv("CORE_BRAIN_KEY", "test-key") sub := NewDirect() - srv := mcpsdk.NewServer(&mcpsdk.Implementation{Name: "test", Version: "0.1.0"}, nil) - sub.RegisterTools(srv) + svc, err := coremcp.New(coremcp.Options{Unrestricted: true}) + require.NoError(t, err) + sub.RegisterTools(svc) } // --- Subsystem with connected bridge --- diff --git a/pkg/brain/direct.go b/pkg/brain/direct.go index e6f5db2..cc580c5 100644 --- a/pkg/brain/direct.go +++ b/pkg/brain/direct.go @@ -58,29 +58,29 @@ func NewDirect() *DirectSubsystem { func (s *DirectSubsystem) Name() string { return "brain" } // subsystem := brain.NewDirect() -// subsystem.RegisterTools(server) -func (s *DirectSubsystem) RegisterTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +// subsystem.RegisterTools(svc) +func (s *DirectSubsystem) RegisterTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "brain_remember", Description: "Store a memory in OpenBrain. Types: fact, decision, observation, plan, convention, architecture, research, documentation, service, bug, pattern, context, procedure.", }, s.remember) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "brain_recall", Description: "Semantic search across OpenBrain memories. Returns memories ranked by similarity. Use agent_id 'cladius' for Cladius's memories.", }, s.recall) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "brain_forget", Description: "Remove a memory from OpenBrain by ID.", }, s.forget) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "brain_list", Description: "List memories in OpenBrain with optional project, type, agent, and limit filters.", }, s.list) - s.RegisterMessagingTools(server) + s.RegisterMessagingTools(svc) } // _ = subsystem.Shutdown(context.Background()) diff --git a/pkg/brain/messaging.go b/pkg/brain/messaging.go index 4cfbff5..66b5b84 100644 --- a/pkg/brain/messaging.go +++ b/pkg/brain/messaging.go @@ -7,23 +7,24 @@ import ( "dappco.re/go/agent/pkg/agentic" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "github.com/modelcontextprotocol/go-sdk/mcp" ) // subsystem := brain.NewDirect() -// subsystem.RegisterMessagingTools(server) -func (s *DirectSubsystem) RegisterMessagingTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +// subsystem.RegisterMessagingTools(svc) +func (s *DirectSubsystem) RegisterMessagingTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agent_send", Description: "Send a message to another agent. Direct, chronological, not semantic.", }, s.sendMessage) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agent_inbox", Description: "Check your inbox — latest messages sent to you.", }, s.inbox) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "agent_conversation", Description: "View conversation thread with a specific agent.", }, s.conversation) diff --git a/pkg/brain/tools.go b/pkg/brain/tools.go index db5d8d2..26e34ea 100644 --- a/pkg/brain/tools.go +++ b/pkg/brain/tools.go @@ -7,6 +7,7 @@ import ( "time" core "dappco.re/go/core" + coremcp "dappco.re/go/mcp/pkg/mcp" "dappco.re/go/mcp/pkg/mcp/ide" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -132,23 +133,23 @@ type ListOutput struct { Memories []Memory `json:"memories"` } -func (s *Subsystem) registerBrainTools(server *mcp.Server) { - mcp.AddTool(server, &mcp.Tool{ +func (s *Subsystem) registerBrainTools(svc *coremcp.Service) { + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "brain_remember", Description: "Store a memory in the shared OpenBrain knowledge store. Persists decisions, observations, conventions, research, plans, bugs, or architecture knowledge for other agents.", }, s.brainRemember) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "brain_recall", Description: "Semantic search across the shared OpenBrain knowledge store. Returns memories ranked by similarity to your query, with optional filtering.", }, s.brainRecall) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "brain_forget", Description: "Remove a memory from the shared OpenBrain knowledge store. Permanently deletes from both database and vector index.", }, s.brainForget) - mcp.AddTool(server, &mcp.Tool{ + mcp.AddTool(svc.Server(), &mcp.Tool{ Name: "brain_list", Description: "List memories in the shared OpenBrain knowledge store. Supports filtering by project, type, and agent. No vector search -- use brain_recall for semantic queries.", }, s.brainList) diff --git a/pkg/monitor/monitor.go b/pkg/monitor/monitor.go index 2fc608d..6705dfa 100644 --- a/pkg/monitor/monitor.go +++ b/pkg/monitor/monitor.go @@ -56,7 +56,7 @@ func resultString(result core.Result) (string, bool) { // service.Start(context.Background()) type Subsystem struct { *core.ServiceRuntime[Options] - server *mcp.Server + svc *coremcp.Service interval time.Duration cancel context.CancelFunc wg sync.WaitGroup @@ -145,11 +145,11 @@ func (m *Subsystem) debug(msg string) { // name := service.Name() // "monitor" func (m *Subsystem) Name() string { return "monitor" } -// service.RegisterTools(server) -func (m *Subsystem) RegisterTools(server *mcp.Server) { - m.server = server +// service.RegisterTools(svc) +func (m *Subsystem) RegisterTools(svc *coremcp.Service) { + m.svc = svc - server.AddResource(&mcp.Resource{ + svc.Server().AddResource(&mcp.Resource{ Name: "Agent Status", URI: "status://agents", Description: "Current status of all agent workspaces", @@ -297,8 +297,8 @@ func (m *Subsystem) check(ctx context.Context) { combinedMessage := core.Join("\n", statusMessages...) m.notify(ctx, combinedMessage) - if m.server != nil { - m.server.ResourceUpdated(ctx, &mcp.ResourceUpdatedNotificationParams{ + if m.svc != nil { + m.svc.Server().ResourceUpdated(ctx, &mcp.ResourceUpdatedNotificationParams{ URI: "status://agents", }) } @@ -465,11 +465,11 @@ func (m *Subsystem) checkInbox() string { } func (m *Subsystem) notify(ctx context.Context, message string) { - if m.server == nil { + if m.svc == nil { return } - for session := range m.server.Sessions() { + for session := range m.svc.Server().Sessions() { session.Log(ctx, &mcp.LoggingMessageParams{ Level: "info", Logger: "monitor",