mcp

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const CompactContextSystemPrompt = `` /* 677-byte string literal not displayed */
View Source
const GEPSystemPrompt = `` /* 377-byte string literal not displayed */
View Source
const JudgeSystemPrompt = `` /* 641-byte string literal not displayed */
View Source
const MaxSessionHistory = 100
View Source
const MaxSnapshots = 20
View Source
const ScouterServerInstructions = `` /* 1076-byte string literal not displayed */
View Source
const SelfHealSystemPrompt = `You are Scouter's Atomic Self-Healing engine.
A test has failed. Review the provided error log and source code.
If historical fixes are provided, carefully consider past patterns to generate your fix.

MANDATES:
1. Fix the specific logic causing the failure.
2. DO NOT output Markdown code blocks (e.g., ` + "```go" + `).
3. DO NOT include explanations, comments, or apologies.
4. Return ONLY the raw code replacement for the target block.
5. Adhere to Go 1.24+ idioms.`

Variables

This section is empty.

Functions

func AdaptSystemPrompt added in v1.2.0

func AdaptSystemPrompt(baseline string, profile ClientProfile) string

AdaptSystemPrompt modifies a baseline prompt according to the client profile.

Types

type CallersParams

type CallersParams struct {
	CalleeName string `json:"calleeName" jsonschema:"REQUIRED. The name of the function or method to find callers for"`
	Limit      int    `json:"limit,omitempty" jsonschema:"Optional: Max results to return (default: 50, max: 100)"`
	Offset     int    `json:"offset,omitempty" jsonschema:"Optional: Number of results to skip for pagination"`
	Format     string `json:"format,omitempty" jsonschema:"Optional: Response format ('text' or 'hakai')"`
}

type ClientProfile added in v1.2.0

type ClientProfile string

ClientProfile categorizes the connected MCP client to adapt behaviors and prompts.

const (
	ClientAntigravity ClientProfile = "antigravity"
	ClientOpenCode    ClientProfile = "opencode"
	ClientCodex       ClientProfile = "codex"
	ClientGeneric     ClientProfile = "generic"
)

func IdentifyClient added in v1.2.0

func IdentifyClient(session *mcp.ServerSession) ClientProfile

IdentifyClient inspects the MCP session to determine the client profile.

type CommitParams

type CommitParams struct{}

type CriticalParams

type CriticalParams struct {
	Limit  int    `json:"limit,omitempty" jsonschema:"Optional: Max critical symbols to return (default: 10, max: 50)"`
	Format string `json:"format,omitempty" jsonschema:"Optional: Response format ('text' or 'hakai')"`
}

type DefinitionParams

type DefinitionParams struct {
	FilePath  string `json:"filePath" jsonschema:"REQUIRED. Path to the file containing the symbol"`
	Line      int    `json:"line" jsonschema:"REQUIRED. 1-based line number"`
	Character int    `json:"character" jsonschema:"REQUIRED. 1-based character position"`
}

type DiagnoseParams

type DiagnoseParams struct {
	ErrorLog string `json:"errorLog" jsonschema:"REQUIRED. The error log output containing the file and line number of the failure"`
}

type DiffParams

type DiffParams struct{}

type DreamParams

type DreamParams struct {
	Project string `json:"project,omitempty" jsonschema:"Optional: The name of the project to distill (defaults to current repo)"`
	Hours   int    `json:"hours,omitempty" jsonschema:"Optional: Time window in hours for memory extraction (default: 24)"`
}

type EvolveParams

type EvolveParams struct {
	Proposal string `` /* 134-byte string literal not displayed */
	Force    bool   `json:"force,omitempty" jsonschema:"Optional: Bypass safety guardrails for core file modifications"`
}

type ImpactParams

type ImpactParams struct {
	SymbolName string `json:"symbolName" jsonschema:"REQUIRED. The name of the symbol to analyze"`
	FilePath   string `json:"filePath" jsonschema:"REQUIRED. Path to the file containing the symbol"`
	MaxDepth   int    `json:"maxDepth,omitempty" jsonschema:"Optional: Maximum recursion depth for impact analysis"`
	Verbose    bool   `json:"verbose,omitempty" jsonschema:"Optional: Include detailed metrics and Mermaid graph"`
}

