Documentation
¶
Overview ¶
Package mcpserver implements a JSON-RPC 2.0 MCP stdio server supporting both newline-delimited JSON (NDJSON) and Content-Length header framing.
Index ¶
Constants ¶
const ( ServerName = "agy-ptc" ServerVersion = version.Version DefaultProtocolVersion = "2025-03-26" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPOptions ¶
type HTTPOptions struct {
Addr string // e.g. "127.0.0.1:8787"
Path string // defaults to "/mcp"
Token string // optional Bearer token required on /mcp
AllowOrigin string // optional CORS Access-Control-Allow-Origin value
}
HTTPOptions configures the MCP Streamable HTTP transport.
type Server ¶
type Server struct {
Engine *ptcruntime.Engine
// contains filtered or unexported fields
}
Server speaks MCP JSON-RPC 2.0 over stdio (NDJSON & Content-Length) and Streamable HTTP.
func NewServer ¶
func NewServer(engine *ptcruntime.Engine) *Server
NewServer wraps an Engine in an MCP server with default agy-ptc options.
func NewServerWithOptions ¶
func NewServerWithOptions(engine *ptcruntime.Engine, opts ServerOptions) *Server
NewServerWithOptions wraps an Engine in an MCP server with custom host profile options.
func (*Server) HTTPHandler ¶
func (s *Server) HTTPHandler(opts HTTPOptions) http.Handler
HTTPHandler returns an http.Handler implementing MCP Streamable HTTP over POST /mcp plus a lightweight GET /healthz probe.
type ServerOptions ¶
type ServerOptions struct {
ServerName string
ServerVersion string // defaults to version.Version
Instructions string // returned in initialize.result.instructions (MCP 2025-03-26+)
ExecDescription string // custom description for the exec tool
DefaultMaxOutBytes int // advertised default inline output cap (0 -> 9600)
SkillResourceURI string // optional MCP resource URI, e.g. "mcplex://skill"
SkillResourceName string
SkillResourceText string
}
ServerOptions customizes server identity, initialize instructions, exec description, and skill resources.