Skip to content

Commit 3d24f00

Browse files
committed
feat: integrate HTTP server into main binary
1 parent a18905c commit 3d24f00

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

crates/codegraph-mcp/src/bin/codegraph-official.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use rmcp::{transport::stdio, ServiceExt};
55
use std::path::PathBuf;
66
use tracing::info;
77

8+
#[cfg(feature = "server-http")]
9+
use codegraph_mcp::{http_config::HttpServerConfig, http_server::start_http_server};
10+
811
#[derive(Parser, Debug)]
912
#[command(
1013
name = "codegraph-official",
@@ -84,8 +87,23 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
8487
service.waiting().await?;
8588
}
8689
"http" => {
87-
info!("HTTP transport not yet implemented in official SDK migration");
88-
return Err("HTTP transport not implemented".into());
90+
#[cfg(feature = "server-http")]
91+
{
92+
info!("Using HTTP transport with SSE streaming (official MCP protocol)");
93+
94+
let http_config = HttpServerConfig {
95+
host: _host,
96+
port: _port,
97+
keep_alive_seconds: 15,
98+
};
99+
100+
start_http_server(server, http_config).await?;
101+
}
102+
103+
#[cfg(not(feature = "server-http"))]
104+
{
105+
return Err("HTTP transport requires 'server-http' feature. Build with: cargo build --features server-http".into());
106+
}
89107
}
90108
_ => {
91109
return Err(format!("Unknown transport: {}", transport).into());

0 commit comments

Comments
 (0)