mcpgateway

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package mcpgateway implements the ark MCP gateway — an http.Handler that exposes ArkAgent capabilities as callable MCP tools over the standard SSE transport.

A single Gateway instance serves all namespaces. Agent-as-tool calls are translated into task queue submissions; results are returned as MCP tool responses. The agent runtime is unchanged — it never knows whether a task came from a pipeline step or a tool call.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GatewayURL

func GatewayURL(baseURL, namespace, agentName string) string

GatewayURL returns the base agent URL for the given agent. Used by the ArkAgent reconciler to build the resolved MCPServerSpec.URL. The agent runtime MCP client appends /tools/list and /tools/call to this URL.

Types

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway is the MCP SSE gateway. It implements http.Handler. A single instance is registered as a controller-runtime Runnable and serves all namespaces on a dedicated port.

func New

func New(c client.Client, tq queue.TaskQueue, taskQueueURL string) *Gateway

New creates a Gateway. tq is the operator's shared task queue (used as the fallback for standalone agents). taskQueueURL is the base connection URL used when opening agent-specific queue streams.

func (*Gateway) ServeHTTP

func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP dispatches incoming requests to the appropriate handler.

GET  /healthz                                        → 200 OK
GET  /namespaces/:ns/agents/:name/sse                → MCP SSE session (external clients)
POST /namespaces/:ns/agents/:name/message            → MCP JSON-RPC message (SSE transport)
POST /namespaces/:ns/agents/:name/tools/list         → REST tools discovery (agent runtime)
POST /namespaces/:ns/agents/:name/tools/call         → REST tool call (agent runtime)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL