mcp

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PromptHandler

type PromptHandler func(ctx context.Context, params json.RawMessage) (any, error)

type PromptRegistry added in v0.12.0

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

PromptRegistry manages MCP prompts for file analysis

func NewPromptRegistry added in v0.12.0

func NewPromptRegistry() *PromptRegistry

NewPromptRegistry creates a new prompt registry with default prompts

func (*PromptRegistry) GeneratePromptMessages added in v0.12.0

func (r *PromptRegistry) GeneratePromptMessages(name string, arguments map[string]string, server *Server) ([]protocol.PromptMessage, error)

GeneratePromptMessages generates messages for a specific prompt with arguments

func (*PromptRegistry) GetPrompt added in v0.12.0

func (r *PromptRegistry) GetPrompt(name string) (*protocol.Prompt, error)

GetPrompt retrieves a specific prompt by name

func (*PromptRegistry) ListPrompts added in v0.12.0

func (r *PromptRegistry) ListPrompts() []protocol.Prompt

ListPrompts returns all registered prompts

type ResourceHandler

type ResourceHandler func(ctx context.Context, uri string) (any, error)

type SSEClient added in v0.12.0

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

SSEClient connects to daemon's SSE notification stream

func NewSSEClient added in v0.12.0

func NewSSEClient(daemonURL string, server *Server, logger *slog.Logger) *SSEClient

NewSSEClient creates a new SSE client

func (*SSEClient) Start added in v0.12.0

func (c *SSEClient) Start()

Start begins listening to SSE stream

func (*SSEClient) Stop added in v0.12.0

func (c *SSEClient) Stop()

Stop stops the SSE client

type Server

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

func NewServer

func NewServer(index *types.Index, logger *slog.Logger, daemonURL string) *Server

func (*Server) GetIndex added in v0.12.0

func (s *Server) GetIndex() *types.Index

GetIndex returns the current index (thread-safe)

func (*Server) ReloadIndex added in v0.12.0

func (s *Server) ReloadIndex(newIndex *types.Index)

ReloadIndex atomically updates the server's index (thread-safe)

func (*Server) Run

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

Run starts the MCP server loop

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown gracefully shuts down the server

type SubscriptionManager added in v0.12.0

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

SubscriptionManager manages resource subscriptions for MCP clients

func NewSubscriptionManager added in v0.12.0

func NewSubscriptionManager() *SubscriptionManager

NewSubscriptionManager creates a new subscription manager

func (*SubscriptionManager) Clear added in v0.12.0

func (sm *SubscriptionManager) Clear()

Clear removes all subscriptions

func (*SubscriptionManager) Count added in v0.12.0

func (sm *SubscriptionManager) Count() int

Count returns the number of active subscriptions

func (*SubscriptionManager) GetSubscriptions added in v0.12.0

func (sm *SubscriptionManager) GetSubscriptions() []string

GetSubscriptions returns a list of all subscribed URIs

func (*SubscriptionManager) IsSubscribed added in v0.12.0

func (sm *SubscriptionManager) IsSubscribed(uri string) bool

IsSubscribed checks if a URI is subscribed

func (*SubscriptionManager) Subscribe added in v0.12.0

func (sm *SubscriptionManager) Subscribe(uri string)

Subscribe adds a subscription for the given URI

func (*SubscriptionManager) Unsubscribe added in v0.12.0

func (sm *SubscriptionManager) Unsubscribe(uri string)

Unsubscribe removes a subscription for the given URI

type ToolHandler

type ToolHandler func(ctx context.Context, params json.RawMessage) (any, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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