Documentation
¶
Overview ¶
Package mcpserver will expose the harness engine as an MCP server.
Lands in v0.2 (stdio mode) and v0.3 (streamable HTTP). When it ships, the tool that runs the agent is named honestly: `harness.run_agent_with_shell_access`. Identity-class enforcement ensures agent clients cannot self-approve permission prompts.
Until then this package is intentionally empty; the architecture doc commits to the surface at § MCP-server surface.
Package mcpserver exposes the harness engine as an MCP server.
stdio variant lands here (this file); streamable HTTP lives in http.go. Per § MCP-server surface, every Command verb is an MCP tool, sessions/profiles/providers/tools/skills are resources, every loaded skill becomes an MCP prompt, and the agent-driving-agent tool is named honestly: `harness.run_agent_with_shell_access`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPHandler ¶
type HTTPHandler struct {
Server *Server
Encoder *auth.Encoder
Revocations *auth.RevocationList
// contains filtered or unexported fields
}
HTTPHandler wraps Server with the MCP streamable-HTTP transport.
Per the MCP spec (2024-11-05), streamable HTTP uses a single endpoint that accepts POST for request/notification + GET for server-initiated events. Mcp-Session-Id header binds a logical MCP session across requests; Last-Event-ID enables stream resumption.
v0.1 supports the POST + GET split with in-memory session tracking; resumption replays only events from the active connection's buffer (full historical replay against the session log is on the agenda once mcpserver formally subscribes to engine buses).
func NewHTTPHandler ¶
func NewHTTPHandler(s *Server, enc *auth.Encoder, rl *auth.RevocationList) *HTTPHandler
NewHTTPHandler returns an HTTP handler wrapping Server.
func (*HTTPHandler) ServeHTTP ¶
func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP dispatches the MCP streamable-HTTP protocol.
POST /mcp → JSON-RPC request, returns immediate JSON response GET /mcp → SSE stream of server-initiated events / notifications
type Server ¶
type Server struct {
Mux *multiplex.Mux
Catalog *resources.Catalog
// IdentityClass is the class assigned to the connecting MCP
// client. v0.1 uses IdentityAgent for every MCP attach per the
// architecture doc.
IdentityClass control.IdentityClass
// Optional token check: when set, the env var
// GOFASTR_HARNESS_TOKEN must equal RequiredToken for the
// connection to be accepted.
RequiredToken string
// contains filtered or unexported fields
}
Server runs the MCP server protocol against an io.Reader / io.Writer pair (stdin/stdout for the stdio variant).