[Bug] Projman diagnostic failure: MCP tools require explicit repo parameter #77

Closed
opened 2026-01-21 22:09:16 +00:00 by lmiranda · 1 comment
Owner

Summary

During /projman:labels-sync execution in the personal-projects/personal-portfolio repository, MCP Gitea tools failed when called without an explicit repo parameter, despite the repository context being available.

Failed Tests

Tool calls without repo parameter:

mcp__plugin_projman_gitea__validate_repo_org()
mcp__plugin_projman_gitea__get_labels()

Error Messages

Both tools returned:

Error: Use 'owner/repo' format (e.g. 'org/repo-name')

Expected Behavior

MCP tools should automatically detect the repository context from:

  1. The current working directory's git remote
  2. The CLAUDE.md configuration specifying personal-projects/personal-portfolio

Actual Behavior

Tools require explicit repo parameter to function:

# This fails:
mcp__plugin_projman_gitea__get_labels()

# This works:
mcp__plugin_projman_gitea__get_labels(repo="personal-projects/personal-portfolio")

Repository Context

  • Affected Repo: personal-projects/personal-portfolio
  • Working Directory: /home/lmiranda/Repositories/personal/personal-portfolio
  • Git Remote: ssh://git@hotserv.tailc9b278.ts.net:2222/personal-projects/personal-portfolio.git
  • CLAUDE.md Config: Repo explicitly defined as personal-projects/personal-portfolio

Impact

  • Minor inconvenience - workaround exists (pass explicit repo parameter)
  • All projman skills need to handle this by passing repo explicitly

Suggested Fix

The MCP server should:

  1. Parse the git remote URL to extract owner/repo
  2. Fall back to CLAUDE.md configuration if available
  3. Only error if no repo context can be determined

Labels: Type: Bug, Source: Internal

## Summary During `/projman:labels-sync` execution in the `personal-projects/personal-portfolio` repository, MCP Gitea tools failed when called without an explicit `repo` parameter, despite the repository context being available. ## Failed Tests **Tool calls without repo parameter:** ``` mcp__plugin_projman_gitea__validate_repo_org() mcp__plugin_projman_gitea__get_labels() ``` ## Error Messages Both tools returned: ``` Error: Use 'owner/repo' format (e.g. 'org/repo-name') ``` ## Expected Behavior MCP tools should automatically detect the repository context from: 1. The current working directory's git remote 2. The CLAUDE.md configuration specifying `personal-projects/personal-portfolio` ## Actual Behavior Tools require explicit `repo` parameter to function: ```python # This fails: mcp__plugin_projman_gitea__get_labels() # This works: mcp__plugin_projman_gitea__get_labels(repo="personal-projects/personal-portfolio") ``` ## Repository Context - **Affected Repo**: `personal-projects/personal-portfolio` - **Working Directory**: `/home/lmiranda/Repositories/personal/personal-portfolio` - **Git Remote**: `ssh://git@hotserv.tailc9b278.ts.net:2222/personal-projects/personal-portfolio.git` - **CLAUDE.md Config**: Repo explicitly defined as `personal-projects/personal-portfolio` ## Impact - Minor inconvenience - workaround exists (pass explicit repo parameter) - All projman skills need to handle this by passing repo explicitly ## Suggested Fix The MCP server should: 1. Parse the git remote URL to extract owner/repo 2. Fall back to CLAUDE.md configuration if available 3. Only error if no repo context can be determined --- **Labels**: `Type: Bug`, `Source: Internal`
Author
Owner

Root Cause Analysis

The previous "fixes" (PRs #70, #71, #72) were incorrect. The MCP server cannot auto-detect the repository because:

  1. MCP server runs with cwd set to ${CLAUDE_PLUGIN_ROOT}/mcp-servers/gitea (the plugin directory)
  2. It has no access to the user's project directory
  3. The _find_project_directory() code was wishful thinking - Claude Code doesn't set CLAUDE_PROJECT_DIR env var
  4. The PWD env var is also the plugin directory, not the user's project

The MCP server architecture fundamentally cannot know which project directory the user is in.

Correct Solution

The fix is in the command documentation, not the MCP server code.

The labels-sync.md now explicitly instructs Claude to:

  1. Run git remote get-url origin via Bash (Claude CAN run bash in the user's project)
  2. Parse the output to extract owner/repo
  3. Pass the repo parameter to ALL MCP tool calls

This is the architecturally correct solution: Claude (the agent) detects the repo, then passes it to MCP tools.

Changes Made

Completely rewrote plugins/projman/commands/labels-sync.md:

  • Added "CRITICAL: Execution Steps" with explicit numbered steps
  • Added "DO NOT" section preventing common mistakes
  • Removed the "Label Reference" section (was causing Claude to ask about creating local files)
  • Made all MCP tool examples show required repo parameter

Commit: 69b71fc

## Root Cause Analysis The previous "fixes" (PRs #70, #71, #72) were incorrect. The MCP server **cannot** auto-detect the repository because: 1. MCP server runs with `cwd` set to `${CLAUDE_PLUGIN_ROOT}/mcp-servers/gitea` (the plugin directory) 2. It has **no access** to the user's project directory 3. The `_find_project_directory()` code was wishful thinking - Claude Code doesn't set `CLAUDE_PROJECT_DIR` env var 4. The `PWD` env var is also the plugin directory, not the user's project **The MCP server architecture fundamentally cannot know which project directory the user is in.** ## Correct Solution The fix is in the **command documentation**, not the MCP server code. The `labels-sync.md` now explicitly instructs Claude to: 1. Run `git remote get-url origin` via Bash (Claude CAN run bash in the user's project) 2. Parse the output to extract `owner/repo` 3. Pass the `repo` parameter to ALL MCP tool calls This is the architecturally correct solution: Claude (the agent) detects the repo, then passes it to MCP tools. ## Changes Made Completely rewrote `plugins/projman/commands/labels-sync.md`: - Added "CRITICAL: Execution Steps" with explicit numbered steps - Added "DO NOT" section preventing common mistakes - Removed the "Label Reference" section (was causing Claude to ask about creating local files) - Made all MCP tool examples show required `repo` parameter Commit: `69b71fc`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/leo-claude-mktplace#77