Remove MCP server

This commit is contained in:
ldm0
2026-08-14 01:38:49 +08:00
committed by Donough Liu
parent ebcdcd0dcb
commit 145f9c68f5
8 changed files with 9 additions and 1917 deletions
Generated
-1
View File
@@ -2013,7 +2013,6 @@ dependencies = [
"moli-protocol-server",
"moli-test-support",
"parking_lot",
"serde",
"serde_json",
"strip-ansi-escapes",
"tikv-jemalloc-sys",
+1 -2
View File
@@ -26,9 +26,8 @@ moli-core = { path = "../moli-core" }
moli-process-signal = { path = "../moli-process-signal" }
moli-protocol-server = { path = "../moli-protocol-server" }
parking_lot = "0.12"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.145"
tokio = { version = "1.51.0", features = ["io-std", "io-util", "macros", "net", "rt-multi-thread", "signal", "sync"] }
tokio = { version = "1.51.0", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
tikv-jemalloc-sys = { version = "0.7.1", optional = true, default-features = false }
tikv-jemallocator = { version = "0.7.0", optional = true, default-features = false, features = ["override_allocator_on_supported_platforms"] }
tracing = "0.1.41"
+1 -9
View File
@@ -5,7 +5,7 @@ use std::{io::Write, sync::Arc};
use crate::{
cli::{Cli, Commands, FetchWaitUntil, normalize_args_for_compat},
config::AppConfig,
cookie_cache, fetch_dump, mcp_server,
cookie_cache, fetch_dump,
};
use anyhow::Result;
use anyhow::{Context, anyhow};
@@ -204,14 +204,6 @@ pub async fn run_cli_with_config<W: Write>(
);
server.serve().await.context("protocol server failed")?;
}
Commands::Mcp(_) => {
let browser = Browser::new(config.browser.clone())
.context("failed to initialize browser runtime")?;
load_cookie_state(&browser, &config)?;
mcp_server::serve_stdio(browser.clone())
.await
.context("MCP server failed")?;
}
Commands::Help | Commands::Version => unreachable!(),
}
+2 -9
View File
@@ -34,7 +34,7 @@ const FETCH_INFER_FLAGS: &[&str] = &[
"--profile-dir",
];
const SERVE_INFER_FLAGS: &[&str] = &["--host", "--port", "--timeout", "--layout"];
const EXPLICIT_COMMANDS: &[&str] = &["fetch", "serve", "mcp", "help", "version"];
const EXPLICIT_COMMANDS: &[&str] = &["fetch", "serve", "help", "version"];
const DUMP_MODES: &[&str] = &[
"json",
"html",
@@ -62,8 +62,7 @@ pub struct Cli {
#[derive(Debug, Clone, PartialEq, Eq, Subcommand)]
pub enum Commands {
Fetch(Box<FetchArgs>),
Serve(ServeArgs),
Mcp(McpArgs),
Serve(Box<ServeArgs>),
Help,
Version,
}
@@ -227,12 +226,6 @@ pub struct ServeArgs {
pub common: CommonArgs,
}
#[derive(Debug, Clone, PartialEq, Eq, Args)]
pub struct McpArgs {
#[command(flatten)]
pub common: CommonArgs,
}
#[derive(Debug, Clone, PartialEq, Eq, Default, Args)]
pub struct CommonArgs {
#[arg(long)]
-3
View File
@@ -55,9 +55,6 @@ impl AppConfig {
config.server.cdp_max_connections = args.cdp_max_connections;
config.server.cdp_max_pending_connections = args.cdp_max_pending_connections;
}
Commands::Mcp(args) => {
apply_common_args(&mut config, &args.common)?;
}
Commands::Help | Commands::Version => {}
}
-1
View File
@@ -8,7 +8,6 @@ pub mod cli;
pub mod config;
pub mod cookie_cache;
pub mod fetch_dump;
pub mod mcp_server;
mod network_trace;
pub mod telemetry;
File diff suppressed because it is too large Load Diff
+5 -30
View File
@@ -2,7 +2,7 @@ use clap::Parser;
use std::{num::NonZeroU32, process::Command};
use moli::cli::{
Cli, Commands, CommonArgs, DumpFormat, FetchArgs, FetchWaitUntil, LogFormat, LogLevel, McpArgs,
Cli, Commands, CommonArgs, DumpFormat, FetchArgs, FetchWaitUntil, LogFormat, LogLevel,
RequestHeaderArg, ResponseJsonPathArg, ServeArgs, StripModeChoice, StripOptions,
normalize_args_for_compat,
};
@@ -470,14 +470,14 @@ fn infers_serve_mode_when_called_without_args() {
assert_eq!(
cli.command,
Commands::Serve(ServeArgs {
Commands::Serve(Box::new(ServeArgs {
host: "127.0.0.1".to_owned(),
port: 9222,
timeout: 10,
cdp_max_connections: 16,
cdp_max_pending_connections: 128,
common: CommonArgs::default(),
})
}))
);
}
@@ -496,39 +496,14 @@ fn infers_serve_mode_from_legacy_serve_flags() {
assert_eq!(
cli.command,
Commands::Serve(ServeArgs {
Commands::Serve(Box::new(ServeArgs {
host: "0.0.0.0".to_owned(),
port: 9333,
timeout: 42,
cdp_max_connections: 16,
cdp_max_pending_connections: 128,
common: CommonArgs::default(),
})
);
}
#[test]
fn parses_mcp_command_with_common_flags() {
let cli = Cli::try_parse_from(normalize_args_for_compat([
"moli",
"mcp",
"--log-level",
"warn",
"--user-agent-suffix",
"bot",
]))
.unwrap();
assert_eq!(
cli.command,
Commands::Mcp(McpArgs {
common: CommonArgs {
log_level: Some(LogLevel::Warn),
user_agent: None,
user_agent_suffix: Some("bot".to_owned()),
..CommonArgs::default()
},
})
}))
);
}