Documentation
¶
Overview ¶
Package mcp implements a Model Context Protocol server over stdio so an AI agent can operate Interseptor 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 ¶
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"`
Intent string `json:"intent,omitempty"` // the AI's stated "why", if it passed one
}
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 ¶
New builds an MCP server that talks to the control API at baseURL (e.g. http://127.0.0.1:9966).
func (*Server) Call ¶
Call invokes a registered tool by name in-process, returning its text result. It is the seam the autonomous pentest engine (internal/autopwn) uses to drive all tools without a JSON-RPC round-trip. Activity logging + FlagAI History tagging still happen via the tool's own REST calls, exactly as for JSON-RPC: Call routes through the same runTool helper as callTool, so the Activity report (timing, summary, intent, outcome) is emitted identically.
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 Interseptor without launching the `interseptor mcp` stdio subcommand. Bind localhost-only; it shares the (unauthenticated, local) trust model of the control API it fronts.
func (*Server) SetActivityReporter ¶ added in v1.2.0
SetActivityReporter replaces the Activity callback used after each tool call. Pass nil to disable reporting (useful in tests that race SQLite with the async /api/activity POST).