internaltool-mcp 1.6.34 → 1.6.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +33 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -7580,6 +7580,7 @@ async function runWorkspaceScan(taskId, task, project, overrideRepoPath) {
7580
7580
  // ── 1. Detect repo root ─────────────────────────────────────────────────────
7581
7581
  // Cursor starts the MCP with cwd = the folder the developer has open.
7582
7582
  // Walk up to find the .git root so we always scan the full repo, not a subfolder.
7583
+ // Returns null if no .git found (avoids false positives from home-dir .git repos).
7583
7584
  function findGitRoot(startDir) {
7584
7585
  let dir = startDir
7585
7586
  for (let i = 0; i < 10; i++) {
@@ -7588,28 +7589,50 @@ async function runWorkspaceScan(taskId, task, project, overrideRepoPath) {
7588
7589
  if (parent === dir) break
7589
7590
  dir = parent
7590
7591
  }
7591
- return startDir
7592
+ return null // no .git found — caller must handle
7592
7593
  }
7593
7594
  const detectedRoot = findGitRoot(overrideRepoPath || process.cwd())
7594
7595
 
7596
+ if (!detectedRoot) {
7597
+ const startedFrom = overrideRepoPath || process.cwd()
7598
+ return {
7599
+ error: true,
7600
+ message: `No .git directory found in or above "${startedFrom}". Make sure Cursor is open inside your project folder, or pass repoPath explicitly.`,
7601
+ hint: `scan_workspace repoPath="/absolute/path/to/your/repo"`,
7602
+ }
7603
+ }
7604
+
7595
7605
  // ── 2. Verify it's the right repo via git remote ────────────────────────────
7596
7606
  // Compares local "origin" remote to project.githubRepoFullName.
7607
+ // Case-insensitive — GitHub repo names are not case-sensitive.
7597
7608
  // Prevents scanning the wrong repo when multiple projects are on the same machine.
7609
+ const norm = url => url.replace(/^(https?:\/\/github\.com\/|git@github\.com:)/, '').replace(/\.git$/, '').trim().toLowerCase()
7598
7610
  let repoVerification = { checked: false, matched: null, localRemote: null, projectRepo: project.githubRepoFullName || null }
7599
- if (project.githubRepoFullName) {
7600
- try {
7601
- const remoteUrl = runGit('remote get-url origin', detectedRoot).trim()
7602
- const norm = url => url.replace(/^(https?:\/\/github\.com\/|git@github\.com:)/, '').replace(/\.git$/, '').trim()
7603
- const localRepo = norm(remoteUrl)
7604
- const projectRepo = norm(project.githubRepoFullName)
7605
- repoVerification = { checked: true, matched: localRepo === projectRepo, localRemote: localRepo, projectRepo }
7611
+ try {
7612
+ const remoteUrl = runGit('remote get-url origin', detectedRoot).trim()
7613
+ const localRepo = norm(remoteUrl)
7614
+ const projectRepo = project.githubRepoFullName ? norm(project.githubRepoFullName) : null
7615
+
7616
+ if (projectRepo) {
7617
+ // Project has a GitHub link verify and block on mismatch
7618
+ repoVerification = { checked: true, matched: localRepo === projectRepo, localRemote: localRepo, projectRepo }
7606
7619
  if (!repoVerification.matched) {
7607
7620
  return {
7608
7621
  error: true,
7609
- message: `Wrong repo. Cursor is open in "${localRepo}" but this task belongs to "${projectRepo}". Open Cursor in the correct repo or pass repoPath explicitly.`,
7622
+ message: `Wrong repo Cursor is open in "${localRepo}" but this task belongs to "${projectRepo}". Open Cursor in the correct repo or pass repoPath explicitly.`,
7623
+ fix: [
7624
+ `Option 1: Run scan_workspace repoPath="/path/to/${projectRepo.split('/')[1]}"`,
7625
+ `Option 2: Make sure git remote origin is set to the correct repo`,
7626
+ ],
7610
7627
  }
7611
7628
  }
7612
- } catch { /* git unavailable — skip verification */ }
7629
+ } else {
7630
+ // No GitHub link — record the remote as a hint so user can tell if it looks right
7631
+ repoVerification = { checked: false, matched: null, localRemote: localRepo, projectRepo: null, warning: `Project has no GitHub repo linked — could not verify identity. Detected remote: "${localRepo}". If this is the wrong repo, pass repoPath explicitly.` }
7632
+ }
7633
+ } catch {
7634
+ // git unavailable or no remote — surface the detected root as a hint
7635
+ repoVerification = { checked: false, matched: null, localRemote: null, projectRepo: project.githubRepoFullName || null, warning: `Could not read git remote — make sure git is installed and origin is configured. Scanned: "${detectedRoot}".` }
7613
7636
  }
7614
7637
 
7615
7638
  // ── 3. Read .cursor/ subdirectories ─────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "internaltool-mcp",
3
- "version": "1.6.34",
3
+ "version": "1.6.35",
4
4
  "description": "MCP server for InternalTool — connect AI assistants (Claude Code, Cursor) to your project and task management platform",
5
5
  "type": "module",
6
6
  "main": "index.js",