diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 5ef05f18..59142d97 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -73,6 +73,7 @@ {"id":"bd-164","title":"Add label display to bd show and bd list output","description":"Include labels in issue display:\n- bd show \u003cissue\u003e should show labels\n- bd list should show labels (compact format)\n- JSON output should include labels array\n\nCurrently labels exist in DB but aren't shown in CLI output.","status":"open","priority":2,"issue_type":"task","created_at":"2025-10-19T20:45:36.865936-07:00","updated_at":"2025-10-19T20:52:23.603315-07:00"} {"id":"bd-165","title":"Document label best practices and use cases","description":"Create documentation covering:\n- When to use labels vs structured fields\n- Common label sets (coding agents, open source, product dev, SRE)\n- Naming conventions (kebab-case, specificity, present tense)\n- Anti-patterns (too many labels, overlapping, personal labels)\n- Label lifecycle management\n\nContent from LABELS.md analysis document.","status":"open","priority":3,"issue_type":"task","created_at":"2025-10-19T20:45:36.867864-07:00","updated_at":"2025-10-19T20:52:23.603503-07:00"} {"id":"bd-166","title":"Implement label CLI commands (add, remove, list)","description":"Add CLI commands for label management:\n- bd label add \u003cissue\u003e \u003clabel...\u003e\n- bd label remove \u003cissue\u003e \u003clabel...\u003e\n- bd label list \u003cissue\u003e\n- bd labels (list all labels in use)\n\nBackend already has AddLabel/GetLabels/RemoveLabel methods in storage layer.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-19T20:49:44.344807-07:00","updated_at":"2025-10-19T21:14:12.231668-07:00","closed_at":"2025-10-19T21:14:12.231668-07:00"} +{"id":"bd-167","title":"MCP server tools should accept workspace_root parameter","description":"","design":"After set_context is called, Amp appears to inject workspace_root as a parameter to subsequent tool calls. The beads-mcp server should accept this parameter (likely ignore it or map it to working_dir) to avoid errors.","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-10-19T21:17:06.93365-07:00","updated_at":"2025-10-19T21:29:38.326609-07:00","closed_at":"2025-10-19T21:29:38.326609-07:00"} {"id":"bd-17","title":"Test issue with explicit ID","description":"","status":"closed","priority":1,"issue_type":"task","created_at":"2025-10-16T20:46:08.971822-07:00","updated_at":"2025-10-19T20:52:23.603831-07:00","closed_at":"2025-10-16T10:07:34.124331-07:00"} {"id":"bd-18","title":"Critical bug","description":"","status":"closed","priority":0,"issue_type":"bug","created_at":"2025-10-16T20:46:08.971822-07:00","updated_at":"2025-10-19T20:52:23.604005-07:00","closed_at":"2025-10-14T14:16:08.107546-07:00"} {"id":"bd-19","title":"Verify auto-export works","description":"","status":"closed","priority":0,"issue_type":"task","created_at":"2025-10-16T20:46:08.971822-07:00","updated_at":"2025-10-19T20:52:23.604167-07:00","closed_at":"2025-10-14T14:16:09.268591-07:00"} diff --git a/integrations/beads-mcp/src/beads_mcp/server.py b/integrations/beads-mcp/src/beads_mcp/server.py index 10604d8a..3204dfa7 100644 --- a/integrations/beads-mcp/src/beads_mcp/server.py +++ b/integrations/beads-mcp/src/beads_mcp/server.py @@ -194,19 +194,24 @@ async def set_context(workspace_root: str) -> str: # Resolve to git repo root if possible resolved_root = _resolve_workspace_root(workspace_root) + # Always set working directory and context flag + os.environ["BEADS_WORKING_DIR"] = resolved_root + os.environ["BEADS_CONTEXT_SET"] = "1" + # Find beads database db_path = _find_beads_db(resolved_root) if db_path is None: + # Clear any stale DB path + os.environ.pop("BEADS_DB", None) return ( - f"Warning: No .beads/beads.db found in or above {resolved_root}. " - "You may need to run 'bd init' first. Context set but database not found." + f"Context set successfully:\n" + f" Workspace root: {resolved_root}\n" + f" Database: Not found (run 'bd init' to create)" ) - # Update environment for bd_client - os.environ["BEADS_WORKING_DIR"] = resolved_root + # Set database path os.environ["BEADS_DB"] = db_path - os.environ["BEADS_CONTEXT_SET"] = "1" return ( f"Context set successfully:\n" @@ -219,7 +224,7 @@ async def set_context(workspace_root: str) -> str: name="where_am_i", description="Show current workspace context and database path", ) -async def where_am_i() -> str: +async def where_am_i(workspace_root: str | None = None) -> str: """Show current workspace context for debugging.""" if not os.environ.get("BEADS_CONTEXT_SET"): return ( @@ -242,6 +247,7 @@ async def ready_work( limit: int = 10, priority: int | None = None, assignee: str | None = None, + workspace_root: str | None = None, ) -> list[Issue]: """Find issues with no blocking dependencies that are ready to work on.""" return await beads_ready_work(limit=limit, priority=priority, assignee=assignee) @@ -257,6 +263,7 @@ async def list_issues( issue_type: IssueType | None = None, assignee: str | None = None, limit: int = 50, + workspace_root: str | None = None, ) -> list[Issue]: """List all issues with optional filters.""" return await beads_list_issues( @@ -272,7 +279,7 @@ async def list_issues( name="show", description="Show detailed information about a specific issue including dependencies and dependents.", ) -async def show_issue(issue_id: str) -> Issue: +async def show_issue(issue_id: str, workspace_root: str | None = None) -> Issue: """Show detailed information about a specific issue.""" return await beads_show_issue(issue_id=issue_id) @@ -295,6 +302,7 @@ async def create_issue( labels: list[str] | None = None, id: str | None = None, deps: list[str] | None = None, + workspace_root: str | None = None, ) -> Issue: """Create a new issue.""" return await beads_create_issue( @@ -328,6 +336,7 @@ async def update_issue( acceptance_criteria: str | None = None, notes: str | None = None, external_ref: str | None = None, + workspace_root: str | None = None, ) -> Issue: """Update an existing issue.""" return await beads_update_issue( @@ -348,7 +357,7 @@ async def update_issue( description="Close (complete) an issue. Mark work as done when you've finished implementing/fixing it.", ) @require_context -async def close_issue(issue_id: str, reason: str = "Completed") -> list[Issue]: +async def close_issue(issue_id: str, reason: str = "Completed", workspace_root: str | None = None) -> list[Issue]: """Close (complete) an issue.""" return await beads_close_issue(issue_id=issue_id, reason=reason) @@ -358,7 +367,7 @@ async def close_issue(issue_id: str, reason: str = "Completed") -> list[Issue]: description="Reopen one or more closed issues. Sets status to 'open' and clears closed_at timestamp.", ) @require_context -async def reopen_issue(issue_ids: list[str], reason: str | None = None) -> list[Issue]: +async def reopen_issue(issue_ids: list[str], reason: str | None = None, workspace_root: str | None = None) -> list[Issue]: """Reopen one or more closed issues.""" return await beads_reopen_issue(issue_ids=issue_ids, reason=reason) @@ -373,6 +382,7 @@ async def add_dependency( from_id: str, to_id: str, dep_type: DependencyType = "blocks", + workspace_root: str | None = None, ) -> str: """Add a dependency relationship between two issues.""" return await beads_add_dependency( @@ -386,7 +396,7 @@ async def add_dependency( name="stats", description="Get statistics: total issues, open, in_progress, closed, blocked, ready, and average lead time.", ) -async def stats() -> Stats: +async def stats(workspace_root: str | None = None) -> Stats: """Get statistics about tasks.""" return await beads_stats() @@ -395,7 +405,7 @@ async def stats() -> Stats: name="blocked", description="Get blocked issues showing what dependencies are blocking them from being worked on.", ) -async def blocked() -> list[BlockedIssue]: +async def blocked(workspace_root: str | None = None) -> list[BlockedIssue]: """Get blocked issues.""" return await beads_blocked() @@ -406,7 +416,7 @@ async def blocked() -> list[BlockedIssue]: database with optional custom prefix for issue IDs.""", ) @require_context -async def init(prefix: str | None = None) -> str: +async def init(prefix: str | None = None, workspace_root: str | None = None) -> str: """Initialize bd in current directory.""" return await beads_init(prefix=prefix) @@ -415,7 +425,7 @@ async def init(prefix: str | None = None) -> str: name="debug_env", description="Debug tool: Show environment and working directory information", ) -async def debug_env() -> str: +async def debug_env(workspace_root: str | None = None) -> str: """Debug tool to check working directory and environment variables.""" info = [] info.append("=== Working Directory Debug Info ===\n")