Skip to main content
Glama

mcp-server-circleci

Official
handler.ts2.09 kB
import { ToolCallback } from '@modelcontextprotocol/sdk/server/mcp.js'; import { getLatestPipelineStatusInputSchema } from './inputSchema.js'; import { getBranchFromURL, getProjectSlugFromURL, } from '../../lib/project-detection/index.js'; import mcpErrorOutput from '../../lib/mcpErrorOutput.js'; import { identifyProjectSlug } from '../../lib/project-detection/index.js'; import { getLatestPipelineWorkflows } from '../../lib/latest-pipeline/getLatestPipelineWorkflows.js'; import { formatLatestPipelineStatus } from '../../lib/latest-pipeline/formatLatestPipelineStatus.js'; export const getLatestPipelineStatus: ToolCallback<{ params: typeof getLatestPipelineStatusInputSchema; }> = async (args) => { const { workspaceRoot, gitRemoteURL, branch, projectURL, projectSlug: inputProjectSlug, } = args.params ?? {}; let projectSlug: string | null | undefined; let branchFromURL: string | null | undefined; if (inputProjectSlug) { if (!branch) { return mcpErrorOutput( 'Branch not provided. When using projectSlug, a branch must also be specified.', ); } projectSlug = inputProjectSlug; } else if (projectURL) { projectSlug = getProjectSlugFromURL(projectURL); branchFromURL = getBranchFromURL(projectURL); } else if (workspaceRoot && gitRemoteURL) { projectSlug = await identifyProjectSlug({ gitRemoteURL, }); } else { return mcpErrorOutput( 'Missing required inputs. Please provide either: 1) projectSlug with branch, 2) projectURL, or 3) workspaceRoot with gitRemoteURL and branch.', ); } if (!projectSlug) { return mcpErrorOutput(` Project not found. Ask the user to provide the inputs user can provide based on the tool description. Project slug: ${projectSlug} Git remote URL: ${gitRemoteURL} Branch: ${branch} `); } const latestPipelineWorkflows = await getLatestPipelineWorkflows({ projectSlug, branch: branchFromURL ?? branch, }); return formatLatestPipelineStatus(latestPipelineWorkflows); };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CircleCI-Public/mcp-server-circleci'

If you have feedback or need assistance with the MCP directory API, please join our Discord server