AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
feat(help): carry the invitation on `xerj mcp --help` too
buger424cd6abd4b8
diff --git a/engine/Cargo.lock b/engine/Cargo.lockindex 6a138eae0..809d3b005 100644--- a/engine/Cargo.lock+++ b/engine/Cargo.lock@@ -6933,6 +6933,7 @@ dependencies = ["reqwest","serde_json","tokio",+ "xerj-common",][[package]]diff --git a/engine/crates/xerj-mcp/Cargo.toml b/engine/crates/xerj-mcp/Cargo.tomlindex 3c4e7262c..fdb4a9ef3 100644--- a/engine/crates/xerj-mcp/Cargo.toml+++ b/engine/crates/xerj-mcp/Cargo.toml@@ -30,3 +30,6 @@ reqwest = { workspace = true }# engine already accepts.serde_json = { workspace = true }anyhow = { workspace = true }+# The feedback invitation, shared with every other --help surface so the five+# cannot drift apart.+xerj-common = { path = "../xerj-common" }diff --git a/engine/crates/xerj-mcp/src/lib.rs b/engine/crates/xerj-mcp/src/lib.rsindex c78b9c217..2f6030fcb 100644--- a/engine/crates/xerj-mcp/src/lib.rs+++ b/engine/crates/xerj-mcp/src/lib.rs@@ -79,7 +79,7 @@ struct Ctx {}/// `--help` text for both entry points (`xerj mcp --help` and `xerj-mcp --help`).-pub const HELP: &str = "\+pub const HELP_BODY: &str = "\xerj mcp — Model Context Protocol (MCP) stdio server for XERJUSAGE:@@ -99,6 +99,10 @@ OPTIONS:request (e.g. 'ApiKey <token>'). Overrides XERJ_AUTH.-h, --help Show this help-V, --version Print version and exit+ --disable-feedback+ Do not print the feedback invitation above. Honoured in any+ position, including after --help.+ Env: XERJ_DISABLE_FEEDBACK=trueENVIRONMENT:XERJ_URL Same as --url@@ -125,6 +129,22 @@ error. When the node is not running --insecure, addDiagnostics go to stderr; stdout carries only the JSON-RPC stream.";+/// The help text with the feedback invitation spliced in above `USAGE:`, the+/// same position the other four surfaces use.+///+/// `xerj mcp` became a help surface after the invitation shipped, so by this+/// feature's own rule — every screen the top-level help advertises should ask —+/// it belongs here too.+pub fn help_text(feedback: bool) -> String {+ let (first, rest) = HELP_BODY+ .split_once("\nUSAGE:")+ .expect("HELP_BODY carries a USAGE: section");+ format!(+ "{first}\n{}USAGE:{rest}",+ xerj_common::feedback::block(feedback)+ )+}+/// Library entry point. `args` are the arguments *after* the subcommand/// (`xerj mcp <args>`) or after the program name (`xerj-mcp <args>`).///@@ -138,9 +158,14 @@ pub async fn run(args: &[String]) -> anyhow::Result<()> {while let Some(arg) = it.next() {match arg.as_str() {"-h" | "--help" => {- print!("{HELP}");+ print!("{}", help_text(xerj_common::feedback::enabled()));return Ok(());}+ // Accepted, not acted on here: `feedback::enabled` reads the whole+ // argument list, so the flag works in any position. Without this+ // arm it would be rejected as an unknown argument on the one+ // surface it is meant to control.+ xerj_common::feedback::DISABLE_FLAG => {}"-V" | "--version" => {println!("xerj-mcp {}", env!("CARGO_PKG_VERSION"));return Ok(());diff --git a/engine/crates/xerj-server/src/main.rs b/engine/crates/xerj-server/src/main.rsindex 599b4bbd8..3043cb782 100644--- a/engine/crates/xerj-server/src/main.rs+++ b/engine/crates/xerj-server/src/main.rs@@ -1770,10 +1770,12 @@ mod help_text_tests {/// describe both halves of what the flag does.#[test]fn insecure_help_documents_auth_not_just_tls() {- // `false` so this test reads the flag documentation alone: whether the- // feedback invitation is present is a separate concern with its own- // tests, and mixing them would make this one fail for the wrong reason.- let help = help_text(false);+ // `true` — the shipped default. Asserting against the real default also+ // proves the invitation, which splices in above USAGE:, does not reflow+ // the --insecure paragraph this test reads. (Resolution taken from the+ // maintainer's conflict analysis on #335; an earlier version passed+ // `false`, which tested less.)+ let help = help_text(true);let line = help.lines().position(|l| l.contains("--insecure"))diff --git a/engine/crates/xerj-server/tests/feedback_invite.rs b/engine/crates/xerj-server/tests/feedback_invite.rsindex 55069c365..605c49a18 100644--- a/engine/crates/xerj-server/tests/feedback_invite.rs+++ b/engine/crates/xerj-server/tests/feedback_invite.rs@@ -26,11 +26,15 @@ const ISSUES_URL: &str = "https://github.com/xerj-org/xerj/issues";const MAX_LINE: usize = 10;/// Every surface, as the argv a caller would type.-const SURFACES: [&[&str]; 4] = [+const SURFACES: [&[&str]; 5] = [&["--help"],&["index", "--help"],&["autoindex", "--help"],&["brain", "--help"],+ // Added after #337 introduced this surface: the top-level help advertises+ // `xerj mcp`, so by this feature's own rule it must ask too, and it would+ // otherwise have been the one screen that never does.+ &["mcp", "--help"],];fn help(args: &[&str], env: Option<&str>) -> String {