mcp

package
v0.140.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package mcp exposes a roost's privileged tools as a role-scoped MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OriginAllowed

func OriginAllowed(r *http.Request) bool

Native MCP clients omit Origin. Browser-originated requests must be same-host to prevent DNS rebinding; reverse proxies preserve the external Host header.

Types

type CallEnvFunc

type CallEnvFunc func(*http.Request) map[string]string

CallEnvFunc supplies trusted per-request identity variables to the privileged tool process.

type CallObserver

type CallObserver func(*http.Request, string, []string, egg.ToolResponse)

CallObserver receives allowed and denied tool-call attempts for centralized auditing.

type Policy

type Policy = config.MCPConfig

Policy aliases the wing.yaml MCP configuration used by the protocol adapter.

type RolePolicy

type RolePolicy = config.MCPRoleConfig

RolePolicy aliases one role in the wing.yaml MCP configuration.

type RolesFunc

type RolesFunc func(*http.Request) []string

RolesFunc resolves all caller roles from the request. Disabled roles contribute no access; tools allowed by any enabled role are included in the caller's maximum subset.

type Server

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

Server is an MCP-over-HTTP (Streamable HTTP) endpoint over a shared ToolRunner, gated by a per-role Policy.

func NewServer

func NewServer(runner *egg.ToolRunner, policy *Policy, rolesOf RolesFunc) *Server

func (*Server) ServeHTTP

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

ServeHTTP handles a single JSON-RPC request per POST (stateless Streamable HTTP).

func (*Server) SetCallEnv

func (s *Server) SetCallEnv(callEnv CallEnvFunc)

func (*Server) SetCallObserver

func (s *Server) SetCallObserver(observer CallObserver)

Jump to

Keyboard shortcuts

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