mcp

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package mcp implements the Model Context Protocol server for Cortex.

This exposes memory tools via MCP stdio transport so agents can use Cortex as a persistent memory server.

Tool profiles allow agents to load only the tools they need:

cortex mcp                        -> all tools (default)
cortex mcp --tools=agent          -> Engram-compatible memory tools
cortex mcp --tools=admin          -> delete, stats, timeline

Package mcp provides MCP (Model Context Protocol) server implementation for Cortex, exposing all memory system capabilities as MCP tools.

This package implements the MCP server with tool profiles, error handling, and domain logic delegation to the appropriate services.

Index

Constants

This section is empty.

Variables

View Source
var ProfileAdmin = map[string]bool{
	"mem_delete":           true,
	"mem_stats":            true,
	"mem_timeline":         true,
	"mem_revision_history": true,
	"mem_archive":          true,
	"mem_merge_projects":   true,
}

ProfileAdmin contains tools for manual curation (TUI, CLI, dashboards).

View Source
var ProfileAgent = map[string]bool{
	"mem_save":              true,
	"mem_search":            true,
	"mem_context":           true,
	"mem_session_summary":   true,
	"mem_session_start":     true,
	"mem_session_end":       true,
	"mem_get_observation":   true,
	"mem_suggest_topic_key": true,
	"mem_capture_passive":   true,
	"mem_save_prompt":       true,
	"mem_update":            true,
	"mem_relate":            true,
	"mem_graph":             true,
	"mem_score":             true,
	"mem_search_hybrid":     true,
	"mem_revision_history":  true,
}

ProfileAgent contains 11 Engram-compatible memory tools for AI agent workflows plus Cortex-exclusive tools (graph, scoring, hybrid search).

View Source
var Profiles = map[string]map[string]bool{
	"agent": ProfileAgent,
	"admin": ProfileAdmin,
}

Profiles maps profile names to their tool sets.

Functions

func NewServer

func NewServer(stores *Stores) *server.MCPServer

NewServer creates an MCP server with ALL tools registered.

func NewServerWithTools

func NewServerWithTools(stores *Stores, allowlist map[string]bool) *server.MCPServer

NewServerWithTools creates an MCP server registering only the tools in the allowlist. If allowlist is nil, all tools are registered.

func ResolveTools

func ResolveTools(input string) map[string]bool

ResolveTools takes a comma-separated string of profile names and/or individual tool names and returns the set of tool names to register. An empty input or "all" means register everything.

Types

type Stores

type Stores = bundle.Stores

Stores is an alias for bundle.Stores for backward compatibility.

type TemporalToolsHandler

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

TemporalToolsHandler handles temporal graph and observability MCP tools.

func NewTemporalToolsHandler

func NewTemporalToolsHandler(
	temporalService *temporal.TemporalService,
	observabilityService *observability.ObservabilityService,
) *TemporalToolsHandler

NewTemporalToolsHandler creates a new handler for temporal and observability tools.

func (*TemporalToolsHandler) CreateTemporalEdge

CreateTemporalEdge creates an edge with temporal validity and evolution tracking.

func (*TemporalToolsHandler) CreateTemporalSnapshot

func (h *TemporalToolsHandler) CreateTemporalSnapshot(ctx context.Context, req *protocol.CallToolRequest) (*protocol.CallToolResult, error)

CreateTemporalSnapshot creates a point-in-time snapshot of the knowledge graph.

func (*TemporalToolsHandler) EvaluateMemoryQuality

func (h *TemporalToolsHandler) EvaluateMemoryQuality(ctx context.Context, req *protocol.CallToolRequest) (*protocol.CallToolResult, error)

EvaluateMemoryQuality evaluates the quality of the memory system.

func (*TemporalToolsHandler) GetCurrentFactState

GetCurrentFactState determines the current state of facts related to an observation.

func (*TemporalToolsHandler) GetHealthCheck

GetHealthCheck provides system health status.

func (*TemporalToolsHandler) GetSystemMetrics

GetSystemMetrics retrieves system-wide performance metrics.

func (*TemporalToolsHandler) GetTemporalEdges

GetTemporalEdges retrieves edges valid at a specific time point.

func (*TemporalToolsHandler) GetTemporalEvolutionPath

func (h *TemporalToolsHandler) GetTemporalEvolutionPath(ctx context.Context, req *protocol.CallToolRequest) (*protocol.CallToolResult, error)

GetTemporalEvolutionPath retrieves the evolution history of an edge.

func (*TemporalToolsHandler) GetTemporalRelevant

GetTemporalRelevant retrieves observations relevant at a specific time.

func (*TemporalToolsHandler) RecordOperation

RecordOperation records an operation with performance metrics.

Jump to

Keyboard shortcuts

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