mod server_impl;
use do_memory_mcp::SandboxConfig;
use std::sync::Arc;
use tokio::sync::Mutex;
use tracing::info;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_writer(std::io::stderr)
.init();
info!("Starting Memory MCP Server in JSON-RPC mode");
let memory = server_impl::initialize_memory_system().await?;
let sandbox_config = SandboxConfig::restrictive();
let mcp_server = Arc::new(Mutex::new(
do_memory_mcp::MemoryMCPServer::new(sandbox_config, memory).await?,
));
info!("MCP Server initialized successfully");
let oauth_config = server_impl::load_oauth_config();
if oauth_config.enabled {
info!("OAuth 2.1 authorization enabled");
if let Some(ref issuer) = oauth_config.issuer {
info!("Expected token issuer: {}", issuer);
}
}
server_impl::run_jsonrpc_server(mcp_server, oauth_config).await
}