Programmatic API

Updated May 23, 2026

Dear Diary can be used as a library in addition to being run as a standalone MCP server. The following types are exported from the dear_diary_mcp crate:

`DiaryServer`

The main MCP server type. Create an instance with a Qdrant connector and settings:

use dear_diary_mcp::DiaryServer;
use dear_diary_config::Settings;
use dear_diary_qdrant::QdrantConnectorImpl;
use rmcp::ServiceExt;

let settings = Settings::from_env()?;
let connector = QdrantConnectorImpl::new(...)?;
let server = DiaryServer::new(connector, settings);
server.serve(rmcp::transport::stdio()).await?;

`McpServerError`

Error type for server operations, including:

  • MissingCollectionName — No collection specified, and no default configured
  • InvalidFilter — Filter parsing failed or filters not enabled
  • ConnectionError — Failed to connect to Qdrant
  • StoreError — Failed to store entry
  • SearchError — Failed to search entries

Request types

  • StoreRequest — Parameters for the qdrant_store tool
  • FindRequest — Parameters for the qdrant_find tool