Skip to content

Commit faba56d

Browse files
Claude Sonnet (coordinator)claude
andcommitted
fix(mcpb): use server/ subdir and ${__dirname} in command per mcpb spec
Official mcpb calculator-rust example uses: entry_point: 'server/mcp-calculator' command: '${__dirname}/server/mcp-calculator' ${__dirname} is resolved by Claude Code to the extraction directory, giving an absolute path. This fixes ENOENT on Windows spawn. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 47f27b5 commit faba56d

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

xtask/src/bundler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ impl McpbBundler {
6262
zip.start_file("manifest.json", options)?;
6363
zip.write_all(manifest_json.as_bytes())?;
6464

65-
// 2. binary — stored under the canonical entry_point name from the manifest
66-
// (drops .exe suffix on Windows so the ZIP is cross-platform consistent)
65+
// 2. binary — stored under server/<entry_point> per mcpb spec
66+
// (${__dirname}/server/<binary> is how Claude Code resolves the absolute path)
6767
let bin_options = options.unix_permissions(0o755);
6868
zip.start_file(&self.manifest.server.entry_point, bin_options)?;
6969
let mut bin_file = fs::File::open(&self.binary_path)?;

xtask/src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,11 @@ fn ledgerr_manifest(version: &str, binary_name: &str) -> McpbManifest {
168168
},
169169
server: ManifestServer {
170170
server_type: ServerType::Binary,
171-
entry_point: binary_name.into(),
171+
// Binary lives in server/ subdirectory per mcpb spec
172+
entry_point: format!("server/{binary_name}"),
172173
mcp_config: McpConfig {
173-
// No ./ prefix — Claude Code resolves the extraction path itself
174-
command: binary_name.into(),
174+
// ${__dirname} is resolved by Claude Code to the extraction directory
175+
command: format!("${{__dirname}}/server/{binary_name}"),
175176
args: vec![],
176177
env: None,
177178
},

0 commit comments

Comments
 (0)