Skip to content

fix(mcp): resolve ctx_index relative paths from project dir#365

Open
Tomodad wants to merge 3 commits intomksglu:nextfrom
Tomodad:fix-ctx-index-relative-path
Open

fix(mcp): resolve ctx_index relative paths from project dir#365
Tomodad wants to merge 3 commits intomksglu:nextfrom
Tomodad:fix-ctx-index-relative-path

Conversation

@Tomodad
Copy link
Copy Markdown

@Tomodad Tomodad commented Apr 27, 2026

Summary

  • Resolve ctx_index(path) relative file paths against context-mode's detected project directory instead of the MCP server process cwd.
  • Preserve the original relative path as the source label when no explicit source is provided.
  • Add a regression test that starts the MCP server with CONTEXT_MODE_PROJECT_DIR and indexes a relative file path via ctx_index.

Test plan

  • pnpm run typecheck
  • pnpm exec vitest run tests/core/server.test.ts --testNamePattern \"ctx_index file paths\" — blocked locally by missing better-sqlite3 native binding under Node 24 (Could not locate the bindings file).

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mksglu mksglu changed the base branch from main to next April 27, 2026 17:57
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mksglu
Copy link
Copy Markdown
Owner

mksglu commented Apr 28, 2026

No need seperate file for that.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Tomodad
Copy link
Copy Markdown
Author

Tomodad commented Apr 28, 2026

Addressed — removed the separate src/project-path.ts helper and kept the relative-path resolution logic local to src/server.ts. Also removed the helper-only tests so the change stays small.

Verified locally:

  • pnpm run typecheck
  • pnpm run build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants