Serve the Pipelines chat tools over a loopback MCP endpoint and register it with Claude Code, Codex and OpenCode chats

This commit is contained in:
2026-11-09 16:34:21 +00:00
parent 3ab029cd7b
commit 9791f09230
33 changed files with 2308 additions and 7 deletions
+30
View File
@@ -0,0 +1,30 @@
package opencode
import (
"log"
"git.a-wan.net/alan/pipelines/internal/chattools"
)
// withPipelinesTools adds the Pipelines MCP server to a chat service's config
// overrides. One OpenCode service serves every chat and its MCP requests name
// no session, so it registers the service's instance endpoint; the server
// attributes each call to the chat whose stream shows it running. The
// operator's own overrides win, including a server they named "pipelines".
// It returns overrides unchanged when the tools are not configured.
func withPipelinesTools(overrides map[string]any) map[string]any {
registry := chattools.Current()
if registry == nil {
return overrides
}
url, err := registry.InstanceURL("opencode")
if err != nil {
log.Printf("OpenCode chat: Pipelines tools not registered: %v", err)
return overrides
}
merged := chattools.OpenCodeConfig(url)
if overrides != nil {
mergeConfig(merged, overrides)
}
return merged
}