@critical-path/mcp

中文文档
0.26.2发布于 2026/11/05MITTypeScriptES Module构建来源已验证近 30 天下载 4682

Model Context Protocol (MCP) server, client-side WebMCP tools and agent skills for Critical Path

原始使用文档
文档目录16 节
  1. 💡 Overview
  2. 📦 Installation
  3. 🚀 Standard Server MCP (Claude Desktop, Cursor, CLI)
  4. Running via CLI
  5. Claude Desktop Configuration
  6. Programmatic Server Creation
  7. 🌐 Client-Side WebMCP (In-Browser Copilots)
  8. React Integration ( useWebMCP )
  9. Svelte 5 Integration ( WebMcpState / createWebMcpState )
  10. Vanilla / Framework-Agnostic WebMCP
  11. 🛠️ Supported Tools
  12. 🧭 Agent Discovery: Toolsets, Instructions & Skills
  13. 📚 Resources & Prompts (Standard MCP Server)
  14. Resources
  15. Prompts
  16. 📄 License

@critical-path/mcp

Model Context Protocol (MCP) and Client-Side WebMCP Integration for Critical Path
Connect AI coding agents, background workers, and in-browser copilots directly to your project management workflows.

Upgrading? Upgrade every @critical-path/* package together. Coding agents: follow UPGRADING.md; breaking changes are marked BREAKING in this package's CHANGELOG.md.

License: MIT


💡 Overview

@critical-path/mcp bridges the Critical Path headless project management framework with AI agents via two complementary protocols:

  1. Standard Server MCP (@critical-path/mcp/server): Standard Model Context Protocol (MCP) server implementation using @modelcontextprotocol/sdk. Runs over stdio or streamable HTTP/SSE, allowing external AI assistants (such as Claude Desktop, Cursor, and Antigravity) to manage projects, tasks, sprints, deliverables, and comments.
  2. Client-Side WebMCP (@critical-path/mcp/web): In-browser tool registration following the W3C Web Machine Learning Community Group WebMCP specification. Registers structured tools directly on document.modelContext / navigator.modelContext with ambient project scoping, enabling in-browser AI assistants and page copilots to actuate project state without fragile DOM scraping.

📦 Installation

pnpm add @critical-path/mcp

🚀 Standard Server MCP (Claude Desktop, Cursor, CLI)

Running via CLI

You can spin up an MCP server over stdio instantly against a local SQLite database, in-memory store, or a remote Critical Path REST API:

# Against a local SQLite database
npx @critical-path/mcp --db ./path/to/critical-path.db

# Against a remote Next.js or SvelteKit route handler
npx @critical-path/mcp --api http://localhost:3000/api/critical-path

# Temporary in-memory store (for testing)
npx @critical-path/mcp

# Expose only some tools: toolsets, exact names, read-only
npx @critical-path/mcp --db ./critical-path.db --toolsets scheduling,analytics,guidance --read-only

# Install the bundled agent skills for coding agents
npx @critical-path/mcp skills install

For APIs protected with requireAuth, set CRITICAL_PATH_API_TOKEN (sent as Authorization: Bearer <token>) or pass --header "Name: value" (repeatable). Prefer the environment variable for secrets, since command-line flags are visible in process lists. The CLI warns when credentials would be sent over plain http to a non-local host.

{
  "mcpServers": {
    "critical-path": {
      "command": "npx",
      "args": ["-y", "@critical-path/mcp", "--api", "https://app.example.com/api/critical-path"],
      "env": { "CRITICAL_PATH_API_TOKEN": "<token>" }
    }
  }
}

Claude Desktop Configuration

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "critical-path": {
      "command": "npx",
      "args": ["-y", "@critical-path/mcp", "--db", "/absolute/path/to/critical-path.db"]
    }
  }
}

Programmatic Server Creation

import { createCriticalPathMcpServer, startStdioServer } from '@critical-path/mcp/server';
import { CriticalPathEngine, SQLiteStore } from '@critical-path/core';

const engine = new CriticalPathEngine({
  store: new SQLiteStore({ filename: 'projects.db' })
});

const server = createCriticalPathMcpServer({
  engine,
  name: 'my-project-pm',
  toolsets: ['core', 'collaboration', 'guidance'] // optional; default: every tool
});

await startStdioServer(server);

🌐 Client-Side WebMCP (In-Browser Copilots)

WebMCP exposes client-side tools directly in the browser's JavaScript environment without scraping DOM elements.

React Integration (useWebMCP)

import { useWebMCP } from '@critical-path/react';

export function ProjectDashboard({ projectId }: { projectId: string }) {
  // Automatically registers tools scoped to the active project
  // and cleans up on unmount or project change via AbortController.
  // `instructions` briefs the agent; add it to your copilot's system prompt.
  const { registered, tools, instructions } = useWebMCP({
    projectId,
    tools: ['create_task', 'list_tasks', 'update_task', 'add_comment']
  });

  return (
    <div>
      <h1>Project View</h1>
      {registered && <p>AI Copilot Active ({tools.length} tools available)</p>}
    </div>
  );
}

Svelte 5 Integration (WebMcpState / createWebMcpState)

<script lang="ts">
  import { createCriticalPathClient, createWebMcpState } from '@critical-path/svelte';

  const client = createCriticalPathClient({ baseUrl: '/api/critical-path' });
  const mcp = createWebMcpState(client, { projectId: 'proj-123' });
</script>

<div>
  {#if mcp.registered}
    <span>🤖 In-browser AI assistant enabled for project {mcp.activeProjectId}</span>
  {/if}
</div>

Vanilla / Framework-Agnostic WebMCP

import { registerWebMcpTools } from '@critical-path/mcp/web';
import { CriticalPathClient } from '@critical-path/client';

const client = new CriticalPathClient({ baseUrl: '/api/critical-path' });

const handle = registerWebMcpTools({
  client,
  projectId: 'proj-main',
  onToolExecuted: (name, input, result) => {
    console.log(`[WebMCP] Executed ${name}:`, input, result);
  }
});

// To clean up and unregister:
handle.unregister();

🛠️ Supported Tools

ToolToolsetUse it forKey Parameters
list_projectscoreFinding project ids; returns { projects }{}
get_projectcoreWorkflow statuses, custom fields and calendar of a project{ id }
create_projectcoreA new, empty project{ name, description?, key? }
list_taskscoreFinding tasks; returns { tasks, nextCursor }{ projectId?, status?, priority?, assigneeId?, iterationId?, deliverableId?, containerId?, parentId? ('none' = top-level), limit?, cursor? }
get_taskcoreOne task's full record; with includeDependencies, what it waits for (dependsOn) and what waits for it (dependents){ id, includeDependencies? }
create_taskcoreAdding work (auto-scoped in WebMCP){ projectId?, title, description?, priority?, status?, estimatedHours?, allocation?, deadline?, isMilestone? }
update_taskcoreChanging status, priority, assignee, estimates, deadline{ id, title?, status?, priority?, assigneeId?, allocation?, deadline?, isMilestone? }
log_timecoreRecording hours worked (the only way to add logged hours){ taskId, hours, description?, isBillable?, loggedAt? }
update_time_entrycoreCorrecting logged time (the task's hours move by the difference){ id, hours?, description?, isBillable?, loggedAt? }
delete_time_entrycoreRemoving time logged by mistake{ id }
delete_taskcorePermanent deletion (destructiveHint){ id }
add_dependencycoreMaking a task wait for another, so the critical path orders them; idempotent, refuses loops{ taskId, dependsOnTaskId, type? ('blocking' | 'relates_to') }
remove_dependencycoreRemoving that link, by the same two task ids; returns { removed, dependencyIds }{ taskId, dependsOnTaskId, type? }
list_deliverablescollaborationA project's deliverables (outputs that group tasks); returns { deliverables }{ projectId? }
create_deliverablecollaborationAn output that several tasks produce{ projectId?, title, dueDate?, taskIds? }
list_commentscollaborationA task's discussion, oldest first; returns { comments, nextCursor }{ taskId, limit?, cursor? }
add_commentcollaborationRecording a decision or note (authored by the server's actor){ taskId, content }
calculate_critical_pathschedulingForecast finish, critical tasks, slack (calendars: 'assignee' uses each assignee's or team's calendar; levelResources limits each assignee to one task at a time){ projectId?, calendars?, levelResources?, levelingPriority?, effort?, defaultEstimateHours?, baselineId? }
calculate_portfolio_critical_pathschedulingSeveral projects (default: all readable), sharing people and teams when levelling{ projectIds?, projectOrder?, includeHiddenWork?, calendars?, levelResources?, levelingPriority?, effort? }
create_baselineschedulingSaving the agreed plan to track slippage against{ projectId?, name, calendars?, levelResources? }
list_baselinesschedulingFinding a baseline to compare with (baselineId on calculate_critical_path){ projectId? }
get_workload_distributionschedulingHours, capacity and utilization per person, team or category over time{ projectId?, startDate?, endDate?, interval?, groupBy?, metric? }
get_timeline_ladderanalyticsProject status: phase health (macro), timeline (standard), evidence (concrete){ projectId?, level?, containerId?, iterationId? }
get_task_ladderanalyticsOne task's phase, schedule position and evidence{ taskId }
get_task_metricsanalyticsProgress, variance and earned value (CPI, SPI){ taskId }
get_task_progress_historyanalyticsProgress over time and curve shape{ taskId }
get_skillguidanceLoading a playbook for a multi-step job{ name? }

Each tool's JSON inputSchema and outputSchema are generated from its zod schemas with defineTool, so what the model sees always matches what is enforced. Tool arguments are validated before execution, on both the standard server and WebMCP. Invalid or undeclared arguments return an isError result naming the problem (for example, projectId cannot be passed to update_task). Results are JSON objects, returned as structuredContent and as text; a lookup that finds nothing is an error with a hint on how to find valid ids.

Identity: with an engine, changes are attributed to the server's actor option (default DEFAULT_MCP_ACTOR, mcp-agent); tools never take author or actor arguments. If the engine has an authorize policy, the actor is checked like any user: give it project memberships (or roles: ['admin']), and a tenantId in multi-tenant setups. With a client, the API's authentication decides who the caller is. Tools outside the tools / toolsets selection are neither listed nor callable. Every tool sends the standard MCP annotations readOnlyHint, destructiveHint, idempotentHint and openWorldHint.


🧭 Agent Discovery: Toolsets, Instructions & Skills

Agents choose tools from their descriptions. This package helps them choose well:

  • Toolsets keep the list short. Pass toolsets (core, collaboration, scheduling, analytics, guidance), tools (exact names, combined with toolsets) and readOnly to createCriticalPathMcpServer, registerWebMcpTools, useWebMCP or createWebMcpState, or --toolsets, --tools and --read-only to the CLI. Unknown names throw.
  • Server instructions are sent on connect: the data model, where ids come from, which tool fits which request, and the skill index. WebMCP returns the same text as handle.instructions (also instructions from useWebMCP and WebMcpState) for your copilot's system prompt. buildAgentInstructions(tools) builds it for custom hosts.
  • Skills are playbooks for multi-step jobs, in the Agent Skills SKILL.md format:
SkillUse it for
plan-projectTurning a goal into a project with deliverables, estimated, prioritized tasks and their dependencies
triage-tasksSetting priority, estimates, tags and blocked state across a backlog
analyze-scheduleFinding what drives the end date and recommending fixes
report-statusWriting a project status report
plan-capacityFinding overloaded or idle people and rebalancing work
investigate-taskWorking out why one task is late, stalled or over budget

Agents load them with the get_skill tool, read them as criticalpath://skills/{name} resources, or use them as files:

# Writes .claude/skills/<name>/SKILL.md (edited files are kept unless you pass --force)
npx @critical-path/mcp skills install [--dir <path>]

The files ship in the package (@critical-path/mcp/skills/<name>/SKILL.md), and SKILLS / getSkill() are exported.

Measuring tool choice: pnpm --filter @critical-path/mcp eval:tools (needs Anthropic credentials) asks Claude to pick a tool for each request in evals/tool-selection.cases.json and reports the score. Unit tests lint every description without an API key.


📚 Resources & Prompts (Standard MCP Server)

Resources

  • criticalpath://projects: Live JSON stream of all projects.
  • criticalpath://tasks: Live JSON stream of all tasks.
  • criticalpath://tasks/{id}: Detailed JSON payload of a specific task.
  • criticalpath://skills/{name}: A bundled agent skill (markdown).

Prompts

  • summarize_project: Executive summary of project health, completion rates, and blockers.
  • triage_task: AI-guided triage analyzing priority, estimation, and acceptance criteria.

📄 License

MIT © Jack James

版本与发布记录

@critical-path/mcp 共发布 64 个版本,首次发布于 2026/09/10;过去 12 个月发布了 64 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.26.2latest2026/11/055 天前
0.26.12026/11/037 天前
0.26.02026/11/038 天前
0.25.02026/10/2813 天前
0.24.12026/10/2813 天前
0.24.02026/10/2813 天前

关于 @critical-path/mcp 的常见问题

@critical-path/mcp 是什么?

Model Context Protocol (MCP) server, client-side WebMCP tools and agent skills for Critical Path

如何安装 @critical-path/mcp?

在项目目录运行 npm install @critical-path/mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 critical-path-mcp,可以用 npx critical-path-mcp 直接运行。

@critical-path/mcp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@critical-path/mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@critical-path/mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@critical-path/mcp 可以商用吗?

@critical-path/mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@critical-path/mcp 的下载量有多少?

根据 npm 官方下载统计,@critical-path/mcp 在 2026/10/11 – 2026/11/09 这 30 天内被下载 4,682 次,日均约 156 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@critical-path/mcp 还在维护吗?

最新版本 0.26.2 发布于 2026/11/05(5 天前);至今共发布 64 个版本,其中过去 12 个月发布了 64 个;首次发布于 2026/09/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。