Skip to content
Closed
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
24 changes: 23 additions & 1 deletion crates/goose-mcp/src/mcp_server_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ use crate::{
};
use anyhow::{anyhow, Result};
use rmcp::{transport::stdio, ServiceExt};
use std::{env, os::unix::process::CommandExt, process::Command};

const DEV_TOOL_NO_FORK_ENV: &str = "GOOSE_DEVELOPER_MCP_NO_SHELL";

/// Run an MCP server by name
///
Expand All @@ -20,7 +23,26 @@ pub async fn run_mcp_server(name: &str) -> Result<()> {
match name {
"autovisualiser" => serve_and_wait(AutoVisualiserRouter::new()).await,
"computercontroller" => serve_and_wait(ComputerControllerServer::new()).await,
"developer" => serve_and_wait(DeveloperServer::new()).await,
"developer" => {
if cfg!(unix)
&& env::var(DEV_TOOL_NO_FORK_ENV)
.unwrap_or_default()
.is_empty()
{
let shell = env::var("SHELL").unwrap_or_else(|_| "/bin/bash".to_string());
let command: String = env::args().collect::<Vec<_>>().join(" ");
let err = Command::new(&shell)
.env(DEV_TOOL_NO_FORK_ENV, "1")
.arg("-l")
.arg("-c")
.arg(command)
.exec();
eprintln!("exec failed: {}", err);
std::process::exit(1);
} else {
serve_and_wait(DeveloperServer::new()).await
}
}
"memory" => serve_and_wait(MemoryServer::new()).await,
"tutorial" => serve_and_wait(TutorialServer::new()).await,
_ => {
Expand Down
Loading