Skip to content

Commit e482836

Browse files
authored
fix: dockerhub mcp-registry issue (#48)
* fix: mcp-registry issue * clippy flag
1 parent b586d41 commit e482836

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/fs_service.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,24 @@ pub struct FileSearchResult {
7575
pub matches: Vec<ContentMatchResult>,
7676
}
7777

78+
/// This addresses the issue with the DockerHub mcp-registry & mcp-gateway where tool discovery fails to resolve
79+
/// references to 'example' or 'default' values when running the run->command from the server.yaml file
80+
/// should be removed once mcp-gateway is more mature
81+
/// reference: https://github.com/docker/mcp-registry/blob/7d815fac2f3b7a9717eebc3f3db215de3ce3c3c7/internal/mcp/client.go#L170-L173
82+
#[allow(clippy::ptr_arg)]
83+
fn fix_dockerhub_mcp_registry_gateway(input: &String) -> &str {
84+
if input.contains("{{rust-mcp-filesystem.allowed_directories|volume-target|into}}") {
85+
"."
86+
} else {
87+
input
88+
}
89+
}
90+
7891
impl FileSystemService {
7992
pub fn try_new(allowed_directories: &[String]) -> ServiceResult<Self> {
8093
let normalized_dirs: Vec<PathBuf> = allowed_directories
8194
.iter()
95+
.map(fix_dockerhub_mcp_registry_gateway)
8296
.map_while(|dir| {
8397
let expand_result = expand_home(dir.into());
8498
if !expand_result.is_dir() {

src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ async fn main() {
1212
if let Err(error) = server::start_server(arguments).await {
1313
eprintln!("{error}");
1414
}
15-
println!(">>> 90 {:?} ", 90);
1615
}

0 commit comments

Comments
 (0)