Repository navigation
Description
Pre-flight checks
- I searched existing issues. This is item 5 of MCP server: silent wrong matches on ambiguous/near-miss names, noisy query_graph, misleading list_prs error #3917, which was closed as fixed, but the fix never landed. The repo-detection change was in fix(mcp): enforce deterministic get_node resolution & graceful list_p… #3920, which was closed without merging. fix(mcp): a substring near-miss is no longer the answer (#3917) #4618, cited when MCP server: silent wrong matches on ambiguous/near-miss names, noisy query_graph, misleading list_prs error #3917 was closed, does not touch
graphify/prs.py. - Reproduced on the latest release (0.9.121).
What happened?
list_prs and triage_prs fail with:
Error: gh CLI not found or not authenticated. Run: gh auth login
whenever the MCP server's working directory is not inside the graph's git repository, even though gh is installed and authenticated. get_pr_impact fails the same way (PR #N not found or gh not authenticated.).
Cause: graphify/prs.py _gh() runs gh pr list ... with no --repo and no cwd, so gh resolves the repository from the server process's working directory. _gh() then returns None on any non-zero exit, and fetch_prs() turns that into the auth message, so the real gh error (not a git repository) never reaches the user.
This hits every client that starts the stdio server outside the repo, for example a global MCP config with --graph /abs/path/to/repo/graphify-out/graph.json, or launchers that cd to a neutral directory. The graph tools work in that setup and only the PR tools break, which makes the auth message especially misleading.
Steps to reproduce
- Use any git repo with a GitHub remote, open PRs and a built
graphify-out/graph.json. Make suregh auth statusis OK. - Start the server from a directory outside the repo:
cd "$(mktemp -d)" graphify-mcp --graph /abs/path/to/repo/graphify-out/graph.json - Call
list_prs(ortriage_prs) with no arguments.
Result of each variant over the MCP stdio protocol (same graph, same machine, same gh login):
| server cwd | arguments | list_prs / triage_prs |
|---|---|---|
| non-git temp dir | {} |
error: gh CLI not found or not authenticated. Run: gh auth login |
| non-git temp dir | {"repo": "owner/name"} |
OK: Open PRs targeting main: 4 |
| the repo itself | {} |
OK: Open PRs targeting main: 4 |
Error output or graph output
Error: gh CLI not found or not authenticated. Run: gh auth login
Expected
At least one of:
- When
repois omitted, run gh withcwdset to the repository that holds the served graph (the git root of--graph), instead of the process cwd. Same forfetch_worktrees()and_detect_default_branch(). - Report the actual failure (as fix(mcp): enforce deterministic get_node resolution & graceful list_p… #3920 proposed), e.g.
could not detect repository; pass repo=owner/name, and keep "not authenticated" for real auth failures (gh auth statusnon-zero).
Graphify version
0.9.121 (prs.py is byte-identical in 0.9.115)
Operating System
macOS 26.6.2 (arm64)
Python Version
3.13.15
Installation Method
uv tool install 'graphifyy[mcp]==0.9.121'
Additional Environment Details
gh 2.104.0, authenticated. MCP Python SDK 2.3.0, stdio transport.
Additional context
Workaround: pass repo="owner/name" explicitly on every PR tool call.
Activity
github-actions commentedon Nov 27, 2026
Thanks for opening this issue, @thomaswillner. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
thomaswillner commentedon Nov 27, 2026
Context for maintainers: this was already reported as item 5 of #3917, which was closed as fixed in 0.9.94, but the fix (#3920) was closed without merging and the code on the default branch is unchanged. Details: #3917 (comment)
fix(prs): run gh with the graph repo as cwd when --repo is omitted