mcphttp

package
v0.0.82 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 14 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseMCPToolName

func ParseMCPToolName(mcpName string) string

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) SetDebug

func (s *Server) SetDebug(debug bool)

SetDebug enables debug logging for HTTP requests.

func (*Server) Start

func (s *Server) Start(ctx context.Context, tools []ToolSpec) (url, token string, err error)

Start starts the HTTP server on a random available port. Returns the server URL and auth token for connecting.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop gracefully stops the HTTP server.

func (*Server) Token

func (s *Server) Token() string

Token returns the auth token if running.

func (*Server) URL

func (s *Server) URL() string

URL returns the server URL if running.

type ToolExecutor

type ToolExecutor func(ctx context.Context, name string, args json.RawMessage) (string, error)

ToolExecutor is a function that executes a tool and returns the result.

type ToolSpec

type ToolSpec struct {
	Name        string
	Description string
	Schema      map[string]interface{}
}

ToolSpec describes a tool to expose via MCP.

Jump to

Keyboard shortcuts

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