@ai_design_agency/sdd-mcp 1.0.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/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # @ai_design_agency/sdd-mcp
2
+
3
+ MCP (Model Context Protocol) server for the SDD Platform. Exposes spec, process, and session management as Claude-callable tools.
4
+
5
+ ## Overview
6
+
7
+ This package is a **thin HTTP client** that translates MCP tool calls into Platform API requests. All business logic, validation, and authorization remain centralized in the Platform API.
8
+
9
+ ```
10
+ Claude Code → MCP Server → Platform API → Database
11
+ ```
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @ai_design_agency/sdd-mcp
17
+ ```
18
+
19
+ ## Configuration
20
+
21
+ The MCP server requires two environment variables:
22
+
23
+ ```bash
24
+ SDD_API_URL=https://your-platform-api.example.com
25
+ SDD_API_TOKEN=your-bearer-token
26
+ ```
27
+
28
+ ### Claude Code Configuration
29
+
30
+ Add to your Claude Code MCP settings (`~/.claude/claude_desktop_config.json`):
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "sdd": {
36
+ "command": "npx",
37
+ "args": ["@ai_design_agency/sdd-mcp"],
38
+ "env": {
39
+ "SDD_API_URL": "https://sdd-api.your-domain.com",
40
+ "SDD_API_TOKEN": "${SDD_API_TOKEN}"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## Available Tools
48
+
49
+ ### Spec Management
50
+
51
+ | Tool | Description |
52
+ |------|-------------|
53
+ | `spec_create` | Create a new SDD specification |
54
+ | `spec_get` | Get a spec by ID or spec_number |
55
+ | `spec_update` | Update spec content, section, or status |
56
+ | `spec_list` | List specs with optional filters |
57
+ | `spec_search` | Semantic search across specs |
58
+
59
+ ### Process Management
60
+
61
+ | Tool | Description |
62
+ |------|-------------|
63
+ | `process_list` | List available processes/workflows |
64
+ | `process_get` | Get process details by ID |
65
+
66
+ ### Session Management
67
+
68
+ | Tool | Description |
69
+ |------|-------------|
70
+ | `session_start` | Start a new work session for a spec |
71
+ | `session_update` | Update session notes |
72
+ | `session_end` | End a work session |
73
+
74
+ ## Tool Examples
75
+
76
+ ### Create a Spec
77
+
78
+ ```json
79
+ {
80
+ "tool": "spec_create",
81
+ "arguments": {
82
+ "type": "FEA",
83
+ "title": "User Authentication",
84
+ "content": "# Feature: User Authentication\n\n## Summary\n..."
85
+ }
86
+ }
87
+ ```
88
+
89
+ ### Search Specs
90
+
91
+ ```json
92
+ {
93
+ "tool": "spec_search",
94
+ "arguments": {
95
+ "query": "authentication login",
96
+ "type": "FEA",
97
+ "limit": 5
98
+ }
99
+ }
100
+ ```
101
+
102
+ ### Start a Session
103
+
104
+ ```json
105
+ {
106
+ "tool": "session_start",
107
+ "arguments": {
108
+ "spec_id": "uuid-or-spec-number",
109
+ "notes": "Starting implementation of auth feature"
110
+ }
111
+ }
112
+ ```
113
+
114
+ ## Development
115
+
116
+ ```bash
117
+ # Install dependencies
118
+ npm install
119
+
120
+ # Run in development mode
121
+ npm run dev
122
+
123
+ # Build
124
+ npm run build
125
+
126
+ # Run tests
127
+ npm test
128
+
129
+ # Type check
130
+ npm run type-check
131
+ ```
132
+
133
+ ## Architecture
134
+
135
+ This MCP server follows the **thin client pattern** established in INV-202512024:
136
+
137
+ - **No Business Logic**: All validation, authorization, and workflow logic stays in Platform API
138
+ - **Type Safety**: Uses `@ai_design_agency/sdd-core` for shared types
139
+ - **Bearer Token Auth**: Token passed to Platform API in Authorization header
140
+ - **Structured Errors**: API errors translated to MCP-friendly format
141
+
142
+ ## Related Packages
143
+
144
+ - [`@ai_design_agency/sdd-core`](../sdd-core) - Shared TypeScript types
145
+
146
+ ## Spec Reference
147
+
148
+ - **Spec ID**: FEA-202601002
149
+ - **Parent Epic**: EPC-202512003 (SDD Future State Design)
150
+
151
+ ---
152
+
153
+ Built by AIDA
@@ -0,0 +1,55 @@
1
+ import type { PaginatedResponse, Spec, SpecWithScore, Process, Session, CreateSpecRequest, UpdateSpecRequest, ListSpecsQuery, SearchSpecsRequest, CreateSessionRequest, UpdateSessionRequest } from "./types.js";
2
+ /**
3
+ * HTTP client for the SDD Platform API
4
+ * This is a thin wrapper - all business logic stays in the Platform API
5
+ */
6
+ export declare class PlatformClient {
7
+ private readonly baseUrl;
8
+ private readonly token;
9
+ constructor(baseUrl: string, token: string);
10
+ /**
11
+ * Make an authenticated request to the Platform API
12
+ */
13
+ private request;
14
+ /**
15
+ * Create a new spec
16
+ */
17
+ createSpec(req: CreateSpecRequest): Promise<Spec>;
18
+ /**
19
+ * Get a spec by ID or spec_number
20
+ */
21
+ getSpec(id: string): Promise<Spec>;
22
+ /**
23
+ * Update a spec
24
+ */
25
+ updateSpec(id: string, req: UpdateSpecRequest): Promise<Spec>;
26
+ /**
27
+ * List specs with optional filters
28
+ */
29
+ listSpecs(query?: ListSpecsQuery): Promise<PaginatedResponse<Spec>>;
30
+ /**
31
+ * Semantic search for specs
32
+ */
33
+ searchSpecs(req: SearchSpecsRequest): Promise<SpecWithScore[]>;
34
+ /**
35
+ * List processes
36
+ */
37
+ listProcesses(status?: string): Promise<PaginatedResponse<Process>>;
38
+ /**
39
+ * Get a process by ID
40
+ */
41
+ getProcess(id: string): Promise<Process>;
42
+ /**
43
+ * Start a new session
44
+ */
45
+ startSession(req: CreateSessionRequest): Promise<Session>;
46
+ /**
47
+ * Update a session
48
+ */
49
+ updateSession(id: string, req: UpdateSessionRequest): Promise<Session>;
50
+ /**
51
+ * End a session
52
+ */
53
+ endSession(id: string, notes?: string): Promise<Session>;
54
+ }
55
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,iBAAiB,EACjB,IAAI,EACJ,aAAa,EACb,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,oB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 // HTTP client for Platform API
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.PlatformClient = void 0;
6
+ const errors_js_1 = require("./errors.js");
7
+ /**
8
+ * HTTP client for the SDD Platform API
9
+ * This is a thin wrapper - all business logic stays in the Platform API
10
+ */
11
+ class PlatformClient {
12
+ baseUrl;
13
+ token;
14
+ constructor(baseUrl, token) {
15
+ this.baseUrl = baseUrl;
16
+ this.token = token;
17
+ }
18
+ /**
19
+ * Make an authenticated request to the Platform API
20
+ */
21
+ async request(method, path, body) {
22
+ const url = `${this.baseUrl}${path}`;
23
+ const headers = {
24
+ Authorization: `Bearer ${this.token}`,
25
+ "Content-Type": "application/json",
26
+ };
27
+ const response = await fetch(url, {
28
+ method,
29
+ headers,
30
+ body: body ? JSON.stringify(body) : undefined,
31
+ });
32
+ if (!response.ok) {
33
+ throw await (0, errors_js_1.createErrorFromResponse)(response);
34
+ }
35
+ return response.json();
36
+ }
37
+ // ============================================================================
38
+ // Spec Operations
39
+ // ============================================================================
40
+ /**
41
+ * Create a new spec
42
+ */
43
+ async createSpec(req) {
44
+ const { data } = await this.request("POST", "/api/v1/specs", req);
45
+ return data;
46
+ }
47
+ /**
48
+ * Get a spec by ID or spec_number
49
+ */
50
+ async getSpec(id) {
51
+ const { data } = await this.request("GET", `/api/v1/specs/${encodeURIComponent(id)}`);
52
+ return data;
53
+ }
54
+ /**
55
+ * Update a spec
56
+ */
57
+ async updateSpec(id, req) {
58
+ const { data } = await this.request("PATCH", `/api/v1/specs/${encodeURIComponent(id)}`, req);
59
+ return data;
60
+ }
61
+ /**
62
+ * List specs with optional filters
63
+ */
64
+ async listSpecs(query) {
65
+ const params = new URLSearchParams();
66
+ if (query?.type)
67
+ params.set("type", query.type);
68
+ if (query?.status)
69
+ params.set("status", query.status);
70
+ if (query?.parent_epic_id)
71
+ params.set("parent_epic_id", query.parent_epic_id);
72
+ if (query?.limit)
73
+ params.set("limit", String(query.limit));
74
+ if (query?.offset)
75
+ params.set("offset", String(query.offset));
76
+ const queryString = params.toString();
77
+ const path = queryString ? `/api/v1/specs?${queryString}` : "/api/v1/specs";
78
+ return this.request("GET", path);
79
+ }
80
+ /**
81
+ * Semantic search for specs
82
+ */
83
+ async searchSpecs(req) {
84
+ const { data } = await this.request("POST", "/api/v1/specs/search", req);
85
+ return data;
86
+ }
87
+ // ============================================================================
88
+ // Process Operations
89
+ // ============================================================================
90
+ /**
91
+ * List processes
92
+ */
93
+ async listProcesses(status) {
94
+ const path = status
95
+ ? `/api/v1/processes?status=${encodeURIComponent(status)}`
96
+ : "/api/v1/processes";
97
+ return this.request("GET", path);
98
+ }
99
+ /**
100
+ * Get a process by ID
101
+ */
102
+ async getProcess(id) {
103
+ const { data } = await this.request("GET", `/api/v1/processes/${encodeURIComponent(id)}`);
104
+ return data;
105
+ }
106
+ // ============================================================================
107
+ // Session Operations
108
+ // ============================================================================
109
+ /**
110
+ * Start a new session
111
+ */
112
+ async startSession(req) {
113
+ const { data } = await this.request("POST", "/api/v1/sessions", req);
114
+ return data;
115
+ }
116
+ /**
117
+ * Update a session
118
+ */
119
+ async updateSession(id, req) {
120
+ const { data } = await this.request("PATCH", `/api/v1/sessions/${encodeURIComponent(id)}`, req);
121
+ return data;
122
+ }
123
+ /**
124
+ * End a session
125
+ */
126
+ async endSession(id, notes) {
127
+ const { data } = await this.request("POST", `/api/v1/sessions/${encodeURIComponent(id)}/end`, notes ? { notes } : undefined);
128
+ return data;
129
+ }
130
+ }
131
+ exports.PlatformClient = PlatformClient;
132
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,sBAAsB;AACtB,+BAA+B;;;AAE/B,2CAAsD;AAgBtD;;;GAGG;AACH,MAAa,cAAc;IAEN;IACA;IAFnB,YACmB,OAAe,EACf,KAAa;QADb,YAAO,GAAP,OAAO,CAAQ;QACf,UAAK,GAAL,KAAK,CAAQ;IAC7B,CAAC;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,0 +1,21 @@
1
+ import type { ErrorCode } from "./types.js";
2
+ /**
3
+ * MCP-friendly error that wraps Platform API errors
4
+ */
5
+ export declare class McpError extends Error {
6
+ readonly code: ErrorCode;
7
+ readonly details?: Record<string, unknown> | undefined;
8
+ constructor(code: ErrorCode, message: string, details?: Record<string, unknown> | undefined);
9
+ /**
10
+ * Format error for MCP response
11
+ */
12
+ toMcpError(): {
13
+ code: string;
14
+ message: string;
15
+ };
16
+ }
17
+ /**
18
+ * Create error from HTTP response
19
+ */
20
+ export declare function createErrorFromResponse(response: Response): Promise<McpError>;
21
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;aAEf,IAAI,EAAE,SAAS;aAEf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAFjC,IAAI,EAAE,SAAS,EAC/B,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;IAMnD;;OAEG;IACH,UAAU,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAMhD;AAQD;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,QAAQ,CAAC,CAcnB"}
package/dist/errors.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // @spec FEA-202601002
3
+ // MCP error handling
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.McpError = void 0;
6
+ exports.createErrorFromResponse = createErrorFromResponse;
7
+ /**
8
+ * MCP-friendly error that wraps Platform API errors
9
+ */
10
+ class McpError extends Error {
11
+ code;
12
+ details;
13
+ constructor(code, message, details) {
14
+ super(message);
15
+ this.code = code;
16
+ this.details = details;
17
+ this.name = "McpError";
18
+ }
19
+ /**
20
+ * Format error for MCP response
21
+ */
22
+ toMcpError() {
23
+ return {
24
+ code: this.code,
25
+ message: this.message,
26
+ };
27
+ }
28
+ }
29
+ exports.McpError = McpError;
30
+ /**
31
+ * Create error from HTTP response
32
+ */
33
+ async function createErrorFromResponse(response) {
34
+ try {
35
+ const body = (await response.json());
36
+ return new McpError(body.code || "INTERNAL_ERROR", body.error || response.statusText, body.details);
37
+ }
38
+ catch {
39
+ return new McpError("INTERNAL_ERROR", `HTTP ${response.status}: ${response.statusText}`);
40
+ }
41
+ }
42
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA,sBAAsB;AACtB,qBAAqB;;;AAqCrB,0DAgBC;AAjDD;;GAEG;AACH,MAAa,QAAS,SAAQ,KAAK;IAEf;IAEA;IAHlB,YACkB,IAAe,EAC/B,OAAe,EACC,OAAiC;QAEjD,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,SAAI,GAAJ,IAAI,CAAW;QAEf,YAAO,GAAP,OAAO,CAA0B;QAGjD,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AAnBD,4BAmBC;AAQD;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAC3C,QAAkB;IAElB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAC;QACzD,OAAO,IAAI,QAAQ,CACjB,IAAI,CAAC,IAAI,IAAI,gBAAgB,EAC7B,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,UAAU,EACjC,IAAI,CAAC,OAAO,CACb,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,QAAQ,CACjB,gBAAgB,EAChB,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAClD,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ export { SddMcpServer } from "./server.js";
3
+ export type { SddMcpServerConfig } from "./server.js";
4
+ export { PlatformClient } from "./client.js";
5
+ export { McpError } from "./errors.js";
6
+ export * from "./types.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAgCA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,cAAc,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ // @spec FEA-202601002
4
+ // SDD MCP Server entry point
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.McpError = exports.PlatformClient = exports.SddMcpServer = void 0;
21
+ const server_js_1 = require("./server.js");
22
+ // Configuration from environment variables
23
+ const API_URL = process.env.SDD_API_URL;
24
+ const TOKEN = process.env.SDD_API_TOKEN;
25
+ if (!API_URL) {
26
+ console.error("Error: SDD_API_URL environment variable is required");
27
+ process.exit(1);
28
+ }
29
+ if (!TOKEN) {
30
+ console.error("Error: SDD_API_TOKEN environment variable is required");
31
+ process.exit(1);
32
+ }
33
+ // Create and start the server
34
+ const server = new server_js_1.SddMcpServer({
35
+ apiUrl: API_URL,
36
+ token: TOKEN,
37
+ });
38
+ server.start().catch((error) => {
39
+ console.error("Failed to start SDD MCP Server:", error);
40
+ process.exit(1);
41
+ });
42
+ // Re-export for programmatic use
43
+ var server_js_2 = require("./server.js");
44
+ Object.defineProperty(exports, "SddMcpServer", { enumerable: true, get: function () { return server_js_2.SddMcpServer; } });
45
+ var client_js_1 = require("./client.js");
46
+ Object.defineProperty(exports, "PlatformClient", { enumerable: true, get: function () { return client_js_1.PlatformClient; } });
47
+ var errors_js_1 = require("./errors.js");
48
+ Object.defineProperty(exports, "McpError", { enumerable: true, get: function () { return errors_js_1.McpError; } });
49
+ __exportStar(require("./types.js"), exports);
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,sBAAsB;AACtB,6BAA6B;;;;;;;;;;;;;;;;;AAE7B,2CAA2C;AAE3C,2CAA2C;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AACxC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAExC,IAAI,CAAC,OAAO,EAAE,CAAC;IACb,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,CAAC,KAAK,EAAE,CAAC;IACX,OAAO,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAC;IACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,8BAA8B;AAC9B,MAAM,MAAM,GAAG,IAAI,wBAAY,CAAC;IAC9B,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,KAAK;CACb,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC7B,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,iCAAiC;AACjC,yCAA2C;AAAlC,yGAAA,YAAY,OAAA;AAErB,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AACvB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,6CAA2B"}
@@ -0,0 +1,21 @@
1
+ export interface SddMcpServerConfig {
2
+ /** Platform API base URL */
3
+ apiUrl: string;
4
+ /** Bearer token for API authentication */
5
+ token: string;
6
+ }
7
+ /**
8
+ * SDD MCP Server - exposes Platform API operations as Claude tools
9
+ */
10
+ export declare class SddMcpServer {
11
+ private server;
12
+ private client;
13
+ constructor(config: SddMcpServerConfig);
14
+ private setupHandlers;
15
+ private handleToolCall;
16
+ /**
17
+ * Start the server with stdio transport
18
+ */
19
+ start(): Promise<void>;
20
+ }
21
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAiB;gBAEnB,MAAM,EAAE,kBAAkB;IAkBtC,OAAO,CAAC,aAAa;YAyCP,cAAc;IAoC5B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B"}
package/dist/server.js ADDED
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ // @spec FEA-202601002
3
+ // MCP Server implementation
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.SddMcpServer = void 0;
6
+ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
7
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
8
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
9
+ const client_js_1 = require("./client.js");
10
+ const errors_js_1 = require("./errors.js");
11
+ const index_js_2 = require("./tools/index.js");
12
+ /**
13
+ * SDD MCP Server - exposes Platform API operations as Claude tools
14
+ */
15
+ class SddMcpServer {
16
+ server;
17
+ client;
18
+ constructor(config) {
19
+ this.client = new client_js_1.PlatformClient(config.apiUrl, config.token);
20
+ this.server = new index_js_1.Server({
21
+ name: "sdd-mcp",
22
+ version: "1.0.0",
23
+ }, {
24
+ capabilities: {
25
+ tools: {},
26
+ },
27
+ });
28
+ this.setupHandlers();
29
+ }
30
+ setupHandlers() {
31
+ // List available tools
32
+ this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
33
+ tools: index_js_2.toolDefinitions,
34
+ }));
35
+ // Handle tool calls
36
+ this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
37
+ const { name, arguments: args } = request.params;
38
+ try {
39
+ const result = await this.handleToolCall(name, args || {});
40
+ return {
41
+ content: [
42
+ {
43
+ type: "text",
44
+ text: JSON.stringify(result, null, 2),
45
+ },
46
+ ],
47
+ };
48
+ }
49
+ catch (error) {
50
+ const message = error instanceof errors_js_1.McpError
51
+ ? error.message
52
+ : error instanceof Error
53
+ ? error.message
54
+ : "Unknown error";
55
+ return {
56
+ content: [
57
+ {
58
+ type: "text",
59
+ text: JSON.stringify({ success: false, error: message }),
60
+ },
61
+ ],
62
+ isError: true,
63
+ };
64
+ }
65
+ });
66
+ }
67
+ async handleToolCall(name, args) {
68
+ switch (name) {
69
+ // Spec tools
70
+ case "spec_create":
71
+ return (0, index_js_2.handleSpecCreate)(this.client, args);
72
+ case "spec_get":
73
+ return (0, index_js_2.handleSpecGet)(this.client, args);
74
+ case "spec_update":
75
+ return (0, index_js_2.handleSpecUpdate)(this.client, args);
76
+ case "spec_list":
77
+ return (0, index_js_2.handleSpecList)(this.client, args);
78
+ case "spec_search":
79
+ return (0, index_js_2.handleSpecSearch)(this.client, args);
80
+ // Process tools
81
+ case "process_list":
82
+ return (0, index_js_2.handleProcessList)(this.client, args);
83
+ case "process_get":
84
+ return (0, index_js_2.handleProcessGet)(this.client, args);
85
+ // Session tools
86
+ case "session_start":
87
+ return (0, index_js_2.handleSessionStart)(this.client, args);
88
+ case "session_update":
89
+ return (0, index_js_2.handleSessionUpdate)(this.client, args);
90
+ case "session_end":
91
+ return (0, index_js_2.handleSessionEnd)(this.client, args);
92
+ default:
93
+ throw new errors_js_1.McpError("VALIDATION_ERROR", `Unknown tool: ${name}`);
94
+ }
95
+ }
96
+ /**
97
+ * Start the server with stdio transport
98
+ */
99
+ async start() {
100
+ const transport = new stdio_js_1.StdioServerTransport();
101
+ await this.server.connect(transport);
102
+ console.error("SDD MCP Server started");
103
+ }
104
+ }
105
+ exports.SddMcpServer = SddMcpServer;
106
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA,sBAAsB;AACtB,4BAA4B;;;AAE5B,wEAAmE;AACnE,wEAAiF;AACjF,iEAG4C;AAE5C,2CAA6C;AAC7C,2CAAuC;AACvC,+CAY0B;AAS1B;;GAEG;AACH,MAAa,YAAY;IACf,M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