UNPKG

@gohcltech/bitbucket-mcp

Version:

Bitbucket integration for Claude via Model Context Protocol

299 lines 11 kB
/** * Centralized tool registry and export system for the Bitbucket MCP server. * * This module serves as the main entry point for the MCP tool system, providing * a well-organized architecture for Bitbucket API integration tools. The tool * system is designed with modularity and extensibility in mind, allowing easy * addition of new tool categories without disrupting existing functionality. * * ## Tool System Architecture * * The tool system follows a hierarchical organization pattern: * - **Base Layer**: `BaseTool` provides common functionality and interfaces * - **Category Layer**: Specialized tool classes for different API domains * - **Export Layer**: This module provides unified access to all tools * * ## Tool Categories * * Tools are organized into logical categories based on Bitbucket API domains: * - **Workspace**: Organization-level operations and workspace management * - **Repository**: Repository CRUD operations and metadata management * - **Branch**: Git branch lifecycle and branch-specific operations * - **Pull Request**: Code review workflows and PR management * - **Commit**: Commit history, diffs, and commit-level operations * - **Issue**: Issue tracking and project management * * ## Adding New Tool Categories * * To add a new tool category to the system: * * 1. **Create Tool Module**: Create a new file in `src/tools/` (e.g., `pipeline-tools.ts`) * 2. **Extend BaseTool**: Inherit from `BaseTool` for common functionality * 3. **Implement Tools**: Define MCP tool handlers using the `@tool` decorator pattern * 4. **Export Here**: Add the new tool class to this index file with JSDoc * 5. **Register in Server**: Import and register tools in the main server (`src/index.ts`) * * @example Basic tool import pattern * ```typescript * import { * BaseTool, * BranchTools, * PullRequestTools * } from './tools/index.js'; * ``` * * @example Adding a new tool category * ```typescript * // 1. Create src/tools/pipeline-tools.ts * export class PipelineTools extends BaseTool { * // Implement pipeline-related tools * } * * // 2. Add to this index.ts * export { PipelineTools } from './pipeline-tools.js'; * * // 3. Register in src/index.ts * const pipelineTools = new PipelineTools(bitbucketClient); * server.addToolHandler(pipelineTools); * ``` * * @see {@link BaseTool} For the base tool implementation and common patterns * @see {@link ../index.ts} For tool registration in the main MCP server * @since 1.0.0 */ /** * Core base tool class and type definitions for building MCP tools. * * Provides the foundational architecture for all MCP tool implementations, * including common functionality for error handling, parameter validation, * and response formatting. All tool categories should extend BaseTool to * ensure consistent behavior and integration with the MCP framework. * * **Key Components:** * - `BaseTool`: Abstract base class with common tool functionality * - `ToolHandler`: Type definition for MCP tool handler functions * - `ToolResponse`: Standardized response format for tool operations * * @example Extending BaseTool for a new tool category * ```typescript * import { BaseTool } from './base-tool.js'; * * export class MyTools extends BaseTool { * async handleMyTool(params: MyToolParams): Promise<ToolResponse> { * // Implementation using inherited BaseTool functionality * } * } * ``` */ export { BaseTool, ToolHandler, ToolResponse } from './base-tool.js'; /** * Consolidated tool base class for v2.1 action-based routing. * * Abstract base class providing the foundation for consolidated tools that use * action-based routing to group multiple related operations into a single tool. * Extends BaseTool with action-specific validation and handler routing. * * @see {@link ConsolidatedBaseTool} For detailed implementation and usage patterns */ export { ConsolidatedBaseTool } from './consolidated-base-tool.js'; /** * Consolidated workspace management tool (v2.1). * * Combines list_workspaces and get_workspace into a single manage_workspaces * tool with action-based routing. Provides workspace discovery and detailed * workspace information retrieval. * * **Replaces v2.0 tools:** * - list_workspaces * - get_workspace * * **Actions:** * - `list`: List all accessible workspaces * - `get`: Get detailed workspace information */ export { ManageWorkspacesTool } from './workspace-tools.js'; /** * Consolidated commit management tool (v2.1). * * Combines list_commits, get_commit, get_commit_diff, and get_commit_patch * into a single query_commits tool with action-based routing. Provides * comprehensive commit querying and analysis capabilities. * * **Replaces v2.0 tools:** * - list_commits * - get_commit * - get_commit_diff * - get_commit_patch * * **Actions:** * - `list`: List commits with optional filtering * - `get`: Get detailed commit information * - `get_diff`: Get commit diff showing changes * - `get_patch`: Generate Git-compatible patch */ export { QueryCommitsTool } from './commit-tools.js'; /** * Consolidated repository management tool (v2.1). * * Combines list_repositories, get_repository, create_repository, update_repository, * and delete_repository into a single manage_repositories tool with action-based * routing. Provides comprehensive repository lifecycle management. * * **Replaces v2.0 tools:** * - list_repositories * - get_repository * - create_repository * - update_repository * - delete_repository * * **Actions:** * - `list`: List repositories in a workspace * - `get`: Get detailed repository information * - `create`: Create a new repository * - `update`: Update repository settings * - `delete`: Delete a repository */ export { ManageRepositoriesTool } from './repository-tools.js'; /** * Consolidated branch management tool (v2.1). * * Combines list_branches, get_branch, create_branch, delete_branch, get_branching_model, * get_branch_permissions, and get_default_reviewers into a single manage_branches tool * with action-based routing. Provides complete branch lifecycle management and configuration. * * **Replaces v2.0 tools:** * - list_branches * - get_branch * - create_branch * - delete_branch * - get_branching_model * - get_branch_permissions * - get_default_reviewers * * **Actions:** * - `list`: List all branches in a repository * - `get`: Get detailed branch information * - `create`: Create a new branch * - `delete`: Delete a branch * - `get_model`: Get branching model configuration * - `get_permissions`: Get branch protection rules * - `get_reviewers`: Get automatic reviewer assignments */ export { ManageBranchesTool } from './branch-tools.js'; /** * Consolidated pull request management tool (v2.1). * * Combines list_pull_requests, get_pull_request, create_pull_request, approve_pull_request, * unapprove_pull_request, merge_pull_request, decline_pull_request, add_comment, and get_comments * into a single manage_pull_requests tool with action-based routing. Provides comprehensive PR * workflows and comment management. * * **Replaces v2.0 tools:** * - list_pull_requests * - get_pull_request * - create_pull_request * - approve_pull_request * - unapprove_pull_request * - merge_pull_request * - decline_pull_request * - add_comment (PR comments) * - get_comments (PR comments) * * **Actions:** * - `list`: List pull requests with optional state filtering * - `get`: Get detailed pull request information * - `create`: Create a new pull request * - `approve`: Approve a pull request * - `unapprove`: Remove approval from a pull request * - `merge`: Merge an approved pull request * - `decline`: Decline a pull request * - `list_comments`: Get all comments for a pull request * - `add_comment`: Add a comment to a pull request */ export { ManagePullRequestsTool } from './pull-request-tools.js'; /** * Consolidated issue management tool (v2.1). * * Combines list_issues, get_issue, create_issue, update_issue, delete_issue, search_issues, * get_issue_changes, get_issue_watchers, list_comments, get_comment, add_comment, update_comment, * delete_comment, list_components, get_component, list_milestones, get_milestone, list_versions, * and get_version into a single manage_issues tool with action-based routing. Provides comprehensive * issue tracking, comment management, and metadata access. * * **Replaces v2.0 tools:** * - list_issues * - get_issue * - create_issue * - update_issue * - delete_issue * - search_issues * - get_issue_changes * - get_issue_watchers * - list_comments (issue comments) * - get_comment (issue comments) * - add_comment (issue comments) * - update_comment (issue comments) * - delete_comment (issue comments) * - list_components (metadata) * - get_component (metadata) * - list_milestones (metadata) * - get_milestone (metadata) * - list_versions (metadata) * - get_version (metadata) * * **Actions:** * - `list`: List issues with optional filtering * - `get`: Get detailed issue information * - `create`: Create a new issue * - `update`: Update issue properties * - `delete`: Delete an issue * - `search`: Search issues by text query * - `get_changes`: Get issue change history * - `get_watchers`: Get users watching an issue * - `list_comments`: List comments on an issue * - `get_comment`: Get a specific comment * - `add_comment`: Add a comment to an issue * - `update_comment`: Update an existing comment * - `delete_comment`: Delete a comment * - `list_components`: List all issue components * - `get_component`: Get component details * - `list_milestones`: List all milestones * - `get_milestone`: Get milestone details * - `list_versions`: List all versions * - `get_version`: Get version details */ export { ManageIssuesTool } from './issue-tools.js'; /** * Workspace management tool (v2.1 short name). * Alias for: ManageWorkspacesTool */ export { ManageWorkspacesTool as WorkspaceTool } from './workspace-tools.js'; /** * Repository management tool (v2.1 short name). * Alias for: ManageRepositoriesTool */ export { ManageRepositoriesTool as RepoTool } from './repository-tools.js'; /** * Branch management tool (v2.1 short name). * Includes branch operations and branch configuration. * Alias for: ManageBranchesTool */ export { ManageBranchesTool as BranchTool } from './branch-tools.js'; /** * Commit management tool (v2.1 short name). * Alias for: QueryCommitsTool */ export { QueryCommitsTool as CommitTool } from './commit-tools.js'; /** * Pull request management tool (v2.1 short name). * Includes PR operations and PR comments. * Alias for: ManagePullRequestsTool */ export { ManagePullRequestsTool as PrTool } from './pull-request-tools.js'; /** * Issue management tool (v2.1 short name). * Includes issues, issue comments, and issue metadata. * Alias for: ManageIssuesTool */ export { ManageIssuesTool as IssueTool } from './issue-tools.js'; //# sourceMappingURL=index.d.ts.map