mcp

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHubLockPath added in v0.7.0

func GetHubLockPath() string

GetHubLockPath returns the platform-specific path to the hub.lock file

func GetWorkspaceConfigs added in v0.9.0

func GetWorkspaceConfigs(workspaceRoot string) ([]map[string]interface{}, error)

GetWorkspaceConfigs recursively searches for all sgconfig.yml files in the workspace.

func IndexWorkspace added in v0.7.0

func IndexWorkspace(workspaceRoot string, language string) error

IndexWorkspace indexes the workspace for the given language.

func InitializeAstGrepConfig added in v0.9.0

func InitializeAstGrepConfig(directory string, language string) error

InitializeAstGrepConfig sets up a new ast-grep configuration in the target directory.

func RemoveLocalRule added in v0.9.0

func RemoveLocalRule(configPath string, ruleID string) error

RemoveLocalRule removes a specific rule from a configuration's rule directory.

func Start added in v0.7.0

func Start(workspaceRoot string, verbose bool, logFilePath string, astGrepPath string, clientName string)

Start initializes and starts the MCP server.

func ValidateAstGrepRule added in v0.9.0

func ValidateAstGrepRule(yamlContent string) error

ValidateAstGrepRule checks if the given YAML content is a valid ast-grep rule. It ensures the YAML is well-formed and contains the essential fields 'id', 'language', and 'rule'.

Types

type AstGrepRule added in v0.7.0

type AstGrepRule struct {
	ID       string   `yaml:"id"`
	Language string   `yaml:"language"`
	Rule     struct{} `yaml:"rule"`
}

AstGrepRule defines the structure for a valid ast-grep rule YAML. This is used to validate the rule before writing it to disk.

type CommunityRule added in v0.7.0

type CommunityRule struct {
	ID          string   `json:"id"`
	Tool        string   `json:"tool"`
	Path        string   `json:"path"`
	Language    string   `json:"language"`
	Author      string   `json:"author"`
	Tags        []string `json:"tags"`
	Description string   `json:"description"`
}

CommunityRule represents a rule in the community repository

func FetchCommunityRuleContent added in v0.9.0

func FetchCommunityRuleContent(ruleID string) (*CommunityRule, string, error)

FetchCommunityRuleContent fetches the YAML content for a community rule

type CommunityRuleIndex added in v0.7.0

type CommunityRuleIndex struct {
	Version int             `json:"version"`
	Rules   []CommunityRule `json:"rules"`
}

CommunityRuleIndex represents the index.json file from the community repository

func FetchCommunityRuleIndex added in v0.9.0

func FetchCommunityRuleIndex() (*CommunityRuleIndex, error)

FetchCommunityRuleIndex fetches and caches the community rule index

type HubLock added in v0.7.0

type HubLock struct {
	PID       int    `json:"pid"`
	Port      int    `json:"port"`
	StartTime string `json:"startTime"`
}

HubLock represents the metadata stored in the hub.lock file

type SgConfig added in v0.7.0

type SgConfig struct {
	ID       string   `yaml:"id"`
	Language string   `yaml:"language"`
	RuleDirs []string `yaml:"ruleDirs"`
}

SgConfig represents the structure of sgconfig.yml

type SniffingReader added in v0.8.0

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

SniffingReader wraps an io.Reader and looks for the MCP initialize rootUri

func (*SniffingReader) Read added in v0.8.0

func (sr *SniffingReader) Read(p []byte) (int, error)

type ToolContent

type ToolContent struct {
	Text string
}

type ToolRequest

type ToolRequest struct {
	Params map[string]interface{}
}

type ToolResponse

type ToolResponse struct {
	Content []ToolContent
}

type UserPreferences added in v0.8.0

type UserPreferences struct {
	Theme             string `json:"theme"`
	WindowWidth       int    `json:"windowWidth"`
	WindowHeight      int    `json:"windowHeight"`
	WindowX           int    `json:"windowX"`
	WindowY           int    `json:"windowY"`
	IsMaximized       bool   `json:"isMaximized"`
	InferenceProvider string `json:"inferenceProvider"`
	InferenceURL      string `json:"inferenceURL"`
	InferenceModel    string `json:"inferenceModel"`
}

UserPreferences represents persistent user settings

Jump to

Keyboard shortcuts

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