mcp
Package github.com/emergent-company/emergent.memory/apps/server/pkg/sdk/mcp
The mcp client is a JSON-RPC 2.0 client for the Model Context Protocol (MCP) endpoint. It allows calling Memory’s built-in MCP server to invoke tools, list resources, and retrieve prompts.
Methods
Section titled “Methods”func (c *Client) CallMethod(ctx context.Context, method string, params interface{}) (json.RawMessage, error)func (c *Client) Initialize(ctx context.Context) errorfunc (c *Client) ListTools(ctx context.Context) (json.RawMessage, error)func (c *Client) CallTool(ctx context.Context, name string, arguments interface{}) (json.RawMessage, error)func (c *Client) ListResources(ctx context.Context) (json.RawMessage, error)func (c *Client) ReadResource(ctx context.Context, uri string) (json.RawMessage, error)func (c *Client) ListPrompts(ctx context.Context) (json.RawMessage, error)func (c *Client) GetPrompt(ctx context.Context, name string, arguments interface{}) (json.RawMessage, error)Key Types
Section titled “Key Types”type JSONRPCRequest struct { JSONRPC string `json:"jsonrpc"` ID int `json:"id"` Method string `json:"method"` Params interface{} `json:"params,omitempty"`}
type JSONRPCResponse struct { JSONRPC string `json:"jsonrpc"` ID int `json:"id"` Result json.RawMessage `json:"result,omitempty"` Error *JSONRPCError `json:"error,omitempty"`}
type JSONRPCError struct { Code int `json:"code"` Message string `json:"message"`}Example
Section titled “Example”// Set project contextclient.MCP.SetContext("proj_xyz789")
// Initialize MCP sessionif err := client.MCP.Initialize(ctx); err != nil { return err}
// List available toolstools, err := client.MCP.ListTools(ctx)
// Call a toolresult, err := client.MCP.CallTool(ctx, "search_graph", map[string]any{ "query": "machine learning", "limit": 10,})