Documentation
¶
Overview ¶
Package mcphttp provides an HTTP-based MCP server for tool execution. This package is kept separate to avoid import cycles with internal/llm.
Index ¶
- func ParseMCPToolName(mcpName string) string
- type Server
- func (s *Server) SetDebug(debug bool)
- func (s *Server) Start(ctx context.Context, tools []ToolSpec) (url, token string, err error)
- func (s *Server) StartOnAddress(host string, port int, token string, tools []ToolSpec) (url, actualToken string, err error)
- func (s *Server) Stop(ctx context.Context) error
- func (s *Server) Token() string
- func (s *Server) URL() string
- type ToolExecutor
- type ToolSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseMCPToolName ¶
ParseMCPToolName extracts the original tool name from an MCP-namespaced name. MCP tools from term-llm are namespaced as "mcp__term-llm__<tool>".
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server runs an MCP server over HTTP with token-based authentication. It exposes tools to Claude CLI and executes them using the provided executor.
func NewServer ¶
func NewServer(executor ToolExecutor) *Server
NewServer creates a new HTTP MCP server. The executor function is called to execute tool calls.
func (*Server) Start ¶
Start starts the HTTP server on a random available port on localhost. Returns the server URL and auth token for connecting.
func (*Server) StartOnAddress ¶ added in v0.0.128
func (s *Server) StartOnAddress(host string, port int, token string, tools []ToolSpec) (url, actualToken string, err error)
StartOnAddress starts the HTTP server on a specific host:port. If token is empty, a crypto-random token is generated. Returns the server URL and the auth token used.
type ToolExecutor ¶
ToolExecutor is a function that executes a tool and returns the result.