summaryrefslogtreecommitdiff
path: root/internal/cli/serve.go
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-05-25 04:57:37 +0000
committerClaude <noreply@anthropic.com>2026-05-25 04:57:37 +0000
commite766b4c3ef13181ec6adf90ec4abe9db0129fab1 (patch)
tree760b26fdd0342d1d41371d25a0950e83610ced13 /internal/cli/serve.go
parent1ea57a7dbf4d34045a361e9bba9191de06cd1749 (diff)
feat(api): chatbot-facing MCP server for task orchestration (Phase 3)
Adds a chatbot-facing MCP server mounted at /chatbot/mcp, guarded by the shared API bearer token (new config api_token, wired through SetAPIToken). Tools: submit_task, list_tasks, get_task, get_events, answer_question, accept_task, reject_task, cancel_task. submit_task creates and immediately queues a task, resolving the repository URL from a named project when not given explicitly. To keep the REST API and the MCP surface from drifting, the accept/reject/ cancel/answer operations are extracted into a shared service layer (taskops.go) with typed errors mapped to REST status codes; the existing HTTP handlers now delegate to it. The endpoint is only served when a token is configured and presented as a bearer. https://claude.ai/code/session_01SESwn7kQ7oP62trWw6pc39
Diffstat (limited to 'internal/cli/serve.go')
-rw-r--r--internal/cli/serve.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/cli/serve.go b/internal/cli/serve.go
index b23304b..e545763 100644
--- a/internal/cli/serve.go
+++ b/internal/cli/serve.go
@@ -182,6 +182,11 @@ func serve(addr string) error {
}
srv.SetGitHubWebhookConfig(cfg.WebhookSecret, cfg.Projects)
+ if cfg.APIToken != "" {
+ srv.SetAPIToken(cfg.APIToken)
+ logger.Info("API token configured; chatbot MCP endpoint enabled at /chatbot/mcp")
+ }
+
// Register scripts.
wd, _ := os.Getwd()
srv.SetScripts(api.ScriptRegistry{