Skip to main content

Crate post_cortex_mcp

Crate post_cortex_mcp 

Source
Expand description

Model Context Protocol (MCP) tool definitions for post-cortex.

Pure library — no rmcp, axum, tonic, or transport runtime. Each public function takes the typed parameters of a single MCP tool, dispatches into the post-cortex domain layer, and returns an MCPToolResult.

The 9 consolidated tool surfaces live as top-level modules: see session, update_context, query, search, analysis, workspace, and schemas. Headline helpers (MCPToolResult, MEMORY_SYSTEM, get_memory_system) are re-exported below.

§Phase 6 status

The crate currently calls into post_cortex_memory::ConversationMemorySystem directly via a global LazyLock<ArcSwap> singleton. Phase 7 (daemon extraction) is where the function signatures flip to take &dyn post_cortex_core::services::PostCortexService and the singleton goes away — at that point this crate’s transitive dependency on post-cortex-memory / post-cortex-storage drops to dev-dependencies and downstream Rust projects can plug in their own service impl.

Re-exports§

pub use error::Error;
pub use error::Result as McpResult;
pub use analysis::get_entity_importance_analysis;
pub use analysis::get_entity_network_view;
pub use analysis::get_key_decisions;
pub use analysis::get_key_insights;
pub use analysis::get_session_statistics;
pub use analysis::get_structured_summary;
pub use analysis::get_tool_catalog;
pub use query::query_conversation_context;
pub use query::query_conversation_context_with_system;
pub use schemas::get_all_tool_schemas;
pub use search::enable_embeddings;
pub use search::get_vectorization_stats;
pub use search::semantic_search_global;
pub use search::semantic_search_session;
pub use search::vectorize_session;
pub use session::create_session_checkpoint;
pub use session::create_session_checkpoint_with_system;
pub use session::list_sessions;
pub use session::list_sessions_with_storage;
pub use session::load_session;
pub use session::load_session_checkpoint;
pub use session::load_session_checkpoint_with_system;
pub use session::load_session_with_system;
pub use session::mark_important;
pub use session::search_sessions;
pub use session::update_session_metadata;
pub use update_context::bulk_update_conversation_context;
pub use update_context::update_conversation_context;
pub use workspace::add_session_to_workspace;
pub use workspace::create_workspace;
pub use workspace::delete_workspace;
pub use workspace::get_workspace;
pub use workspace::list_workspaces;
pub use workspace::remove_session_from_workspace;

Modules§

analysis
Analysis, summaries, insights, and session statistics. Analysis, summaries, insights, and session statistics.
error
Typed error hierarchy for the MCP tool layer. Typed error hierarchy for post-cortex-mcp.
query
Structured and keyword-based queries over session context. Structured and keyword-based queries over session context.
schemas
JSON Schema descriptors for every MCP tool. JSON Schema descriptors for every MCP tool.
search
Semantic and embedding-powered search across sessions. Semantic and embedding-powered search across sessions.
session
Session lifecycle: create, load, checkpoint, list, search, metadata. Session lifecycle: create, load, checkpoint, list, search, and metadata.
update_context
Helpers for recording context updates (single and bulk). MCP-side adapter for context-update writes.
workspace
Workspace CRUD and session-to-workspace membership. Workspace CRUD and session-to-workspace membership.

Structs§

ContextUpdateItem
A single context update item accepted by the bulk-update tool.
EntityItem
Wire shape for an entity carried by an MCP update_conversation_context call. entity_type is a lowercase string from the closed set: technology, concept, problem, solution, decision, code_component. Unknown values fall back to concept server-side.
MCPToolResult
Standardised result envelope for every MCP tool.
RelationItem
Wire shape for a relation between two named entities. relation_type is a lowercase string from the closed set: required_by, leads_to, related_to, conflicts_with, depends_on, implements, caused_by, solves. Unknown values cause the request to be rejected with InvalidArgument.

Enums§

ContextQuery
Typed query descriptors dispatched by query::query_context.
ContextResponse
Typed response payloads returned by query::query_context.
Interaction
Typed interaction payloads matching MCP interaction_type values.

Functions§

get_memory_system
Return the global memory system, lazily initialising it if needed.
get_memory_system_with_config
Create a new memory system from the given configuration.
get_service
Return the cached canonical service, building it from the current memory system if necessary. Both update_conversation_context and bulk_update_conversation_context flow through this — no transport is allowed to bypass the canonical impl.
inject_memory_system
Inject a pre-built memory system for daemon mode.