mcpserve

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 12 Imported by: 0

README

mcpserve

Project Badges

Standalone, decoupled MCP server for the TinyWasm ecosystem.

Key Features

  • Zero Coupling: Domain handlers don't import mcpserve or mcp-go.
  • Reflection: Automatic tool discovery via GetMCPToolsMetadata().
  • IDE Auto-Config: Support for VS Code and Antigravity.

Documentation

Usage

h.mcp = mcpserve.NewHandler(config, handlers, tui, exit)
h.mcp.ConfigureIDEs()
go h.mcp.Serve()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryData

type BinaryData struct {
	MimeType string
	Data     []byte
}

BinaryData represents binary response from tools (imported from handlers)

type Config

type Config struct {
	Port            string
	RootDir         string
	FrameworkName   string
	ServerPort      string
	ServerOutputDir string
	WebPublicDir    string
	Logger          func(messages ...any)
}

Config contains the configuration for Handler

type Handler

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

Handler handles the Model Context Protocol server and configuration

func NewHandler

func NewHandler(config Config, toolHandlers []any, tui TuiInterface, exitChan chan bool) *Handler

NewHandler creates a new MCP handler with minimal dependencies

func (*Handler) ConfigureIDEs

func (h *Handler) ConfigureIDEs()

ConfigureIDEs automatically configures supported IDEs with this MCP server

func (*Handler) Serve

func (h *Handler) Serve()

Serve starts the Model Context Protocol server for LLM integration via HTTP

type IDEInfo

type IDEInfo struct {
	ID           string
	Name         string
	GetConfigDir func() (string, error)
}

IDEInfo represents a supported IDE and its configuration path resolver

type ParameterMetadata

type ParameterMetadata struct {
	Name        string
	Description string
	Required    bool
	Type        string // "string", "number", "boolean"
	EnumValues  []string
	Default     any
}

ParameterMetadata describes a tool parameter

type ToolExecutor

type ToolExecutor func(args map[string]any, progress chan<- any)

ToolExecutor defines how a tool should be executed Handlers implement this to provide execution logic without exposing internals args: map of parameter name to value from MCP request progress: channel to send responses back to caller

  • string: text messages
  • BinaryData: binary data (images, files)

type ToolMetadata

type ToolMetadata struct {
	Name        string
	Description string
	Parameters  []ParameterMetadata
	Execute     ToolExecutor // Handler provides execution function
}

ToolMetadata provides MCP tool configuration metadata This is the standard interface that all handlers should implement

type TuiInterface

type TuiInterface interface {
	RefreshUI()
}

TuiInterface defines what the MCP handler needs from the TUI

Jump to

Keyboard shortcuts

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