mcp

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package mcp implements a Model Context Protocol server over stdio so an AI agent can operate Interceptor as a set of tools. It is a thin, well-described front end over the running control API (REST) — every tool maps to an endpoint the web UI also uses, so the human and the agent drive the same engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity added in v0.4.0

type Activity struct {
	Tool    string `json:"tool"`
	Summary string `json:"summary"` // short, human-readable gist of the arguments
	OK      bool   `json:"ok"`
	Result  string `json:"result"` // first line of the result / error, truncated
	Ms      int64  `json:"ms"`
}

Activity is a record of one MCP tool call. It is reported to the control plane after every call so a human watching the UI can see, live, what the AI is doing — which tool, the gist of the arguments, and the outcome.

type Server

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

Server is an MCP stdio server backed by the control API at base.

func New

func New(baseURL string) *Server

New builds an MCP server that talks to the control API at baseURL (e.g. http://127.0.0.1:9966).

func (*Server) Serve

func (s *Server) Serve(in io.Reader, out io.Writer) error

Serve runs the JSON-RPC loop over newline-delimited messages until EOF.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the MCP "Streamable HTTP" transport over a single endpoint. A client POSTs a JSON-RPC message (or batch) and receives the JSON-RPC response as application/json. The server is stateless — no Mcp-Session-Id is required — and offers no server-initiated SSE stream, so GET returns 405 (per spec). This lets a hosted/remote agent drive Interceptor without launching the `interceptor mcp` stdio subcommand. Bind localhost-only; it shares the (unauthenticated, local) trust model of the control API it fronts.

func (*Server) ToolNames added in v0.6.0

func (s *Server) ToolNames() []string

ToolNames returns the registered tool names in registration order, so the UI descriptor / docs can be checked against the actual toolset (no silent drift).

Jump to

Keyboard shortcuts

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