Documentation
¶
Index ¶
- Constants
- func BrowserAutomationPreset() config.MCPServerConfig
- func MergeStartupServers(workingDir string, explicit []config.MCPServerConfig) ([]config.MCPServerConfig, []string)
- func ParseInstallArgs(args []string) (config.MCPServerConfig, error)
- func ParseMessage(data []byte) (interface{}, error)
- func PersistUserClaudeServers(cfg *config.Config) ([]string, bool, error)
- type Adapter
- type CallToolParams
- type CallToolResult
- type Client
- func (c *Client) Abort()
- func (c *Client) CallTool(ctx context.Context, name string, args map[string]interface{}) (*CallToolResult, error)
- func (c *Client) Close() error
- func (c *Client) GetPrompt(ctx context.Context, name string, args map[string]interface{}) (*GetPromptResult, error)
- func (c *Client) Initialize(ctx context.Context) (*InitializeResult, error)
- func (c *Client) ListPrompts(ctx context.Context) ([]PromptDefinition, error)
- func (c *Client) ListResources(ctx context.Context) ([]ResourceDefinition, error)
- func (c *Client) ListTools(ctx context.Context) ([]ToolDefinition, error)
- func (c *Client) Name() string
- func (c *Client) ReadResource(ctx context.Context, uri string) (*ReadResourceResult, error)
- func (c *Client) Start(ctx context.Context) error
- type ClientCaps
- type Error
- type GetPromptParams
- type GetPromptResult
- type ID
- type Implementation
- type InitializeParams
- type InitializeResult
- type ListPromptsResult
- type ListResourcesResult
- type ListToolsParams
- type ListToolsResult
- type Notification
- type PromptArgument
- type PromptDefinition
- type PromptMessage
- type ReadResourceParams
- type ReadResourceResult
- type Request
- type ResourceContent
- type ResourceDefinition
- type Response
- type ServerCaps
- type ToolContent
- type ToolDefinition
Constants ¶
const BrowserAutomationInstallSpec = "playwright stdio npx -y @playwright/mcp"
Variables ¶
This section is empty.
Functions ¶
func BrowserAutomationPreset ¶ added in v1.1.7
func BrowserAutomationPreset() config.MCPServerConfig
func MergeStartupServers ¶
func MergeStartupServers(workingDir string, explicit []config.MCPServerConfig) ([]config.MCPServerConfig, []string)
func ParseInstallArgs ¶
func ParseInstallArgs(args []string) (config.MCPServerConfig, error)
func ParseMessage ¶
ParseMessage parses a JSON-RPC message from raw bytes. It can be a Request, Response, or Notification.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter wraps MCP tools into ggcode's Tool interface.
func NewAdapter ¶
func NewAdapter(serverName string, caller toolCaller, tools []ToolDefinition) *Adapter
NewAdapter creates an MCP adapter from server config and tool definitions.
func (*Adapter) RegisterTools ¶
RegisterTools registers all MCP tools into the registry with "mcp__" prefix.
func (*Adapter) ServerName ¶
ServerName returns the MCP server name.
type CallToolParams ¶
type CallToolResult ¶
type CallToolResult struct {
Content []ToolContent `json:"content"`
IsError bool `json:"isError,omitempty"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client connects to an MCP server via stdio transport.
func NewClientFromConfig ¶
func NewClientFromConfig(cfg config.MCPServerConfig) *Client
func (*Client) CallTool ¶
func (c *Client) CallTool(ctx context.Context, name string, args map[string]interface{}) (*CallToolResult, error)
CallTool invokes a tool on the MCP server.
func (*Client) Initialize ¶
func (c *Client) Initialize(ctx context.Context) (*InitializeResult, error)
Initialize sends the initialize request and returns server capabilities.
func (*Client) ListPrompts ¶
func (c *Client) ListPrompts(ctx context.Context) ([]PromptDefinition, error)
func (*Client) ListResources ¶
func (c *Client) ListResources(ctx context.Context) ([]ResourceDefinition, error)
func (*Client) ListTools ¶
func (c *Client) ListTools(ctx context.Context) ([]ToolDefinition, error)
ListTools returns the tools provided by the MCP server.
func (*Client) ReadResource ¶
type ClientCaps ¶
type ClientCaps struct {
Roots struct {
ListChanged bool `json:"listChanged,omitempty"`
} `json:"roots,omitempty"`
}
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
Error is a JSON-RPC error object.
type GetPromptParams ¶
type GetPromptResult ¶
type GetPromptResult struct {
Description string `json:"description,omitempty"`
Messages []PromptMessage `json:"messages"`
}
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID can be a string or number.
func NewStringID ¶
func (ID) MarshalJSON ¶
func (*ID) UnmarshalJSON ¶
type Implementation ¶
type InitializeParams ¶
type InitializeParams struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities ClientCaps `json:"capabilities"`
ClientInfo Implementation `json:"clientInfo"`
}
type InitializeResult ¶
type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities ServerCaps `json:"capabilities"`
ServerInfo Implementation `json:"serverInfo"`
}
type ListPromptsResult ¶
type ListPromptsResult struct {
Prompts []PromptDefinition `json:"prompts"`
}
type ListResourcesResult ¶
type ListResourcesResult struct {
Resources []ResourceDefinition `json:"resources"`
}
type ListToolsParams ¶
type ListToolsParams struct {
Cursor string `json:"cursor,omitempty"`
}
type ListToolsResult ¶
type ListToolsResult struct {
Tools []ToolDefinition `json:"tools"`
}
type Notification ¶
type Notification struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
Notification is a JSON-RPC notification (no ID).
type PromptArgument ¶
type PromptDefinition ¶
type PromptDefinition struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Arguments []PromptArgument `json:"arguments,omitempty"`
}
type PromptMessage ¶
type PromptMessage struct {
Role string `json:"role,omitempty"`
Content json.RawMessage `json:"content"`
}
type ReadResourceParams ¶
type ReadResourceParams struct {
URI string `json:"uri"`
}
type ReadResourceResult ¶
type ReadResourceResult struct {
Contents []ResourceContent `json:"contents"`
}
type Request ¶
type Request struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
ID *ID `json:"id,omitempty"`
}
Request is a JSON-RPC request.
type ResourceContent ¶
type ResourceDefinition ¶
type Response ¶
type Response struct {
JSONRPC string `json:"jsonrpc"`
Result json.RawMessage `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
ID json.RawMessage `json:"id,omitempty"`
}
Response is a JSON-RPC response.
type ServerCaps ¶
type ServerCaps struct {
Tools *struct {
ListChanged bool `json:"listChanged,omitempty"`
} `json:"tools,omitempty"`
}
type ToolContent ¶
type ToolDefinition ¶
type ToolDefinition struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema json.RawMessage `json:"inputSchema"`
}