fix(mcp): default get_module_tree output_dir to repo docs path#73
Open
BrahmendraBachi wants to merge 1 commit into
Open
fix(mcp): default get_module_tree output_dir to repo docs path#73BrahmendraBachi wants to merge 1 commit into
BrahmendraBachi wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the default
output_dirresolution in the legacyget_module_treeMCP tool so it looks formodule_tree.jsonunder the target repository's docs folder instead of the MCP server's current working directory.What changed
In
_legacy_get_module_tree, whenoutput_diris not provided:Path("docs").resolve(), which resolved relative to the MCP process cwd(repo_path / "docs").resolve(), so docs are always resolved relative to the analyzed repoWhen
output_diris explicitly passed, behavior is unchanged — the provided path is still expanded and resolved as before.Why
When CodeWiki runs as an MCP server in Cursor (or another IDE), the process cwd is often the workspace root or the MCP install directory, not the repo being analyzed. That caused
get_module_treeto look in the wrong place (e.g../docs/module_tree.jsonin the IDE workspace) even when docs had been generated under<repo>/docs/.This aligns the legacy tool with the intended convention that generated docs live next to the repo unless an explicit
output_diris given.Test plan
get_module_treewith onlyrepo_path(nooutput_dir) for a repo that has<repo>/docs/module_tree.json— should succeedget_module_treefrom a different cwd (e.g. MCP server started outside the repo) — should still find the module treeget_module_treewith an explicitoutput_dir— should still use the provided pathget_module_treewhen no module tree exists — should return the same clear error as before