@fractary/faber-mcp 1.1.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.
@@ -0,0 +1,282 @@
1
+ /**
2
+ * Workflow Orchestration Tools for FABER MCP Server
3
+ *
4
+ * Provides workflow control and management via MCP.
5
+ */
6
+ import { FaberWorkflow } from '@fractary/faber/workflow';
7
+ import { StateManager } from '@fractary/faber/state';
8
+ /**
9
+ * Create tool error response
10
+ */
11
+ function createToolError(toolName, error) {
12
+ return {
13
+ content: [{
14
+ type: 'text',
15
+ text: JSON.stringify({ status: 'error', operation: toolName, error }, null, 2)
16
+ }],
17
+ isError: true,
18
+ };
19
+ }
20
+ /**
21
+ * Create workflow orchestration tools
22
+ *
23
+ * @returns Array of tool definitions
24
+ */
25
+ export function createWorkflowTools() {
26
+ return [
27
+ // Tool 1: fractary_faber_workflow_run
28
+ {
29
+ name: 'fractary_faber_workflow_run',
30
+ description: 'Run FABER workflow (Frame → Architect → Build → Evaluate → Release) for a work item',
31
+ inputSchema: {
32
+ type: 'object',
33
+ required: ['work_id'],
34
+ properties: {
35
+ work_id: {
36
+ type: 'string',
37
+ description: 'Work item ID to process (e.g., "123" for issue #123)',
38
+ },
39
+ autonomy: {
40
+ type: 'string',
41
+ enum: ['dry-run', 'assisted', 'guarded', 'autonomous'],
42
+ description: 'Autonomy level: dry-run (report only), assisted (prompt for actions), guarded (safety checks), autonomous (full auto)',
43
+ default: 'assisted',
44
+ },
45
+ config: {
46
+ type: 'object',
47
+ description: 'Optional workflow configuration overrides',
48
+ properties: {
49
+ phases: {
50
+ type: 'object',
51
+ description: 'Phase-specific configuration',
52
+ },
53
+ forge: {
54
+ type: 'object',
55
+ description: 'Forge integration settings',
56
+ properties: {
57
+ enabled: { type: 'boolean' },
58
+ prefer_local: { type: 'boolean' },
59
+ },
60
+ },
61
+ },
62
+ },
63
+ },
64
+ },
65
+ handler: async (params) => {
66
+ const { work_id, autonomy, config } = params;
67
+ const workflow = new FaberWorkflow({ config: config });
68
+ try {
69
+ const result = await workflow.run({
70
+ workId: work_id,
71
+ autonomy: (autonomy || 'assisted'),
72
+ config: config,
73
+ });
74
+ return {
75
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
76
+ };
77
+ }
78
+ catch (error) {
79
+ return createToolError('workflow_run', error.message);
80
+ }
81
+ },
82
+ },
83
+ // Tool 2: fractary_faber_workflow_status
84
+ {
85
+ name: 'fractary_faber_workflow_status',
86
+ description: 'Get workflow status and progress by workflow ID or work item ID',
87
+ inputSchema: {
88
+ type: 'object',
89
+ properties: {
90
+ workflow_id: {
91
+ type: 'string',
92
+ description: 'Workflow ID to check (e.g., "WF-abc123")',
93
+ },
94
+ work_id: {
95
+ type: 'string',
96
+ description: 'Work item ID to find active workflow for',
97
+ },
98
+ },
99
+ },
100
+ handler: async (params) => {
101
+ const { workflow_id, work_id } = params;
102
+ let workflowId = workflow_id;
103
+ // If work_id provided, find active workflow
104
+ if (!workflowId && work_id) {
105
+ const stateManager = new StateManager();
106
+ const state = stateManager.getActiveWorkflow(work_id);
107
+ if (state) {
108
+ workflowId = state.workflow_id;
109
+ }
110
+ }
111
+ if (!workflowId) {
112
+ return createToolError('workflow_status', 'No workflow_id or work_id provided');
113
+ }
114
+ const workflow = new FaberWorkflow();
115
+ const status = workflow.getStatus(workflowId);
116
+ return {
117
+ content: [{ type: 'text', text: JSON.stringify(status, null, 2) }],
118
+ };
119
+ },
120
+ },
121
+ // Tool 3: fractary_faber_workflow_resume
122
+ {
123
+ name: 'fractary_faber_workflow_resume',
124
+ description: 'Resume a paused workflow from where it left off',
125
+ inputSchema: {
126
+ type: 'object',
127
+ required: ['workflow_id'],
128
+ properties: {
129
+ workflow_id: {
130
+ type: 'string',
131
+ description: 'Workflow ID to resume',
132
+ },
133
+ },
134
+ },
135
+ handler: async (params) => {
136
+ const { workflow_id } = params;
137
+ const workflow = new FaberWorkflow();
138
+ try {
139
+ const result = await workflow.resume(workflow_id);
140
+ return {
141
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
142
+ };
143
+ }
144
+ catch (error) {
145
+ return createToolError('workflow_resume', error.message);
146
+ }
147
+ },
148
+ },
149
+ // Tool 4: fractary_faber_workflow_pause
150
+ {
151
+ name: 'fractary_faber_workflow_pause',
152
+ description: 'Pause a running workflow (can be resumed later)',
153
+ inputSchema: {
154
+ type: 'object',
155
+ required: ['workflow_id'],
156
+ properties: {
157
+ workflow_id: {
158
+ type: 'string',
159
+ description: 'Workflow ID to pause',
160
+ },
161
+ },
162
+ },
163
+ handler: async (params) => {
164
+ const { workflow_id } = params;
165
+ const workflow = new FaberWorkflow();
166
+ try {
167
+ workflow.pause(workflow_id);
168
+ return {
169
+ content: [
170
+ {
171
+ type: 'text',
172
+ text: JSON.stringify({
173
+ status: 'success',
174
+ workflow_id,
175
+ message: 'Workflow paused',
176
+ }, null, 2),
177
+ },
178
+ ],
179
+ };
180
+ }
181
+ catch (error) {
182
+ return createToolError('workflow_pause', error.message);
183
+ }
184
+ },
185
+ },
186
+ // Tool 5: fractary_faber_workflow_recover (Option B: Direct StateManager)
187
+ {
188
+ name: 'fractary_faber_workflow_recover',
189
+ description: 'Recover a failed workflow from a checkpoint or specific phase',
190
+ inputSchema: {
191
+ type: 'object',
192
+ required: ['workflow_id'],
193
+ properties: {
194
+ workflow_id: {
195
+ type: 'string',
196
+ description: 'Workflow ID to recover',
197
+ },
198
+ checkpoint_id: {
199
+ type: 'string',
200
+ description: 'Optional checkpoint ID to recover from',
201
+ },
202
+ from_phase: {
203
+ type: 'string',
204
+ enum: ['frame', 'architect', 'build', 'evaluate', 'release'],
205
+ description: 'Optional phase to restart from',
206
+ },
207
+ skip_phases: {
208
+ type: 'array',
209
+ items: {
210
+ type: 'string',
211
+ enum: ['frame', 'architect', 'build', 'evaluate', 'release'],
212
+ },
213
+ description: 'Phases to skip during recovery',
214
+ },
215
+ },
216
+ },
217
+ handler: async (params) => {
218
+ const { workflow_id, checkpoint_id, from_phase, skip_phases } = params;
219
+ try {
220
+ // Option B: Use StateManager directly (fallback until SDK method added)
221
+ const stateManager = new StateManager();
222
+ const recoveredState = stateManager.recoverWorkflow(workflow_id, {
223
+ checkpointId: checkpoint_id,
224
+ fromPhase: from_phase,
225
+ skipPhases: skip_phases,
226
+ });
227
+ // Re-run workflow with recovered state
228
+ const workflow = new FaberWorkflow();
229
+ const result = await workflow.run({
230
+ workId: recoveredState.work_id,
231
+ autonomy: 'assisted',
232
+ });
233
+ return {
234
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
235
+ };
236
+ }
237
+ catch (error) {
238
+ return createToolError('workflow_recover', error.message);
239
+ }
240
+ },
241
+ },
242
+ // Tool 6: fractary_faber_workflow_cleanup (Option B: Direct StateManager)
243
+ {
244
+ name: 'fractary_faber_workflow_cleanup',
245
+ description: 'Clean up old completed/failed workflow state files',
246
+ inputSchema: {
247
+ type: 'object',
248
+ properties: {
249
+ max_age_days: {
250
+ type: 'number',
251
+ description: 'Delete workflows older than this many days',
252
+ default: 30,
253
+ minimum: 1,
254
+ },
255
+ },
256
+ },
257
+ handler: async (params) => {
258
+ const { max_age_days } = params;
259
+ try {
260
+ // Option B: Use StateManager directly (fallback until SDK method added)
261
+ const stateManager = new StateManager();
262
+ const result = stateManager.cleanup(max_age_days || 30);
263
+ return {
264
+ content: [
265
+ {
266
+ type: 'text',
267
+ text: JSON.stringify({
268
+ status: 'success',
269
+ ...result,
270
+ }, null, 2),
271
+ },
272
+ ],
273
+ };
274
+ }
275
+ catch (error) {
276
+ return createToolError('workflow_cleanup', error.message);
277
+ }
278
+ },
279
+ },
280
+ ];
281
+ }
282
+ //# sourceMappingURL=workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/tools/workflow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAA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BACnE,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,eAAe,CAAC,kBAAkB,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;gBACvE,CAAC;YACH,CAAC;SACF;QAED,0EAA0E;QAC1E;YACE,IAAI,EAAE,iCAAiC;YACvC,WAAW,EAAE,oDAAoD;YACjE,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,4CAA4C;wBACzD,OAAO,EAAE,EAAE;wBACX,OAAO,EAAE,CAAC;qBACX;iBACF;aACF;YACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;gBACxB,MAAM,EAAE,YAAY,EAAE,GAAG,MAExB,CAAC;gBAEF,IAAI,CAAC;oBACH,wEAAwE;oBACxE,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;oBACxC,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;oBAExD,OAAO;wBACL,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oCACE,MAAM,EAAE,SAAS;oCACjB,GAAG,MAAM;iCACV,EACD,IAAI,EACJ,CAAC,CACF;6BACF;yBACF;qBACF,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,eAAe,CAAC,kBAAkB,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;gBACvE,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Type definitions for FABER Event Gateway
3
+ */
4
+ export declare const EventTypes: readonly ["workflow_start", "workflow_complete", "workflow_error", "workflow_cancelled", "workflow_resumed", "workflow_rerun", "phase_start", "phase_skip", "phase_complete", "phase_error", "step_start", "step_complete", "step_error", "step_retry", "artifact_create", "artifact_modify", "commit_create", "branch_create", "pr_create", "pr_merge", "spec_generate", "spec_validate", "test_run", "docs_update", "checkpoint", "skill_invoke", "agent_invoke", "decision_point", "retry_loop_enter", "retry_loop_exit", "approval_request", "approval_granted", "approval_denied", "hook_execute"];
5
+ export type EventType = (typeof EventTypes)[number];
6
+ export declare const Phases: readonly ["frame", "architect", "build", "evaluate", "release"];
7
+ export type Phase = (typeof Phases)[number];
8
+ export declare const EventStatuses: readonly ["started", "completed", "failed", "skipped", "pending", "cancelled"];
9
+ export type EventStatus = (typeof EventStatuses)[number];
10
+ export declare const RunStatuses: readonly ["pending", "in_progress", "completed", "failed", "cancelled"];
11
+ export type RunStatus = (typeof RunStatuses)[number];
12
+ export interface Artifact {
13
+ type: "branch" | "commit" | "spec" | "pr" | "deployment" | "tag" | "document" | "file" | "other";
14
+ name: string;
15
+ path?: string;
16
+ url?: string;
17
+ sha?: string;
18
+ size_bytes?: number;
19
+ }
20
+ export interface EventError {
21
+ code: string;
22
+ message: string;
23
+ stack?: string;
24
+ recoverable?: boolean;
25
+ }
26
+ export interface FaberEvent {
27
+ event_id: number;
28
+ type: EventType;
29
+ timestamp: string;
30
+ run_id: string;
31
+ phase?: Phase;
32
+ step?: string;
33
+ status?: EventStatus;
34
+ user?: string;
35
+ source?: string;
36
+ message?: string;
37
+ duration_ms?: number;
38
+ metadata?: Record<string, unknown>;
39
+ artifacts?: Artifact[];
40
+ error?: EventError;
41
+ }
42
+ export interface PhaseState {
43
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
44
+ started_at?: string;
45
+ completed_at?: string;
46
+ steps: Array<{
47
+ name: string;
48
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
49
+ started_at?: string;
50
+ completed_at?: string;
51
+ duration_ms?: number;
52
+ }>;
53
+ retry_count?: number;
54
+ }
55
+ export interface RunState {
56
+ run_id: string;
57
+ work_id: string;
58
+ workflow_version: string;
59
+ status: RunStatus;
60
+ current_phase: Phase | null;
61
+ last_event_id: number;
62
+ started_at: string | null;
63
+ updated_at: string;
64
+ completed_at: string | null;
65
+ phases: {
66
+ frame: PhaseState;
67
+ architect: PhaseState;
68
+ build: PhaseState;
69
+ evaluate: PhaseState;
70
+ release: PhaseState;
71
+ };
72
+ artifacts: Record<string, string>;
73
+ errors: EventError[];
74
+ }
75
+ export interface RunRelationships {
76
+ parent_run_id: string | null;
77
+ rerun_of: string | null;
78
+ child_runs: string[];
79
+ }
80
+ export interface RunEnvironment {
81
+ hostname: string;
82
+ git_branch: string;
83
+ git_commit: string;
84
+ working_directory: string;
85
+ }
86
+ export interface RunMetadata {
87
+ run_id: string;
88
+ work_id: string;
89
+ target: string | null;
90
+ workflow_id: string;
91
+ autonomy: "dry-run" | "assist" | "guarded" | "autonomous";
92
+ source_type: "github" | "jira" | "linear" | "manual";
93
+ phases: Phase[];
94
+ created_at: string;
95
+ created_by: string;
96
+ relationships: RunRelationships;
97
+ environment: RunEnvironment;
98
+ }
99
+ export interface RunSummary {
100
+ run_id: string;
101
+ work_id: string;
102
+ status: RunStatus;
103
+ created_at: string;
104
+ updated_at: string;
105
+ completed_at: string | null;
106
+ current_phase: Phase | null;
107
+ event_count?: number;
108
+ }
109
+ export interface EmitEventResult {
110
+ status: "success" | "error";
111
+ operation: "emit-event";
112
+ event_id: number;
113
+ type: EventType;
114
+ run_id: string;
115
+ timestamp: string;
116
+ event_path: string;
117
+ error?: string;
118
+ }
119
+ export interface GetRunResult {
120
+ status: "success" | "error";
121
+ operation: "get-run";
122
+ run_id: string;
123
+ metadata: RunMetadata;
124
+ state: RunState;
125
+ event_count?: number;
126
+ error?: string;
127
+ }
128
+ export interface ListRunsResult {
129
+ status: "success" | "error";
130
+ operation: "list-runs";
131
+ runs: RunSummary[];
132
+ total: number;
133
+ error?: string;
134
+ }
135
+ export interface ConsolidateResult {
136
+ status: "success" | "error";
137
+ operation: "consolidate-events";
138
+ run_id: string;
139
+ events_consolidated: number;
140
+ output_path: string;
141
+ size_bytes: number;
142
+ error?: string;
143
+ }
144
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,UAAU,ykBAmCb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpD,eAAO,MAAM,MAAM,iEAMT,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5C,eAAO,MAAM,aAAa,gFAOhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,WAAW,yEAMd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;IACjG,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MA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ABER Event Gateway
3
+ */
4
+ export const EventTypes = [
5
+ "workflow_start",
6
+ "workflow_complete",
7
+ "workflow_error",
8
+ "workflow_cancelled",
9
+ "workflow_resumed",
10
+ "workflow_rerun",
11
+ "phase_start",
12
+ "phase_skip",
13
+ "phase_complete",
14
+ "phase_error",
15
+ "step_start",
16
+ "step_complete",
17
+ "step_error",
18
+ "step_retry",
19
+ "artifact_create",
20
+ "artifact_modify",
21
+ "commit_create",
22
+ "branch_create",
23
+ "pr_create",
24
+ "pr_merge",
25
+ "spec_generate",
26
+ "spec_validate",
27
+ "test_run",
28
+ "docs_update",
29
+ "checkpoint",
30
+ "skill_invoke",
31
+ "agent_invoke",
32
+ "decision_point",
33
+ "retry_loop_enter",
34
+ "retry_loop_exit",
35
+ "approval_request",
36
+ "approval_granted",
37
+ "approval_denied",
38
+ "hook_execute",
39
+ ];
40
+ export const Phases = [
41
+ "frame",
42
+ "architect",
43
+ "build",
44
+ "evaluate",
45
+ "release",
46
+ ];
47
+ export const EventStatuses = [
48
+ "started",
49
+ "completed",
50
+ "failed",
51
+ "skipped",
52
+ "pending",
53
+ "cancelled",
54
+ ];
55
+ export const RunStatuses = [
56
+ "pending",
57
+ "in_progress",
58
+ "completed",
59
+ "failed",
60
+ "cancelled",
61
+ ];
62
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,oBAAoB;IACpB,kBAAkB;IAClB,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;IACf,eAAe;IACf,WAAW;IACX,UAAU;IACV,eAAe;IACf,eAAe;IACf,UAAU;IACV,aAAa;IACb,YAAY;IACZ,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,cAAc;CACN,CAAC;AAIX,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO;IACP,WAAW;IACX,OAAO;IACP,UAAU;IACV,SAAS;CACD,CAAC;AAIX,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS;IACT,WAAW;IACX,QAAQ;IACR,SAAS;IACT,SAAS;IACT,WAAW;CACH,CAAC;AAIX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS;IACT,aAAa;IACb,WAAW;IACX,QAAQ;IACR,WAAW;CACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@fractary/faber-mcp",
3
+ "version": "1.1.0",
4
+ "description": "MCP Server for FABER workflow orchestration - run, status, events, and run management",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "fractary-faber-mcp": "./dist/server.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "dev": "tsx src/server.ts",
18
+ "build": "tsc",
19
+ "start": "node dist/server.js",
20
+ "watch": "tsc --watch",
21
+ "test": "vitest run",
22
+ "test:watch": "vitest",
23
+ "test:coverage": "vitest run --coverage",
24
+ "lint": "eslint src --ext .ts",
25
+ "typecheck": "tsc --noEmit",
26
+ "prepublishOnly": "npm run build",
27
+ "clean": "rm -rf dist"
28
+ },
29
+ "keywords": [
30
+ "faber",
31
+ "mcp",
32
+ "model-context-protocol",
33
+ "workflow",
34
+ "orchestration",
35
+ "events",
36
+ "ai",
37
+ "development"
38
+ ],
39
+ "author": "Fractary Team",
40
+ "license": "MIT",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "dependencies": {
45
+ "@fractary/faber": "*",
46
+ "@modelcontextprotocol/sdk": "^1.0.0",
47
+ "ajv": "^8.12.0",
48
+ "ajv-formats": "^2.1.1"
49
+ },
50
+ "devDependencies": {
51
+ "@types/node": "^20.10.0",
52
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
53
+ "@typescript-eslint/parser": "^6.19.0",
54
+ "eslint": "^8.56.0",
55
+ "tsx": "^4.7.0",
56
+ "typescript": "^5.3.0",
57
+ "vitest": "^1.0.0"
58
+ },
59
+ "engines": {
60
+ "node": ">=18.0.0"
61
+ },
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/fractary/faber.git",
65
+ "directory": "mcp/server"
66
+ },
67
+ "bugs": {
68
+ "url": "https://github.com/fractary/faber/issues"
69
+ },
70
+ "homepage": "https://github.com/fractary/faber/tree/main/mcp/server#readme"
71
+ }