Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ thiserror = "1.0"
once_cell = "1.19"
anyhow = "1.0"
ctrlc = "3.4"
tempfile = "3.9"

[dev-dependencies]
wiremock = "0.5"
Expand Down
19 changes: 7 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ use crate::mcp::utilities::*;
use clap::Parser;
use rpc_router::{Error, Handler, Request, Router, RouterBuilder};
use serde_json::{json, Value};
use std::fs::OpenOptions;
use std::io;
use std::io::Write;
use std::thread;
use tempfile::NamedTempFile;

// Platform-specific imports
#[cfg(unix)]
Expand Down Expand Up @@ -87,18 +87,13 @@ async fn main() {
let mut line = String::new();
let input = io::stdin();

// Use a platform-appropriate path for the log file
let log_path = if cfg!(windows) {
std::env::temp_dir().join("mcp.jsonl")
} else {
std::path::PathBuf::from("/tmp/mcp.jsonl")
};
// Create a secure temporary file for logging
let logging_file = NamedTempFile::new().expect("Failed to create temporary log file");
eprintln!("Log file created at: {}", logging_file.path().display());
let mut logging_file = logging_file
.reopen()
.expect("Failed to reopen temporary log file");

let mut logging_file = OpenOptions::new()
.append(true)
.create(true)
.open(log_path)
.unwrap();
while input.read_line(&mut line).unwrap() != 0 {
let line = std::mem::take(&mut line);
writeln!(logging_file, "{}", line).unwrap();
Expand Down
1 change: 0 additions & 1 deletion tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pub fn load_fixture(filename: &str) -> String {
}

/// Get a mock SonarQube base URL for testing
#[allow(dead_code)]
pub fn mock_base_url(mock_server: &wiremock::MockServer) -> String {
mock_server.uri()
}
Expand Down
1 change: 0 additions & 1 deletion tests/main_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use clap::Parser;
use std::str::FromStr;

// Import the Args struct from main.rs
// We can't directly import it as it's not public, so we recreate it here
Expand Down
1 change: 0 additions & 1 deletion tests/sonarqube_types_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
mod helpers;

use serde_json::json;
use sonarqube_mcp_server::mcp::sonarqube::types::*;

#[test]
Expand Down
Loading