memnite-mcp 0.2.1

MCP stdio server for memnite: exposes the event-sourced memory engine as 14 tools to AI agents.
use serde::Deserialize;

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct AddArgs {
    /// Short title of the memory.
    pub title: String,
    /// Body / details.
    pub body: String,
    /// Memory type: decision | architecture | bugfix | contract | term.
    #[serde(default)]
    pub r#type: Option<String>,
    /// Scope: agent | repo.
    #[serde(default)]
    pub scope: Option<String>,
    /// Project key.
    #[serde(default)]
    pub project: Option<String>,
    /// Topic key (groups related memories).
    #[serde(default)]
    pub topic: Option<String>,
    /// Tags.
    #[serde(default)]
    pub tags: Vec<String>,
    /// Anchors as "path:start:end[:symbol]".
    #[serde(default)]
    pub anchors: Vec<String>,
    /// Repo root for resolving anchor paths (default: server's current dir).
    #[serde(default)]
    pub root: Option<String>,
}

#[derive(Debug, Default, Deserialize, schemars::JsonSchema)]
pub struct SearchArgs {
    /// Plain-text query (FTS5 syntax is neutralized).
    pub query: String,
    /// Filter by memory type (exact match), e.g. decision | bugfix | contract.
    #[serde(default)]
    pub r#type: Option<String>,
    /// Filter by project key (exact match).
    #[serde(default)]
    pub project: Option<String>,
    /// Filter by scope: agent | repo.
    #[serde(default)]
    pub scope: Option<String>,
    /// Match ANY token (OR) instead of ALL (AND). Default false.
    #[serde(default)]
    pub match_any: bool,
}

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct GetArgs {
    pub memory_id: String,
}

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct CheckArgs {
    /// Repo root for resolving anchor paths (default: server's current dir).
    #[serde(default)]
    pub root: Option<String>,
}

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct UpdateArgs {
    pub memory_id: String,
    #[serde(default)]
    pub title: Option<String>,
    #[serde(default)]
    pub body: Option<String>,
    /// Memory type: decision | architecture | bugfix | contract | term.
    #[serde(default)]
    pub r#type: Option<String>,
    /// Scope: agent | repo.
    #[serde(default)]
    pub scope: Option<String>,
    #[serde(default)]
    pub project: Option<String>,
    #[serde(default)]
    pub topic: Option<String>,
    #[serde(default)]
    pub tags: Option<Vec<String>>,
    /// Anchors as "path:start:end[:symbol]".
    #[serde(default)]
    pub anchors: Option<Vec<String>>,
    /// Repo root for resolving anchor paths (default: server's current dir).
    #[serde(default)]
    pub root: Option<String>,
}

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct DeleteArgs {
    pub memory_id: String,
}

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct ContextArgs {
    pub project: String,
    #[serde(default)]
    pub limit: Option<u32>,
}

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct TimelineArgs {
    pub memory_id: String,
}

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct SessionSummaryArgs {
    /// The distilled session summary text to persist.
    pub summary: String,
    /// Project key.
    #[serde(default)]
    pub project: Option<String>,
    /// Scope: agent | repo.
    #[serde(default)]
    pub scope: Option<String>,
}

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct RelateArgs {
    /// Source memory id.
    pub from_id: String,
    /// Target memory id.
    pub to_id: String,
    /// Relation: conflicts_with | supersedes | scoped | related | compatible | not_conflict.
    pub relation: String,
    /// Confidence 0.0–1.0 (default 1.0).
    #[serde(default)]
    pub confidence: Option<f32>,
    /// Short rationale (<=200 chars).
    #[serde(default)]
    pub reason: Option<String>,
}

#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct ConflictsArgs {
    /// List relation edges touching this memory.
    pub memory_id: String,
}