mcpserver

package
v1.47.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: BSD-3-Clause Imports: 26 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"`
	Truncated      bool                `json:"truncated,omitempty"`
	TotalFunctions int                 `json:"total_functions,omitempty"`
	TotalEdges     int                 `json:"total_edges,omitempty"`
	Meta           *ResponseMeta       `json:"_meta,omitempty"`
}

CallGraphResponse is the result of a call_graph query.

type DefinitionResponse

type DefinitionResponse struct {
	Found    bool          `json:"found"`
	Location *Location     `json:"location,omitempty"`
	Meta     *ResponseMeta `json:"_meta,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"`
	MaxFiles         int     `json:"max_files,omitempty"`
	Offset           int     `json:"offset,omitempty"`
	Severity         *string `json:"severity,omitempty"`
}

DiagnosticsInput is input for the diagnostics tool.

type DiagnosticsResponse

type DiagnosticsResponse struct {
	Files      []FileDiagnostics `json:"files"`
	Truncated  bool              `json:"truncated,omitempty"`
	TotalFiles int               `json:"total_files,omitempty"`
	Meta       *ResponseMeta     `json:"_meta,omitempty"`
}

DiagnosticsResponse is the result of a diagnostics query.

type DocFormals added in v1.41.0

type DocFormals struct {
	Required []string `json:"required"`
	Optional []string `json:"optional,omitempty"`
	Rest     string   `json:"rest,omitempty"`
	Keys     []string `json:"keys,omitempty"`
}

DocFormals describes a function's parameter list.

type DocInput added in v1.41.0

type DocInput struct {
	Query   string   `json:"query,omitempty"`
	Queries []string `json:"queries,omitempty"`
	Package bool     `json:"package,omitempty"`
}

DocInput is input for the doc tool.

type DocPackage added in v1.41.0

type DocPackage struct {
	Name    string      `json:"name"`
	Doc     string      `json:"doc,omitempty"`
	Symbols []DocSymbol `json:"symbols"`
}

DocPackage describes a package for documentation.

type DocResponse added in v1.41.0

type DocResponse struct {
	Found   bool          `json:"found"`
	Symbol  *DocSymbol    `json:"symbol,omitempty"`
	Package *DocPackage   `json:"package,omitempty"`
	Batch   []DocResult   `json:"batch,omitempty"`
	Meta    *ResponseMeta `json:"_meta,omitempty"`
}

DocResponse is the result of the doc tool.

type DocResult added in v1.41.0

type DocResult struct {
	Query  string     `json:"query"`
	Found  bool       `json:"found"`
	Symbol *DocSymbol `json:"symbol,omitempty"`
}

DocResult is the result of a single doc lookup in batch mode.

type DocSymbol added in v1.41.0

type DocSymbol struct {
	Name    string      `json:"name"`
	Kind    string      `json:"kind"`
	Doc     string      `json:"doc,omitempty"`
	Formals *DocFormals `json:"formals,omitempty"`
}

DocSymbol describes a documented symbol.

type DocumentQueryInput

type DocumentQueryInput struct {
	Path          string  `json:"path"`
	Content       *string `json:"content,omitempty"`
	WorkspaceRoot *string `json:"workspace_root,omitempty"`
	Limit         int     `json:"limit,omitempty"`
	Offset        int     `json:"offset,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"`
	Truncated bool             `json:"truncated,omitempty"`
	Total     int              `json:"total,omitempty"`
	Meta      *ResponseMeta    `json:"_meta,omitempty"`
}

DocumentSymbolsResponse is the result of a document symbols query.

type EvalInput added in v1.41.0

type EvalInput struct {
	Expression  string   `json:"expression,omitempty"`
	Expressions []string `json:"expressions,omitempty"`
}

EvalInput is input for the eval tool.

type EvalResponse added in v1.41.0

type EvalResponse struct {
	Value   string        `json:"value"`
	Results []string      `json:"results,omitempty"`
	Batch   []EvalResult  `json:"batch,omitempty"`
	Error   string        `json:"error,omitempty"`
	Meta    *ResponseMeta `json:"_meta,omitempty"`
}

EvalResponse is the result of the eval tool.

type EvalResult added in v1.41.0

type EvalResult struct {
	Expression string `json:"expression"`
	Value      string `json:"value,omitempty"`
	Error      string `json:"error,omitempty"`
}

EvalResult is the result of evaluating a single expression.

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 FormatInput added in v1.41.0