type IndexParams

type IndexParams struct {
	FilePath string `json:"filePath" jsonschema:"REQUIRED. The absolute or relative path to the file or directory to index"`
}

type LintArchitectureParams added in v1.2.0

type LintArchitectureParams struct {
	TargetPath string `json:"target_path" jsonschema:"REQUIRED. The target path to lint"`
}

type MCPMessenger

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

MCPMessenger adapts the MCP Sampling protocol to the engine.Messenger interface.

func NewMCPMessenger

func NewMCPMessenger(session *mcp.ServerSession) *MCPMessenger

NewMCPMessenger creates a new messenger for the given MCP session.

func (*MCPMessenger) Ask

func (m *MCPMessenger) Ask(ctx context.Context, systemPrompt string, userPrompt string) (string, error)

Ask sends a sampling request to the MCP client.

type MapParams

type MapParams struct {
	Path string `json:"path" jsonschema:"REQUIRED. The absolute or relative path to the file or directory to map (skeleton only)"`
}

type NeighborhoodParams

type NeighborhoodParams struct {
	FilePath string `json:"filePath" jsonschema:"REQUIRED. The absolute or relative path to the file to extract the neighborhood from"`
}

type ObsidianExportParams

type ObsidianExportParams struct {
	SymbolName string `json:"symbolName" jsonschema:"REQUIRED. The name of the symbol to export"`
	FilePath   string `json:"filePath" jsonschema:"REQUIRED. Path to the file containing the symbol"`
	VaultPath  string `json:"vaultPath,omitempty" jsonschema:"Optional: Custom path for the Obsidian vault export"`
}

type Options

type Options struct {
	Store         store.Store
	Logger        *slog.Logger
	LspMgr        *lsp.Manager
	Indexer       engine.IndexerService
	Discovery     engine.DiscoveryService
	Intelligence  engine.IntelligenceService
	Evolution     engine.EvolutionService
	Healer        engine.HealerService
	Memory        memory.MemoryProvider
	Presenter     display.Presenter
	ChronosEngine *engine.ChronosEngine
	AppService    *memory.AppService
}

Options contains the dependencies required to initialize the MCP Server.

type PointerResolver

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

PointerResolver handles the resolution of MCP pointers to physical file ranges.

func NewPointerResolver

func NewPointerResolver(st store.SymbolRegistry) *PointerResolver

func (*PointerResolver) Resolve

func (r *PointerResolver) Resolve(ctx context.Context, filePath, pointer string) (types.Range, error)

Resolve converts a pointer (e.g., "main", a JSON range, or a 64-char hash) into a types.Range.

type PredictParams

type PredictParams struct {
	Diff string `json:"diff,omitempty" jsonschema:"Optional: Git diff to analyze (defaults to uncommitted changes)"`
}

type PureSignalParams

type PureSignalParams struct {
	Text  string `json:"text" jsonschema:"REQUIRED. The raw text to filter and extract pure signal from"`
	Mode  string `json:"mode,omitempty" jsonschema:"Optional: Filtering mode (e.g., 'compact', 'verbose')"`
	Level string `json:"level,omitempty" jsonschema:"Optional: Filtering aggressiveness (e.g., 'aggressive', 'balanced')"`
}

type ReadParams

type ReadParams struct {
	FilePath string `json:"filePath" jsonschema:"REQUIRED. Path to the file to read"`
	Pointer  string `json:"pointer" jsonschema:"REQUIRED. AST pointer or fragment identifier to read (e.g., 'symbol:MyFunc')"`
}

type RippleRefactorParams

type RippleRefactorParams struct {
	SymbolName     string `json:"symbolName" jsonschema:"REQUIRED. The name of the symbol to refactor"`
	Transformation string `json:"transformation" jsonschema:"REQUIRED. The structural transformation to apply (e.g., 'rename:NewName')"`
}

type RollbackParams

type RollbackParams struct{}

type SaveAnchorParams

