@critical-path/mcp 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +15 -1
- package/dist/bin/args.d.ts +16 -0
- package/dist/bin/args.d.ts.map +1 -0
- package/dist/bin/args.js +45 -0
- package/dist/bin/args.js.map +1 -0
- package/dist/bin/args.test.d.ts +2 -0
- package/dist/bin/args.test.d.ts.map +1 -0
- package/dist/bin/args.test.js +24 -0
- package/dist/bin/args.test.js.map +1 -0
- package/dist/bin/cli.js +13 -17
- package/dist/bin/cli.js.map +1 -1
- package/dist/tools/definitions.d.ts +30 -24
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +47 -219
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/definitions.test.js +10 -2
- package/dist/tools/definitions.test.js.map +1 -1
- package/package.json +4 -3
- package/src/bin/args.test.ts +28 -0
- package/src/bin/args.ts +50 -0
- package/src/bin/cli.ts +13 -16
- package/src/tools/definitions.test.ts +12 -2
- package/src/tools/definitions.ts +57 -225
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @critical-path/mcp
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b54e22c: Validate request bodies with shared zod schemas and publish an OpenAPI document.
|
|
8
|
+
|
|
9
|
+
**@critical-path/core**
|
|
10
|
+
- New `@critical-path/core/schemas` subpath with create/update schemas for every resource and `parsePayload(schema, data)`. Kept off the package root so browser bundles do not include zod. `zod` is now a dependency of core.
|
|
11
|
+
- `ValidationError` carries an optional `issues: { path, message }[]`.
|
|
12
|
+
|
|
13
|
+
**@critical-path/server**
|
|
14
|
+
- All request bodies are validated. Invalid bodies return `400` with `issues`. Server-assigned fields (`id`, `createdAt`, `updatedAt`, task `key`, owning `projectId` on updates) and unknown keys are stripped, so a `PATCH` can no longer move a task to another project.
|
|
15
|
+
- Comments, reactions and attachments require an author unless `getContext` resolves the caller. Attachment `mimeType` and `sizeBytes` default to `application/octet-stream` and `0` for linked files.
|
|
16
|
+
- New `GET /openapi.json` and `buildOpenApiDocument()` (OpenAPI 3.1, request bodies generated from the validation schemas).
|
|
17
|
+
|
|
18
|
+
**@critical-path/mcp**
|
|
19
|
+
- Tool `inputSchema`s are generated from their zod schemas via the new `defineTool`, removing the hand-written JSON copies.
|
|
20
|
+
|
|
21
|
+
**@critical-path/svelte**
|
|
22
|
+
- Rebuilt with the bundled `@critical-path/mcp` changes.
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [b54e22c]
|
|
27
|
+
- @critical-path/core@0.24.0
|
|
28
|
+
- @critical-path/client@0.14.9
|
|
29
|
+
|
|
30
|
+
## 0.8.0
|
|
31
|
+
|
|
32
|
+
### Minor Changes
|
|
33
|
+
|
|
34
|
+
- 6dd5529: Add request context, authentication hooks and actor attribution.
|
|
35
|
+
|
|
36
|
+
**@critical-path/core**
|
|
37
|
+
- New `engine.withActor(actor)` returns a per-request view that attributes every mutation (activity log, comment authors, reactions, time entries, attachment uploaders, task reporters) to the actor and ignores identity fields supplied in payloads. New exported `Actor` type.
|
|
38
|
+
|
|
39
|
+
**@critical-path/server**
|
|
40
|
+
- New router options, accepted by all adapters as a second argument: `getContext` (resolve the caller per request), `requireAuth` (401 without a user), `basePath` (exact mount path), and `cors` (origin allow-list, credentials, or `false`).
|
|
41
|
+
- With a resolved user, identity fields in request bodies (`actorId`, `authorId`, `userId`, `uploaderId`) are ignored. Reaction routes no longer require `userId` in the body when a user is resolved.
|
|
42
|
+
- `createSvelteKitHandler` options take `getContext(event)` so `event.locals` is available; `configOrRouter` is now optional.
|
|
43
|
+
- New `createUniversalHandler(config, options)` for Workers, Deno, Bun and Hono.
|
|
44
|
+
- `handleRequest(request, { getContext })` lets custom adapters supply a per-request resolver.
|
|
45
|
+
|
|
46
|
+
**@critical-path/mcp**
|
|
47
|
+
- CLI `--api` mode reads `CRITICAL_PATH_API_TOKEN` (sent as a Bearer token) and accepts repeatable `--header "Name: value"`, warning when credentials would go over plain http to a remote host.
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [6dd5529]
|
|
52
|
+
- @critical-path/core@0.23.0
|
|
53
|
+
- @critical-path/client@0.14.8
|
|
54
|
+
|
|
3
55
|
## 0.7.0
|
|
4
56
|
|
|
5
57
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -43,6 +43,20 @@ npx @critical-path/mcp --api http://localhost:3000/api/critical-path
|
|
|
43
43
|
npx @critical-path/mcp
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"mcpServers": {
|
|
51
|
+
"critical-path": {
|
|
52
|
+
"command": "npx",
|
|
53
|
+
"args": ["-y", "@critical-path/mcp", "--api", "https://app.example.com/api/critical-path"],
|
|
54
|
+
"env": { "CRITICAL_PATH_API_TOKEN": "<token>" }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
46
60
|
### Claude Desktop Configuration
|
|
47
61
|
|
|
48
62
|
Add the following to your `claude_desktop_config.json`:
|
|
@@ -163,7 +177,7 @@ handle.unregister();
|
|
|
163
177
|
| `get_timeline_ladder` | Multi-scale Ladder of Abstraction (macro/standard/concrete) | `{ projectId?, level?, containerId?, iterationId? }` |
|
|
164
178
|
| `get_task_ladder` | Single-task ladder view connecting phase, CPM Gantt, and concrete evidence | `{ taskId }` |
|
|
165
179
|
|
|
166
|
-
Tool arguments are validated against each tool's zod schema before execution, on both the standard server and WebMCP. Invalid arguments return an `isError` result, and fields a tool does not declare are stripped (for example, `projectId` cannot be changed through `update_task`). When you pass `tools: [...]` to `createCriticalPathMcpServer`, tools outside that list are neither listed nor callable. `delete_task` is advertised with the MCP `destructiveHint` annotation.
|
|
180
|
+
Each tool's JSON `inputSchema` is generated from its zod schema with `defineTool`, so what the model sees always matches what is enforced. Tool arguments are validated against each tool's zod schema before execution, on both the standard server and WebMCP. Invalid arguments return an `isError` result, and fields a tool does not declare are stripped (for example, `projectId` cannot be changed through `update_task`). When you pass `tools: [...]` to `createCriticalPathMcpServer`, tools outside that list are neither listed nor callable. `delete_task` is advertised with the MCP `destructiveHint` annotation.
|
|
167
181
|
|
|
168
182
|
---
|
|
169
183
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface CliOptions {
|
|
2
|
+
db?: string;
|
|
3
|
+
api?: string;
|
|
4
|
+
headers: string[];
|
|
5
|
+
help?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseArgs(args: string[]): CliOptions;
|
|
8
|
+
/**
|
|
9
|
+
* Builds request headers for `--api` mode from repeated `--header "Name: value"` flags and the
|
|
10
|
+
* `CRITICAL_PATH_API_TOKEN` environment variable (sent as `Authorization: Bearer <token>`).
|
|
11
|
+
* Prefer the environment variable for secrets: command-line flags are visible in process lists.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildApiHeaders(headerFlags: string[], env: Record<string, string | undefined>): Record<string, string>;
|
|
14
|
+
/** True when credentials would be sent in cleartext to a host other than this machine. */
|
|
15
|
+
export declare function isInsecureRemote(apiUrl: string): boolean;
|
|
16
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/bin/args.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAepD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAatH;AAED,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIxD"}
|
package/dist/bin/args.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function parseArgs(args) {
|
|
2
|
+
const options = { headers: [] };
|
|
3
|
+
for (let i = 0; i < args.length; i++) {
|
|
4
|
+
const arg = args[i];
|
|
5
|
+
if (arg === '--help' || arg === '-h') {
|
|
6
|
+
options.help = true;
|
|
7
|
+
}
|
|
8
|
+
else if (arg === '--db' && args[i + 1]) {
|
|
9
|
+
options.db = args[++i];
|
|
10
|
+
}
|
|
11
|
+
else if (arg === '--api' && args[i + 1]) {
|
|
12
|
+
options.api = args[++i];
|
|
13
|
+
}
|
|
14
|
+
else if (arg === '--header' && args[i + 1]) {
|
|
15
|
+
options.headers.push(args[++i]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return options;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Builds request headers for `--api` mode from repeated `--header "Name: value"` flags and the
|
|
22
|
+
* `CRITICAL_PATH_API_TOKEN` environment variable (sent as `Authorization: Bearer <token>`).
|
|
23
|
+
* Prefer the environment variable for secrets: command-line flags are visible in process lists.
|
|
24
|
+
*/
|
|
25
|
+
export function buildApiHeaders(headerFlags, env) {
|
|
26
|
+
const headers = {};
|
|
27
|
+
if (env.CRITICAL_PATH_API_TOKEN) {
|
|
28
|
+
headers['Authorization'] = `Bearer ${env.CRITICAL_PATH_API_TOKEN}`;
|
|
29
|
+
}
|
|
30
|
+
for (const flag of headerFlags) {
|
|
31
|
+
const separator = flag.indexOf(':');
|
|
32
|
+
if (separator <= 0) {
|
|
33
|
+
throw new Error(`Invalid --header "${flag}". Expected "Name: value".`);
|
|
34
|
+
}
|
|
35
|
+
headers[flag.slice(0, separator).trim()] = flag.slice(separator + 1).trim();
|
|
36
|
+
}
|
|
37
|
+
return headers;
|
|
38
|
+
}
|
|
39
|
+
/** True when credentials would be sent in cleartext to a host other than this machine. */
|
|
40
|
+
export function isInsecureRemote(apiUrl) {
|
|
41
|
+
const url = new URL(apiUrl);
|
|
42
|
+
const localHosts = ['localhost', '127.0.0.1', '[::1]'];
|
|
43
|
+
return url.protocol === 'http:' && !localHosts.includes(url.hostname) && !url.hostname.endsWith('.localhost');
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/bin/args.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,OAAO,GAAe,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACrC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACtB,CAAC;aAAM,IAAI,GAAG,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YACzC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE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M,UAAU,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACvD,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAChH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.test.d.ts","sourceRoot":"","sources":["../../src/bin/args.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { parseArgs, buildApiHeaders, isInsecureRemote } from './args.js';
|
|
3
|
+
describe('MCP CLI arguments', () => {
|
|
4
|
+
it('collects repeated --header flags', () => {
|
|
5
|
+
const options = parseArgs(['--api', 'https://x.test/api', '--header', 'X-Tenant: acme', '--header', 'X-Trace: 1']);
|
|
6
|
+
expect(options.api).toBe('https://x.test/api');
|
|
7
|
+
expect(options.headers).toEqual(['X-Tenant: acme', 'X-Trace: 1']);
|
|
8
|
+
});
|
|
9
|
+
it('builds headers from the token env var and flags, with flags taking precedence', () => {
|
|
10
|
+
expect(buildApiHeaders(['X-Tenant: acme'], { CRITICAL_PATH_API_TOKEN: 'secret' })).toEqual({
|
|
11
|
+
Authorization: 'Bearer secret',
|
|
12
|
+
'X-Tenant': 'acme'
|
|
13
|
+
});
|
|
14
|
+
expect(buildApiHeaders(['Authorization: Basic abc'], { CRITICAL_PATH_API_TOKEN: 'secret' }).Authorization).toBe('Basic abc');
|
|
15
|
+
expect(() => buildApiHeaders(['no-colon'], {})).toThrow(/Expected "Name: value"/);
|
|
16
|
+
});
|
|
17
|
+
it('flags plain http to remote hosts only', () => {
|
|
18
|
+
expect(isInsecureRemote('http://api.example.com')).toBe(true);
|
|
19
|
+
expect(isInsecureRemote('https://api.example.com')).toBe(false);
|
|
20
|
+
expect(isInsecureRemote('http://localhost:3000/api')).toBe(false);
|
|
21
|
+
expect(isInsecureRemote('http://127.0.0.1:3000')).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=args.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.test.js","sourceRoot":"","sources":["../../src/bin/args.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEzE,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;QACnH,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC/C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+EAA+E,EAAE,GAAG,EAAE;QACvF,MAAM,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,EAAE,EAAE,uBAAuB,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YACzF,aAAa,EAAE,eAAe;YAC9B,UAAU,EAAE,MAAM;SACnB,CAAC,CAAC;QACH,MAAM,CAAC,eAAe,CAAC,CAAC,0BAA0B,CAAC,EAAE,EAAE,uBAAuB,EAAE,QAAQ,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,IAAI,CAC7G,WAAW,CACZ,CAAC;QACF,MAAM,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9D,MAAM,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClE,MAAM,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/bin/cli.js
CHANGED
|
@@ -2,22 +2,7 @@
|
|
|
2
2
|
import { CriticalPathEngine, SQLiteStore, InMemoryStore } from '@critical-path/core';
|
|
3
3
|
import { CriticalPathClient } from '@critical-path/client';
|
|
4
4
|
import { createCriticalPathMcpServer, startStdioServer } from '../server/index.js';
|
|
5
|
-
|
|
6
|
-
const options = {};
|
|
7
|
-
for (let i = 0; i < args.length; i++) {
|
|
8
|
-
const arg = args[i];
|
|
9
|
-
if (arg === '--help' || arg === '-h') {
|
|
10
|
-
options.help = true;
|
|
11
|
-
}
|
|
12
|
-
else if (arg === '--db' && args[i + 1]) {
|
|
13
|
-
options.db = args[++i];
|
|
14
|
-
}
|
|
15
|
-
else if (arg === '--api' && args[i + 1]) {
|
|
16
|
-
options.api = args[++i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return options;
|
|
20
|
-
}
|
|
5
|
+
import { parseArgs, buildApiHeaders, isInsecureRemote } from './args.js';
|
|
21
6
|
function showHelp() {
|
|
22
7
|
console.log(`
|
|
23
8
|
Critical Path MCP Server (Stdio)
|
|
@@ -25,9 +10,13 @@ Critical Path MCP Server (Stdio)
|
|
|
25
10
|
Usage:
|
|
26
11
|
npx @critical-path/mcp [options]
|
|
27
12
|
|
|
13
|
+
Environment:
|
|
14
|
+
CRITICAL_PATH_API_TOKEN Sent as "Authorization: Bearer <token>" in --api mode
|
|
15
|
+
|
|
28
16
|
Options:
|
|
29
17
|
--db <path> Path to SQLite database file (uses SQLiteStore)
|
|
30
18
|
--api <url> Base URL of remote Critical Path server (uses CriticalPathClient)
|
|
19
|
+
--header <h> Extra request header for --api, as "Name: value" (repeatable)
|
|
31
20
|
--help, -h Display this help message
|
|
32
21
|
|
|
33
22
|
Examples:
|
|
@@ -37,6 +26,9 @@ Examples:
|
|
|
37
26
|
# Run against remote Next.js or SvelteKit route handler
|
|
38
27
|
npx @critical-path/mcp --api http://localhost:3000/api/critical-path
|
|
39
28
|
|
|
29
|
+
# Authenticate against a protected API (token read from the environment)
|
|
30
|
+
CRITICAL_PATH_API_TOKEN=secret npx @critical-path/mcp --api https://app.example.com/api/critical-path
|
|
31
|
+
|
|
40
32
|
# Run with in-memory store (for testing)
|
|
41
33
|
npx @critical-path/mcp
|
|
42
34
|
`);
|
|
@@ -50,7 +42,11 @@ async function main() {
|
|
|
50
42
|
}
|
|
51
43
|
let server;
|
|
52
44
|
if (options.api) {
|
|
53
|
-
const
|
|
45
|
+
const headers = buildApiHeaders(options.headers, process.env);
|
|
46
|
+
if (Object.keys(headers).length > 0 && isInsecureRemote(options.api)) {
|
|
47
|
+
console.error('[Critical Path MCP] Warning: sending credentials over plain http to a remote host.');
|
|
48
|
+
}
|
|
49
|
+
const client = new CriticalPathClient({ baseUrl: options.api, headers });
|
|
54
50
|
server = createCriticalPathMcpServer({ client, name: 'critical-path-api-mcp' });
|
|
55
51
|
console.error(`[Critical Path MCP] Connecting to remote API at ${options.api} over stdio...`);
|
|
56
52
|
}
|
package/dist/bin/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/bin/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/bin/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEzE,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Bb,CAAC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAEhC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,MAAM,CAAC;IAEX,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9D,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO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nB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -7,6 +7,7 @@ export interface ToolDefinition<TParams = any, TResult = any> {
|
|
|
7
7
|
title: string;
|
|
8
8
|
description: string;
|
|
9
9
|
zodSchema: z.ZodObject<any>;
|
|
10
|
+
/** JSON Schema shown to MCP clients. Generated from `zodSchema` by `defineTool`. */
|
|
10
11
|
inputSchema: Record<string, unknown>;
|
|
11
12
|
annotations?: {
|
|
12
13
|
readOnlyHint?: boolean;
|
|
@@ -16,6 +17,11 @@ export interface ToolDefinition<TParams = any, TResult = any> {
|
|
|
16
17
|
projectId?: string;
|
|
17
18
|
}) => Promise<TResult>;
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Declares a tool, generating its JSON Schema `inputSchema` from `zodSchema` so the schema the
|
|
22
|
+
* model sees and the one arguments are validated against cannot drift apart.
|
|
23
|
+
*/
|
|
24
|
+
export declare function defineTool<TParams = any, TResult = any>(spec: Omit<ToolDefinition<TParams, TResult>, 'inputSchema'>): ToolDefinition<TParams, TResult>;
|
|
19
25
|
export declare class ToolArgumentError extends Error {
|
|
20
26
|
constructor(toolName: string, details: string);
|
|
21
27
|
}
|
|
@@ -27,43 +33,43 @@ export declare function parseToolArgs<TParams>(tool: ToolDefinition<TParams>, ar
|
|
|
27
33
|
export declare function resolveBackend(target: BackendContext): Promise<{
|
|
28
34
|
isEngine: boolean;
|
|
29
35
|
}>;
|
|
30
|
-
export declare const listProjectsTool: ToolDefinition
|
|
36
|
+
export declare const listProjectsTool: ToolDefinition<any, import("@critical-path/core").Project[]>;
|
|
31
37
|
export declare const getProjectTool: ToolDefinition<{
|
|
32
38
|
id: string;
|
|
33
|
-
}>;
|
|
39
|
+
}, any>;
|
|
34
40
|
export declare const createProjectTool: ToolDefinition<{
|
|
35
41
|
name: string;
|
|
36
42
|
description?: string;
|
|
37
43
|
key?: string;
|
|
38
|
-
}>;
|
|
44
|
+
}, any>;
|
|
39
45
|
export declare const listTasksTool: ToolDefinition<{
|
|
40
46
|
projectId?: string;
|
|
41
47
|
status?: string;
|
|
42
48
|
priority?: string;
|
|
43
49
|
assigneeId?: string;
|
|
44
|
-
}>;
|
|
50
|
+
}, any>;
|
|
45
51
|
export declare const getTaskTool: ToolDefinition<{
|
|
46
52
|
id: string;
|
|
47
|
-
}>;
|
|
53
|
+
}, any>;
|
|
48
54
|
export declare const createTaskTool: ToolDefinition<{
|
|
49
55
|
projectId?: string;
|
|
50
56
|
title: string;
|
|
51
57
|
description?: string;
|
|
52
58
|
status?: string;
|
|
53
|
-
priority?:
|
|
59
|
+
priority?: "urgent" | "high" | "medium" | "low" | "none";
|
|
54
60
|
assigneeId?: string;
|
|
55
61
|
dueDate?: string;
|
|
56
62
|
tags?: string[];
|
|
57
63
|
estimatedHours?: number;
|
|
58
64
|
isBlocked?: boolean;
|
|
59
65
|
blockedReason?: string;
|
|
60
|
-
}>;
|
|
66
|
+
}, any>;
|
|
61
67
|
export declare const updateTaskTool: ToolDefinition<{
|
|
62
68
|
id: string;
|
|
63
69
|
title?: string;
|
|
64
70
|
description?: string;
|
|
65
71
|
status?: string;
|
|
66
|
-
priority?:
|
|
72
|
+
priority?: "urgent" | "high" | "medium" | "low" | "none";
|
|
67
73
|
assigneeId?: string;
|
|
68
74
|
dueDate?: string;
|
|
69
75
|
tags?: string[];
|
|
@@ -71,55 +77,55 @@ export declare const updateTaskTool: ToolDefinition<{
|
|
|
71
77
|
loggedHours?: number;
|
|
72
78
|
isBlocked?: boolean;
|
|
73
79
|
blockedReason?: string;
|
|
74
|
-
}>;
|
|
80
|
+
}, any>;
|
|
75
81
|
export declare const deleteTaskTool: ToolDefinition<{
|
|
76
82
|
id: string;
|
|
77
|
-
}>;
|
|
83
|
+
}, any>;
|
|
78
84
|
export declare const listDeliverablesTool: ToolDefinition<{
|
|
79
85
|
projectId?: string;
|
|
80
|
-
}>;
|
|
86
|
+
}, any>;
|
|
81
87
|
export declare const createDeliverableTool: ToolDefinition<{
|
|
82
88
|
projectId?: string;
|
|
83
89
|
title: string;
|
|
84
90
|
description?: string;
|
|
85
91
|
dueDate?: string;
|
|
86
92
|
taskIds?: string[];
|
|
87
|
-
}>;
|
|
93
|
+
}, any>;
|
|
88
94
|
export declare const listCommentsTool: ToolDefinition<{
|
|
89
95
|
taskId: string;
|
|
90
|
-
}>;
|
|
96
|
+
}, any>;
|
|
91
97
|
export declare const addCommentTool: ToolDefinition<{
|
|
92
98
|
taskId: string;
|
|
93
99
|
content: string;
|
|
94
100
|
authorId: string;
|
|
95
|
-
}>;
|
|
101
|
+
}, any>;
|
|
96
102
|
export declare const calculateCriticalPathTool: ToolDefinition<{
|
|
97
103
|
projectId?: string;
|
|
98
|
-
}>;
|
|
104
|
+
}, any>;
|
|
99
105
|
export declare const getTimelineLadderTool: ToolDefinition<{
|
|
100
106
|
projectId?: string;
|
|
101
|
-
level?:
|
|
107
|
+
level?: "macro" | "standard" | "concrete" | "all";
|
|
102
108
|
containerId?: string;
|
|
103
109
|
iterationId?: string;
|
|
104
|
-
}>;
|
|
110
|
+
}, any>;
|
|
105
111
|
export declare const getTaskLadderTool: ToolDefinition<{
|
|
106
112
|
taskId: string;
|
|
107
|
-
}>;
|
|
113
|
+
}, any>;
|
|
108
114
|
export declare const getTaskMetricsTool: ToolDefinition<{
|
|
109
115
|
taskId: string;
|
|
110
|
-
}>;
|
|
116
|
+
}, any>;
|
|
111
117
|
export declare const getTaskProgressHistoryTool: ToolDefinition<{
|
|
112
118
|
taskId: string;
|
|
113
|
-
}>;
|
|
119
|
+
}, any>;
|
|
114
120
|
export declare const getWorkloadDistributionTool: ToolDefinition<{
|
|
115
121
|
projectId?: string;
|
|
116
122
|
startDate?: string;
|
|
117
123
|
endDate?: string;
|
|
118
|
-
interval?:
|
|
119
|
-
groupBy?:
|
|
120
|
-
metric?:
|
|
124
|
+
interval?: "day" | "week" | "month";
|
|
125
|
+
groupBy?: "assignee" | "team" | "taskType" | "priority" | "status";
|
|
126
|
+
metric?: "scheduled" | "logged" | "remaining" | "blended";
|
|
121
127
|
defaultWeeklyCapacityHours?: number;
|
|
122
|
-
}>;
|
|
128
|
+
}, any>;
|
|
123
129
|
export declare const ALL_TOOLS: ToolDefinition[];
|
|
124
130
|
export declare const TOOL_MAP: Map<string, ToolDefinition<any, any>>;
|
|
125
131
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAErE,MAAM,WAAW,cAAc,CAAC,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5B,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE;QACZ,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;IACF,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,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