type FormatInput struct {
	Path          string  `json:"path,omitempty"`
	Content       *string `json:"content,omitempty"`
	IndentSize    int     `json:"indent_size,omitempty"`
	CheckOnly     bool    `json:"check_only,omitempty"`
	WorkspaceRoot *string `json:"workspace_root,omitempty"`
}

FormatInput is input for the format tool.

type FormatResponse added in v1.41.0

type FormatResponse struct {
	Formatted string        `json:"formatted"`
	Changed   bool          `json:"changed"`
	Meta      *ResponseMeta `json:"_meta,omitempty"`
}

FormatResponse is the result of the format tool.

type HelpInput added in v1.41.0

type HelpInput struct{}

HelpInput is the (empty) input for the help tool.

type HelpResponse added in v1.41.0

type HelpResponse struct {
	Content string `json:"content"`
}

HelpResponse is the result of the help tool.

type HotspotsResponse

type HotspotsResponse struct {
	Functions []SolvedFunctionSummary `json:"functions"`
	Meta      *ResponseMeta           `json:"_meta,omitempty"`
}

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"`
	Meta       *ResponseMeta `json:"_meta,omitempty"`
}

HoverResponse is the result of a hover query.

type LintInput added in v1.41.0

type LintInput struct {
	Path          string   `json:"path,omitempty"`
	Content       *string  `json:"content,omitempty"`
	WorkspaceRoot *string  `json:"workspace_root,omitempty"`
	Checks        []string `json:"checks,omitempty"`
	Severity      *string  `json:"severity,omitempty"`
	Limit         int      `json:"limit,omitempty"`
	Offset        int      `json:"offset,omitempty"`
}

LintInput is input for the lint tool.

type LintResponse added in v1.41.0

type LintResponse struct {
	Diagnostics []Diagnostic  `json:"diagnostics"`
	Truncated   bool          `json:"truncated,omitempty"`
	Total       int           `json:"total,omitempty"`
	Meta        *ResponseMeta `json:"_meta,omitempty"`
}

LintResponse is the result of the lint tool.

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 WithEnvFactory added in v1.41.0

func WithEnvFactory(factory func() (*lisp.LEnv, error)) Option

WithEnvFactory sets a factory function that creates fresh LEnv instances for the eval and test tools. Each call gets an isolated environment. Embedders (e.g., substrate) should use this to inject their full runtime (shirocore builtins, test harness, etc.) into eval/test environments.

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"`
	Truncated   bool                    `json:"truncated,omitempty"`
	TotalIssues int                     `json:"total_issues,omitempty"`
	Meta        *ResponseMeta           `json:"_meta,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"`
	Limit              int     `json:"limit,omitempty"`
	Offset             int     `json:"offset,omitempty"`
}

ReferencesInput is input for the references tool.

type ReferencesResponse

type ReferencesResponse struct {
	SymbolName string        `json:"symbol_name,omitempty"`
	References []Location    `json:"references"`
	Truncated  bool          `json:"truncated,omitempty"`
	Total      int           `json:"total,omitempty"`
	Meta       *ResponseMeta `json:"_meta,omitempty"`
}

ReferencesResponse is the result of a find-references query.

type ResponseMeta added in v1.41.0

type ResponseMeta struct {
	WorkspaceRoot string `json:"workspace_root,omitempty"`
	ElapsedMs     int64  `json:"elapsed_ms"`
	FileCount     int    `json:"file_count,omitempty"`
}

ResponseMeta provides metadata about the tool response.

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 TestInput added in v1.41.0

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

TestInput is input for the test tool.

type TestResponse added in v1.41.0

type TestResponse struct {
	Path   string        `json:"path"`
	Tests  []TestResult  `json:"tests"`
	Passed int           `json:"passed"`
	Failed int           `json:"failed"`
	Total  int           `json:"total"`
	Meta   *ResponseMeta `json:"_meta,omitempty"`
}

TestResponse is the result of the test tool.

type TestResult added in v1.41.0

type TestResult struct {
	Name   string `json:"name"`
	Passed bool   `json:"passed"`
	Error  string `json:"error,omitempty"`
}

TestResult describes a single test outcome.

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"`
	Limit         int     `json:"limit,omitempty"`
	Offset        int     `json:"offset,omitempty"`
}

WorkspaceSymbolsInput is input for the workspace_symbols tool.

type WorkspaceSymbolsResponse

type WorkspaceSymbolsResponse struct {
	Symbols   []WorkspaceSymbol `json:"symbols"`
	Truncated bool              `json:"truncated,omitempty"`
	Total     int               `json:"total,omitempty"`
	Meta      *ResponseMeta     `json:"_meta,omitempty"`
}

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