mcp

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIKeyMiddleware

func APIKeyMiddleware(key string) gin.HandlerFunc

APIKeyMiddleware returns a Gin middleware that requires X-API-Key header or api_key query param to match key.

func ToolSchemas

func ToolSchemas() []toolSchema

ToolSchemas returns the JSON Schema definitions for all MCP tools. Exported so tests can verify the count and structure.

Types

type ExecutionStopper

type ExecutionStopper interface {
	StopExecution(executionID string) error
}

ExecutionStopper can kill a running worker process by execution ID.

type MCPServer

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

MCPServer manages SSE sessions and dispatches JSON-RPC tool calls.

func NewServer

func NewServer(
	ws *store.WorkerStore,
	mgr *worker.Manager,
	ts *store.TaskStore,
	ms *store.MessageStore,
	senders map[string]platform.PlatformSenderAdapter,
	execStopper ExecutionStopper,
	sessionClearer SessionClearer,
	es *store.ExecutionStore,
	memStore *store.MemoryStore,
	sessionStore *store.SessionStore,
) *MCPServer

NewServer creates an MCPServer. Call RegisterRoutes to attach it to a Gin router group.

func (*MCPServer) CallTool

func (s *MCPServer) CallTool(name string, args json.RawMessage) (any, error)

CallTool is exported for testing. Production code calls callTool via handleToolCall.

func (*MCPServer) RegisterRoutes

func (s *MCPServer) RegisterRoutes(rg *gin.RouterGroup, apiKey string)

RegisterRoutes attaches auth middleware, /sse, and /messages to the provided router group.

type SessionClearer

type SessionClearer interface {
	ClearSession(sessionKey string)
}

SessionClearer clears dispatcher queues and session contexts for a session.

Jump to

Keyboard shortcuts

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