UNPKG

@aashari/mcp-server-atlassian-bitbucket

Version:

Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MC

88 lines (87 loc) 3.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeleteApiToolArgs = exports.PatchApiToolArgs = exports.PutApiToolArgs = exports.PostApiToolArgs = exports.RequestWithBodyArgs = exports.GetApiToolArgs = exports.OutputFormat = void 0; const zod_1 = require("zod"); /** * Output format options for API responses * - toon: Token-Oriented Object Notation (default, more token-efficient for LLMs) * - json: Standard JSON format */ exports.OutputFormat = zod_1.z .enum(['toon', 'json']) .optional() .describe('Output format: "toon" (default, 30-60% fewer tokens) or "json". TOON is optimized for LLMs with tabular arrays and minimal syntax.'); /** * Base schema fields shared by all API tool arguments * Contains path, queryParams, jq filter, and outputFormat */ const BaseApiToolArgs = { /** * The API endpoint path (without base URL) * Examples: * - "/workspaces" - list workspaces * - "/workspaces/{workspace}" - get workspace details * - "/repositories/{workspace}/{repo_slug}" - get repository * - "/repositories/{workspace}/{repo_slug}/pullrequests" - list PRs * - "/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}" - get PR * - "/repositories/{workspace}/{repo_slug}/commits" - get commits * - "/repositories/{workspace}/{repo_slug}/src/{commit}/{path}" - get file content */ path: zod_1.z .string() .min(1, 'Path is required') .describe('The Bitbucket API endpoint path (without base URL). Must start with "/". Examples: "/workspaces", "/repositories/{workspace}/{repo_slug}", "/repositories/{workspace}/{repo_slug}/pullrequests/{id}"'), /** * Optional query parameters as key-value pairs */ queryParams: zod_1.z .record(zod_1.z.string(), zod_1.z.string()) .optional() .describe('Optional query parameters as key-value pairs. Examples: {"pagelen": "25", "page": "2", "q": "state=\\"OPEN\\"", "fields": "values.title,values.state"}'), /** * Optional JMESPath expression to filter/transform the response * IMPORTANT: Always use this to reduce response size and token costs */ jq: zod_1.z .string() .optional() .describe('JMESPath expression to filter/transform the response. IMPORTANT: Always use this to extract only needed fields and reduce token costs. Examples: "values[*].{name: name, slug: slug}" (extract specific fields), "values[0]" (first result), "values[*].name" (names only). See https://jmespath.org'), /** * Output format for the response * Defaults to TOON (token-efficient), can be set to JSON if needed */ outputFormat: exports.OutputFormat, }; /** * Body field for requests that include a request body (POST, PUT, PATCH) */ const bodyField = zod_1.z .record(zod_1.z.string(), zod_1.z.unknown()) .describe('Request body as a JSON object. Structure depends on the endpoint. Example for PR: {"title": "My PR", "source": {"branch": {"name": "feature"}}}'); /** * Schema for bb_get tool arguments (GET requests - no body) */ exports.GetApiToolArgs = zod_1.z.object(BaseApiToolArgs); /** * Schema for requests with body (POST, PUT, PATCH) */ exports.RequestWithBodyArgs = zod_1.z.object({ ...BaseApiToolArgs, body: bodyField, }); /** * Schema for bb_post tool arguments (POST requests) */ exports.PostApiToolArgs = exports.RequestWithBodyArgs; /** * Schema for bb_put tool arguments (PUT requests) */ exports.PutApiToolArgs = exports.RequestWithBodyArgs; /** * Schema for bb_patch tool arguments (PATCH requests) */ exports.PatchApiToolArgs = exports.RequestWithBodyArgs; /** * Schema for bb_delete tool arguments (DELETE requests - no body) */ exports.DeleteApiToolArgs = exports.GetApiToolArgs;