mcpserver

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallGraphEdge

type CallGraphEdge struct {
	Caller      string    `json:"caller"`
	Callee      string    `json:"callee"`
	Location    *Location `json:"location,omitempty"`
	LoopDepth   int       `json:"loop_depth"`
	InLoop      bool      `json:"in_loop"`
	IsExpensive bool      `json:"is_expensive"`
}

CallGraphEdge describes a caller-callee edge in a call graph.

type CallGraphFunction

type CallGraphFunction struct {
	Name         string    `json:"name"`
	Path         string    `json:"path,omitempty"`
	Location     *Location `json:"location,omitempty"`
	LocalCost    int       `json:"local_cost"`
	MaxLoopDepth int       `json:"max_loop_depth"`
}

CallGraphFunction describes a function node in a call graph.

type CallGraphResponse

type CallGraphResponse struct {
	Functions []CallGraphFunction `json:"functions"`
	Edges     []CallGraphEdge     `json:"edges"`
}

CallGraphResponse is the result of a call_graph query.

type DefinitionResponse

type DefinitionResponse struct {
	Found    bool      `json:"found"`
	Location *Location `json:"location,omitempty"`
}

DefinitionResponse is the result of a go-to-definition query.

type DescribeServerInput

type DescribeServerInput struct{}

DescribeServerInput is the (empty) input for the describe_server tool.

type DescribeServerResponse

type DescribeServerResponse struct {
	Name                 string           `json:"name"`
	Version              string           `json:"version"`
	ReadOnly             bool             `json:"read_only"`
	DefaultWorkspaceRoot string           `json:"default_workspace_root,omitempty"`
	Capabilities         []ToolDescriptor `json:"capabilities"`
}

DescribeServerResponse describes server metadata and capabilities.

type Diagnostic

type Diagnostic struct {
	Source   string `json:"source,omitempty"`
	Code     string `json:"code,omitempty"`
	Severity string `json:"severity"`
	Message  string `json:"message"`
	Range    Range  `json:"range"`
}

Diagnostic is a parse or lint diagnostic for a source location.

type DiagnosticsInput

type DiagnosticsInput struct {
	Path             *string `json:"path,omitempty"`
	Content          *string `json:"content,omitempty"`
	WorkspaceRoot    *string `json:"workspace_root,omitempty"`
	IncludeWorkspace bool    `json:"include_workspace,omitempty"`
}

DiagnosticsInput is input for the diagnostics tool.

type DiagnosticsResponse

type DiagnosticsResponse struct {
	Files []FileDiagnostics `json:"files"`
}

DiagnosticsResponse is the result of a diagnostics query.

type DocumentQueryInput

type DocumentQueryInput struct {
	Path          string  `json:"path"`
	Content       *string `json:"content,omitempty"`
	WorkspaceRoot *string `json:"workspace_root,omitempty"`
}

DocumentQueryInput is input for tools that query an entire document.

type DocumentSymbol

type DocumentSymbol struct {
	Name   string `json:"name"`
	Kind   string `json:"kind"`
	Detail string `json:"detail,omitempty"`
	Path   string `json:"path"`
	Range  Range  `json:"range"`
}

DocumentSymbol describes a top-level symbol in a document.

type DocumentSymbolsResponse

type DocumentSymbolsResponse struct {
	Symbols []DocumentSymbol `json:"symbols"`
}

DocumentSymbolsResponse is the result of a document symbols query.

type FileDiagnostics

type FileDiagnostics struct {
	Path        string       `json:"path"`
	Diagnostics []Diagnostic `json:"diagnostics"`
}

FileDiagnostics groups diagnostics for a single file.

type FileQueryInput

type FileQueryInput struct {
	Path          string  `json:"path"`
	Line          int     `json:"line"`
	Character     int     `json:"character"`
	Content       *string `json:"content,omitempty"`
	WorkspaceRoot *string `json:"workspace_root,omitempty"`
}

FileQueryInput is common input for tools that query a position in a file.

type HotspotsResponse

type HotspotsResponse struct {
	Functions []SolvedFunctionSummary `json:"functions"`
}

HotspotsResponse is the result of a hotspots query.

type HoverResponse

type HoverResponse struct {
	SymbolName string    `json:"symbol_name,omitempty"`
	Kind       string    `json:"kind,omitempty"`
	Signature  string    `json:"signature,omitempty"`
	Doc        string    `json:"doc,omitempty"`
	DefinedIn  *Location `json:"defined_in,omitempty"`
	Markdown   string    `json:"markdown,omitempty"`
	Found      bool      `json:"found"`
}

HoverResponse is the result of a hover query.

type Location

type Location struct {
	Path         string `json:"path,omitempty"`
	Line         int    `json:"line"`
	Character    int    `json:"character"`
	EndLine      int    `json:"end_line"`
	EndCharacter int    `json:"end_character"`
	Virtual      bool   `json:"virtual,omitempty"`
	VirtualID    string `json:"virtual_id,omitempty"`
}

Location identifies a source position, optionally virtual (e.g. for builtins).

type Option

type Option func(*Server)

func WithEnv

func WithEnv(env *lisp.LEnv) Option

func WithExcludes added in v1.40.0

func WithExcludes(patterns []string) Option

WithExcludes sets glob patterns for files to skip during workspace scanning.

