Skip to content

Commit bee4ff4

Browse files
Copilot0xrinegade
andcommitted
Add GitHub URL support and fix MCP server bugs
- Implement add-github command for cloning MCP servers from GitHub repositories - Add automatic Rust project building with cargo build --release - Add stdio transport support for local MCP processes - Fix Bearer token masking in authentication headers - Add configuration persistence with JSON file storage - Enhance McpServerConfig with github_url and local_path fields - Improve error handling and debug logging - Add comprehensive stdio communication testing - Successfully tested with real solana-mcp-server repository Co-authored-by: 0xrinegade <[email protected]>
1 parent 410a148 commit bee4ff4

File tree

3 files changed

+362
-10
lines changed

3 files changed

+362
-10
lines changed

src/clparse.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,34 @@ pub fn parse_command_line() -> clap::ArgMatches {
886886
.help("Enable the server immediately after adding")
887887
)
888888
)
889+
.subcommand(
890+
Command::new("add-github")
891+
.about("Add MCP server from GitHub repository")
892+
.arg(
893+
Arg::new("server_id")
894+
.help("Server identifier")
895+
.required(true)
896+
.index(1)
897+
)
898+
.arg(
899+
Arg::new("github_url")
900+
.help("GitHub repository URL (e.g., https://github.com/openSVM/solana-mcp-server)")
901+
.required(true)
902+
.index(2)
903+
)
904+
.arg(
905+
Arg::new("name")
906+
.long("name")
907+
.value_name("NAME")
908+
.help("Human-readable name for the server")
909+
)
910+
.arg(
911+
Arg::new("enabled")
912+
.long("enabled")
913+
.action(ArgAction::SetTrue)
914+
.help("Enable the server immediately after adding")
915+
)
916+
)
889917
.subcommand(
890918
Command::new("remove")
891919
.about("Remove an MCP server configuration")

src/main.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ async fn handle_mcp_command(
351351
auth,
352352
enabled,
353353
extra_config: std::collections::HashMap::new(),
354+
github_url: None,
355+
local_path: None,
354356
};
355357

356358
mcp_service.add_server(server_id.clone(), config);
@@ -367,6 +369,38 @@ async fn handle_mcp_command(
367369
}
368370
}
369371

372+
"add-github" => {
373+
let server_id = mcp_sub_matches.get_one::<String>("server_id").unwrap();
374+
let github_url = mcp_sub_matches.get_one::<String>("github_url").unwrap();
375+
let name = mcp_sub_matches.get_one::<String>("name").cloned();
376+
let enabled = mcp_sub_matches.get_flag("enabled");
377+
378+
println!("🔄 Cloning MCP server from GitHub: {}", github_url);
379+
380+
match mcp_service.add_server_from_github(server_id.clone(), github_url.clone(), name).await {
381+
Ok(_) => {
382+
println!("✅ Successfully cloned and configured MCP server '{}'", server_id);
383+
println!(" Repository: {}", github_url);
384+
385+
if enabled {
386+
println!("🔄 Testing server connectivity...");
387+
if let Err(e) = mcp_service.test_server(server_id).await {
388+
eprintln!("⚠️ Warning: Server test failed: {}", e);
389+
eprintln!(" The server was configured but may not be accessible.");
390+
} else {
391+
println!("✅ Server connectivity test passed!");
392+
}
393+
} else {
394+
println!("💡 Use 'osvm mcp enable {}' to activate it", server_id);
395+
}
396+
}
397+
Err(e) => {
398+
eprintln!("❌ Failed to clone and configure MCP server: {}", e);
399+
std::process::exit(1);
400+
}
401+
}
402+
}
403+
370404
"remove" => {
371405
let server_id = mcp_sub_matches.get_one::<String>("server_id").unwrap();
372406
if let Some(removed_config) = mcp_service.remove_server(server_id) {
@@ -587,6 +621,8 @@ async fn handle_mcp_command(
587621
auth: None,
588622
enabled: auto_enable,
589623
extra_config: std::collections::HashMap::new(),
624+
github_url: None,
625+
local_path: None,
590626
};
591627

592628
mcp_service.add_server("solana".to_string(), config);

0 commit comments

Comments
 (0)