Skip to content

Cursor MCP launches Gortex from home directory, causing entry-point handshake failure #19

@aramonc

Description

@aramonc

Problem definition

When Cursor uses the Gortex MCP integration, the process can start with current working directory set to the user home (~/) instead of the opened project root. This causes Gortex MCP startup to fail at the strict entry-point handshake.

Observed logs (from Cursor MCP):

2026-05-07 17:10:06.303 [info] [V2 FSM] connection:connect_start: conn=idle,auth=unknown -> conn=connecting,auth=unknown
2026-05-07 17:10:06.303 [error] [gortex] MCP handshake failed: not a Gortex entry point: /Users/adrian is neither a workspace root (containing .gortex/workspace.toml) nor a project root (containing .gortex/). There is no walk-up. Run `gortex init` here to bind this directory as a single-project root, or create .gortex/workspace.toml to bind it as a workspace root
Error: not a Gortex entry point: /Users/adrian is neither a workspace root (containing .gortex/workspace.toml) nor a project root (containing .gortex/). There is no walk-up. Run `gortex init` here to bind this directory as a single-project root, or create .gortex/workspace.toml to bind it as a workspace root
undefined

Probable root cause

  • gortex install currently writes a global Cursor MCP config at ~/.cursor/mcp.json.
  • The default MCP entry uses gortex mcp --index . --watch.
  • When Cursor starts this global entry without project-scoped cwd, . resolves to ~/.
  • Proxy/handshake code currently derives session cwd from os.Getwd(), so daemon routing also inherits this wrong cwd.
  • Gortex correctly rejects startup because ~/ is not a valid Gortex entry point.

Suggested implementations

  1. Prefer project-local MCP for Cursor

    • Do not write ~/.cursor/mcp.json by default (or for Cursor specifically).
    • Keep .cursor/mcp.json as the primary integration path via gortex init.
  2. Make global Cursor MCP daemon-only if retained

    • For global installs, use gortex mcp --proxy (or equivalent daemon-only mode) instead of --index ..
    • Avoid any cwd-relative index target in global config.
  3. Harden cwd detection in proxy handshake

    • Prefer editor-provided workspace env vars (e.g. CURSOR_WORKSPACE) over os.Getwd() when available.
    • Fallback to os.Getwd() only when no workspace signal exists.
  4. Improve install UX/docs

    • Document that global Cursor MCP with --index . can bind to home cwd and fail strict handshake.
    • Recommend daemon + per-project MCP as default multi-repo setup.

Expected behavior

  • Opening a project in Cursor should not fail MCP startup due to home-directory cwd.
  • Gortex MCP should consistently resolve repo context from the active project workspace, or proxy through daemon without cwd-relative indexing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions