mcpapi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package mcpapi exposes the curated Agent-facing MCP operation subset.

Index

Constants

View Source
const (
	ServerName = "PowerContext Server"
)

Variables

This section is empty.

Functions

func AccessLogMiddleware

func AccessLogMiddleware(logger *slog.Logger) mcp.Middleware

AccessLogMiddleware observes logical MCP protocol requests. It must be installed inside the tracing middleware so the record shares the MCP transport span and request ID; Streamable HTTP frames are logged nowhere.

func NewHTTPHandler

func NewHTTPHandler(server *mcp.Server, options HTTPOptions) http.Handler

NewHTTPHandler exposes a server through MCP Streamable HTTP. Go's standard same-origin protection is explicit so browser behavior does not depend on an SDK compatibility flag; the SDK's localhost DNS-rebinding protection remains enabled.

func NewServer

func NewServer(handler v1.Handler, options Options) (*mcp.Server, error)

NewServer registers only the frozen PowerContext MCP tool surface. The MCP transport calls the same ogen handler used by HTTP; it never loops back over the network.

Types

type ApplicationObserver

type ApplicationObserver interface {
	ObserveApplication(operation, outcome string, started time.Time)
}

ApplicationObserver is the consumer-shaped telemetry boundary needed by direct MCP endpoint calls.

type HTTPOptions

type HTTPOptions struct {
	Stateless      bool
	JSONResponse   bool
	SessionTimeout time.Duration
	Logger         *slog.Logger
}

HTTPOptions configures the official MCP streamable HTTP transport. The defaults preserve sessions and SSE compatibility; JSONResponse is useful for simple clients that do not need server-initiated notifications.

type Options

type Options struct {
	Version              string
	HandoffReportEnabled bool
	ReceivingMiddleware  []mcp.Middleware
	ApplicationObserver  ApplicationObserver
	ApplicationLogger    *slog.Logger
	TracerProvider       trace.TracerProvider
}

Options controls the externally visible MCP surface. Handoff Report tools are omitted entirely unless the feature is enabled.

Jump to

Keyboard shortcuts

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