mirror of
https://gitea.ingwaz.work/Ingwaz/openbrain-mcp.git
synced 2026-06-16 06:17:08 +00:00
Initial public release
This commit is contained in:
46
src/main.rs
Normal file
46
src/main.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
//! OpenBrain MCP Server - High-performance vector memory for AI agents
|
||||
//!
|
||||
//! This is the main entry point for the OpenBrain MCP server.
|
||||
|
||||
use anyhow::Result;
|
||||
use std::env;
|
||||
use tracing::info;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
|
||||
|
||||
use openbrain_mcp::{config::Config, db::Database, migrations, run_server};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
// Initialize tracing
|
||||
tracing_subscriber::registry()
|
||||
.with(EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into()))
|
||||
.with(tracing_subscriber::fmt::layer())
|
||||
.init();
|
||||
|
||||
info!("Starting OpenBrain MCP Server v{}", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
// Load configuration
|
||||
let config = Config::load()?;
|
||||
info!("Configuration loaded from environment");
|
||||
|
||||
match env::args().nth(1).as_deref() {
|
||||
Some("migrate") => {
|
||||
migrations::run(&config.database).await?;
|
||||
info!("Database migrations completed successfully");
|
||||
return Ok(());
|
||||
}
|
||||
Some(arg) => {
|
||||
anyhow::bail!("Unknown command: {arg}. Supported commands: migrate");
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
||||
// Initialize database connection pool
|
||||
let db = Database::new(&config.database).await?;
|
||||
info!("Database connection pool initialized");
|
||||
|
||||
// Run the MCP server
|
||||
run_server(config, db).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user