type SaveAnchorParams struct {
	Summary string `json:"summary" jsonschema:"REQUIRED. The technical summary of the session to anchor in Engram"`
}

type SearchParams

type SearchParams struct {
	Query  string `json:"query" jsonschema:"REQUIRED. The search query (supports semantic or text search)"`
	Type   string `json:"type,omitempty" jsonschema:"Optional: Filter by symbol type (e.g., function, method, struct)"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Optional: Max results to return (default: 50, max: 100)"`
	Offset int    `json:"offset,omitempty" jsonschema:"Optional: Number of results to skip for pagination"`
	Format string `json:"format,omitempty" jsonschema:"Optional: Response format ('text' or 'hakai')"`
}

type SelfHealParams

type SelfHealParams struct {
	ErrorLog string `json:"errorLog" jsonschema:"REQUIRED. The raw error log or test failure output containing the failure context"`
}

type SemanticDiffParams added in v1.2.0

type SemanticDiffParams struct {
	DiffTarget string `json:"diff_target,omitempty" jsonschema:"Optional. The git target to diff against (e.g., HEAD, main). Defaults to HEAD."`
}

type Server

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

Server wraps the official MCP SDK server to provide Scouter-specific domain logic.

func NewServer

func NewServer(opts Options) *Server

NewServer initializes a sovereign, SDK-based MCP server.

func (*Server) AppendSessionMessage

func (s *Server) AppendSessionMessage(msg memory.Message)

AppendSessionMessage adds a message to the session history with a fixed capacity.

func (*Server) Close

func (s *Server) Close() error

Close gracefully shuts down the server and its resources.

func (*Server) GetTranscript

func (s *Server) GetTranscript(req *mcp.CallToolRequest) []memory.Message

GetTranscript attempts to retrieve the current session transcript.

func (*Server) GotoDefinition

func (s *Server) GotoDefinition(ctx context.Context, path string, pos lsp.Position) ([]lsp.Location, error)

GotoDefinition performs an LSP definition request.

func (*Server) Hover

func (s *Server) Hover(ctx context.Context, path string, pos lsp.Position) (*lsp.Hover, error)

Hover performs an LSP hover request.

func (*Server) Start

func (s *Server) Start(ctx context.Context, transport mcp.Transport) error

Start launches the server using the provided transport.

type SnapshotASTParams

type SnapshotASTParams struct {
	FilePath string `json:"filePath" jsonschema:"REQUIRED. The absolute or relative path to the file to snapshot"`
}

type StructuralSearchParams

type StructuralSearchParams struct {
	Pattern      string `json:"pattern,omitempty" jsonschema:"Optional: The structural search pattern (supports $VAR and $$$ wildcards)"`
	TargetSymbol string `json:"targetSymbol,omitempty" jsonschema:"Optional: An existing symbol to use as the template pattern (Find Logical Twins)"`
	Ext          string `json:"ext,omitempty" jsonschema:"Optional: The file extension to search in (e.g., '.go', '.ts')"`
	Path         string `json:"path,omitempty" jsonschema:"Optional: Root path for the search (defaults to '.')"`
	Limit        int    `json:"limit,omitempty" jsonschema:"Optional: Max results to return (default: 50, max: 100)"`
	Offset       int    `json:"offset,omitempty" jsonschema:"Optional: Number of results to skip for pagination"`
}

type TypeInfoParams

type TypeInfoParams struct {
	FilePath  string `json:"filePath" jsonschema:"REQUIRED. Path to the file containing the symbol"`
	Line      int    `json:"line" jsonschema:"REQUIRED. 1-based line number"`
	Character int    `json:"character" jsonschema:"REQUIRED. 1-based character position"`
}

type UnlockArsenalParams

type UnlockArsenalParams struct{}

type VerifyASTParams

type VerifyASTParams struct {
	SnapshotID string `json:"snapshotId" jsonschema:"REQUIRED. The ID of the snapshot to verify against"`
	FilePath   string `json:"filePath" jsonschema:"REQUIRED. The absolute or relative path to the edited file to verify"`
}

Jump to

Keyboard shortcuts

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