mirror of
https://github.com/lexmount/moli.git
synced 2026-09-25 08:01:28 +00:00
Remove MCP server
This commit is contained in:
Generated
-1
@@ -2013,7 +2013,6 @@ dependencies = [
|
||||
"moli-protocol-server",
|
||||
"moli-test-support",
|
||||
"parking_lot",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strip-ansi-escapes",
|
||||
"tikv-jemalloc-sys",
|
||||
|
||||
+1
-2
@@ -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
@@ -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
@@ -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)]
|
||||
|
||||
@@ -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 => {}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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()
|
||||
},
|
||||
})
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user