mcpserver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package mcpserver implements an MCP stdio server that exposes Dowse's diagnostics and definition capabilities as tools for AI hosts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentBlock

type ContentBlock struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

type DaemonClient

type DaemonClient interface {
	GetDiagnostics(ctx context.Context, file string) ([]byte, error)
	GetBatchDiagnostics(ctx context.Context, files []string) ([]byte, error)
	GetDefinition(ctx context.Context, file string, line, character int) ([]byte, error)
}

DaemonClient abstracts communication with the dowse daemon.

type HTTPDaemonClient

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

HTTPDaemonClient talks to the daemon over its Unix socket HTTP API.

func NewHTTPDaemonClient

func NewHTTPDaemonClient(socketPath string) *HTTPDaemonClient

NewHTTPDaemonClient creates a client that connects to the daemon at socketPath.

func (*HTTPDaemonClient) GetBatchDiagnostics

func (h *HTTPDaemonClient) GetBatchDiagnostics(ctx context.Context, files []string) ([]byte, error)

func (*HTTPDaemonClient) GetDefinition

func (h *HTTPDaemonClient) GetDefinition(ctx context.Context, file string, line, character int) ([]byte, error)

func (*HTTPDaemonClient) GetDiagnostics

func (h *HTTPDaemonClient) GetDiagnostics(ctx context.Context, file string) ([]byte, error)

type Implementation

type Implementation struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type InitializeParams

type InitializeParams struct {
	ProtocolVersion string         `json:"protocolVersion"`
	ClientInfo      Implementation `json:"clientInfo"`
	Capabilities    map[string]any `json:"capabilities,omitempty"`
}

type InitializeResult

type InitializeResult struct {
	ProtocolVersion string           `json:"protocolVersion"`
	ServerInfo      Implementation   `json:"serverInfo"`
	Capabilities    ServerCapability `json:"capabilities"`
}

type InputSchema

type InputSchema struct {
	Type       string                    `json:"type"`
	Properties map[string]PropertySchema `json:"properties"`
	Required   []string                  `json:"required"`
}

type PropertySchema

type PropertySchema struct {
	Type        string          `json:"type"`
	Description string          `json:"description,omitempty"`
	Items       *PropertySchema `json:"items,omitempty"`
}

type Server

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

Server is an MCP server that bridges tool calls to the dowse daemon.

func New

func New(client DaemonClient, allowedTools []string) *Server

New creates an MCP server backed by the given DaemonClient. allowedTools controls which tools are exposed: nil means all tools, a non-nil slice restricts to only the named tools.

func (*Server) Serve

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

Serve starts the MCP server on stdio using newline-delimited JSON-RPC. It blocks until the client disconnects or ctx is cancelled.

func (*Server) ServeChannel

func (s *Server) ServeChannel(ctx context.Context, ch channel.Channel) error

ServeChannel starts the MCP server on the given channel. It blocks until the client disconnects or ctx is cancelled.

type ServerCapability

type ServerCapability struct {
	Tools *ToolsCapability `json:"tools,omitempty"`
}

type ToolDef

type ToolDef struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	InputSchema InputSchema `json:"inputSchema"`
}

type ToolsCallParams

type ToolsCallParams struct {
	Name      string          `json:"name"`
	Arguments json.RawMessage `json:"arguments"`
}

type ToolsCallResult

type ToolsCallResult struct {
	Content []ContentBlock `json:"content"`
	IsError bool           `json:"isError,omitempty"`
}

type ToolsCapability

type ToolsCapability struct{}

type ToolsListResult

type ToolsListResult struct {
	Tools []ToolDef `json:"tools"`
}

Jump to

Keyboard shortcuts

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