Context
When the github-workflow MCP server runs, its Current Working Directory (cwd) is sometimes observed as / instead of the project root. This causes local file-fetching tools like get_local_issue_by_id to fail with "File not found" errors because they rely on projectRoot.
The Problem
In ai/mcp/server/github-workflow/config.mjs, the projectRoot is determined using process.cwd() === '/' ? packageRoot : process.cwd(). This fallback is fragile. If process.cwd() is not the exact root of the repository but also not /, or if the server spawns in an unexpected context, the absolute pathing to resources/content/issues/ breaks. Even though the chunked directory structure (XXxx) is correct, the base directory path is wrong.
The Architectural Reality
MCP server configurations must derive absolute paths dynamically based on the location of their own module file (import.meta.url) rather than trusting process.cwd().
The Fix
Refactor ai/mcp/server/github-workflow/config.mjs:
- Remove
process.cwd() dependencies.
- Derive
projectRoot reliably using path.resolve(__dirname, '../../../../').
Acceptance Criteria
Context
When the
github-workflowMCP server runs, its Current Working Directory (cwd) is sometimes observed as/instead of the project root. This causes local file-fetching tools likeget_local_issue_by_idto fail with "File not found" errors because they rely onprojectRoot.The Problem
In
ai/mcp/server/github-workflow/config.mjs, theprojectRootis determined usingprocess.cwd() === '/' ? packageRoot : process.cwd(). This fallback is fragile. Ifprocess.cwd()is not the exact root of the repository but also not/, or if the server spawns in an unexpected context, the absolute pathing toresources/content/issues/breaks. Even though the chunked directory structure (XXxx) is correct, the base directory path is wrong.The Architectural Reality
MCP server configurations must derive absolute paths dynamically based on the location of their own module file (
import.meta.url) rather than trustingprocess.cwd().The Fix
Refactor
ai/mcp/server/github-workflow/config.mjs:process.cwd()dependencies.projectRootreliably usingpath.resolve(__dirname, '../../../../').Acceptance Criteria
config.mjssetsprojectRootexclusively via__dirnamerelative resolution.get_local_issue_by_id) succeed regardless of the host IDE's working directory.