func WithImplementation

func WithImplementation(impl *mcp.Implementation) Option

func WithInstructions

func WithInstructions(instructions string) Option

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithPerfConfig

func WithPerfConfig(cfg *perf.Config) Option

func WithRegistry

func WithRegistry(reg *lisp.PackageRegistry) Option

func WithToolRegistrar

func WithToolRegistrar(register func(*mcp.Server) error) Option

func WithWorkspaceRoot

func WithWorkspaceRoot(root string) Option

type PerfIssue

type PerfIssue struct {
	Rule        string       `json:"rule"`
	Severity    string       `json:"severity"`
	Message     string       `json:"message"`
	Function    string       `json:"function"`
	Path        string       `json:"path,omitempty"`
	Location    *Location    `json:"location,omitempty"`
	Details     []string     `json:"details,omitempty"`
	Fingerprint string       `json:"fingerprint,omitempty"`
	Trace       []TraceEntry `json:"trace,omitempty"`
}

PerfIssue describes a performance issue found by analysis.

type PerfIssuesResponse

type PerfIssuesResponse struct {
	Issues []PerfIssue             `json:"issues"`
	Solved []SolvedFunctionSummary `json:"solved,omitempty"`
}

PerfIssuesResponse is the result of a perf_issues query.

type PerfSelectionInput

type PerfSelectionInput struct {
	WorkspaceRoot *string         `json:"workspace_root,omitempty"`
	Paths         []string        `json:"paths,omitempty"`
	Rules         []string        `json:"rules,omitempty"`
	IncludeTests  bool            `json:"include_tests,omitempty"`
	Top           int             `json:"top,omitempty"`
	Config        *PerfToolConfig `json:"config,omitempty"`
}

PerfSelectionInput is input for the perf_issues, call_graph, and hotspots tools.

type PerfToolConfig

type PerfToolConfig struct {
	ExpensiveFunctions      []string       `json:"expensive_functions,omitempty"`
	LoopKeywords            []string       `json:"loop_keywords,omitempty"`
	FunctionCosts           map[string]int `json:"function_costs,omitempty"`
	SuppressionPrefix       string         `json:"suppression_prefix,omitempty"`
	HotPathThreshold        int            `json:"hot_path_threshold,omitempty"`
	ScalingWarningThreshold int            `json:"scaling_warning_threshold,omitempty"`
	ScalingErrorThreshold   int            `json:"scaling_error_threshold,omitempty"`
}

PerfToolConfig allows overriding performance analysis settings per-request.

type Position

type Position struct {
	Line      int `json:"line"`
	Character int `json:"character"`
}

Position is a 0-based line/character cursor position.

type Range

type Range struct {
	Start Position `json:"start"`
	End   Position `json:"end"`
}

Range is a start/end span in a source document.

type ReferencesInput

type ReferencesInput struct {
	Path               string  `json:"path"`
	Line               int     `json:"line"`
	Character          int     `json:"character"`
	Content            *string `json:"content,omitempty"`
	WorkspaceRoot      *string `json:"workspace_root,omitempty"`
	IncludeDeclaration bool    `json:"include_declaration,omitempty"`
}

ReferencesInput is input for the references tool.

type ReferencesResponse

type ReferencesResponse struct {
	SymbolName string     `json:"symbol_name,omitempty"`
	References []Location `json:"references"`
}

ReferencesResponse is the result of a find-references query.

type Server

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

func New

func New(opts ...Option) *Server

func (*Server) MCPServer

func (s *Server) MCPServer() *mcp.Server

func (*Server) RunStdio

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

type SolvedFunctionSummary

type SolvedFunctionSummary struct {
	Name         string    `json:"name"`
	Path         string    `json:"path,omitempty"`
	Location     *Location `json:"location,omitempty"`
	LocalCost    int       `json:"local_cost"`
	TotalScore   int       `json:"total_score"`
	ScalingOrder int       `json:"scaling_order"`
	InCycle      bool      `json:"in_cycle"`
}

SolvedFunctionSummary summarizes a function's resolved performance cost.

type ToolDescriptor

type ToolDescriptor struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

ToolDescriptor describes an MCP tool exposed by the server.

type TraceEntry

type TraceEntry struct {
	Function string    `json:"function"`
	Location *Location `json:"location,omitempty"`
	Note     string    `json:"note,omitempty"`
}

TraceEntry is a single entry in a performance issue trace.

type WorkspaceSymbol

type WorkspaceSymbol struct {
	Name    string `json:"name"`
	Kind    string `json:"kind"`
	Package string `json:"package,omitempty"`
	Path    string `json:"path"`
	Range   Range  `json:"range"`
}

WorkspaceSymbol describes a symbol found across the workspace.

type WorkspaceSymbolsInput

type WorkspaceSymbolsInput struct {
	Query         string  `json:"query"`
	WorkspaceRoot *string `json:"workspace_root,omitempty"`
}

WorkspaceSymbolsInput is input for the workspace_symbols tool.

type WorkspaceSymbolsResponse

type WorkspaceSymbolsResponse struct {
	Symbols []WorkspaceSymbol `json:"symbols"`
}

WorkspaceSymbolsResponse is the result of a workspace symbols query.

Jump to

Keyboard shortcuts

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