@cerema/cadriciel-mcp 0.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.
Files changed (53) hide show
  1. package/Dockerfile +26 -0
  2. package/README.md +98 -0
  3. package/dist/client.d.ts +31 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +77 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/http-server.d.ts +13 -0
  8. package/dist/http-server.d.ts.map +1 -0
  9. package/dist/http-server.js +184 -0
  10. package/dist/http-server.js.map +1 -0
  11. package/dist/index.d.ts +17 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +64 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/tools/database.d.ts +70 -0
  16. package/dist/tools/database.d.ts.map +1 -0
  17. package/dist/tools/database.js +77 -0
  18. package/dist/tools/database.js.map +1 -0
  19. package/dist/tools/deploy.d.ts +73 -0
  20. package/dist/tools/deploy.d.ts.map +1 -0
  21. package/dist/tools/deploy.js +103 -0
  22. package/dist/tools/deploy.js.map +1 -0
  23. package/dist/tools/handlers.d.ts +13 -0
  24. package/dist/tools/handlers.d.ts.map +1 -0
  25. package/dist/tools/handlers.js +225 -0
  26. package/dist/tools/handlers.js.map +1 -0
  27. package/dist/tools/index.d.ts +11 -0
  28. package/dist/tools/index.d.ts.map +1 -0
  29. package/dist/tools/index.js +298 -0
  30. package/dist/tools/index.js.map +1 -0
  31. package/dist/tools/projects.d.ts +45 -0
  32. package/dist/tools/projects.d.ts.map +1 -0
  33. package/dist/tools/projects.js +71 -0
  34. package/dist/tools/projects.js.map +1 -0
  35. package/dist/tools/workflows.d.ts +66 -0
  36. package/dist/tools/workflows.d.ts.map +1 -0
  37. package/dist/tools/workflows.js +90 -0
  38. package/dist/tools/workflows.js.map +1 -0
  39. package/k8s/deployment.yaml +48 -0
  40. package/k8s/ingress.yaml +27 -0
  41. package/k8s/kustomization.yaml +14 -0
  42. package/k8s/service.yaml +15 -0
  43. package/package.json +36 -0
  44. package/src/client.ts +97 -0
  45. package/src/http-server.ts +213 -0
  46. package/src/index.ts +75 -0
  47. package/src/tools/database.ts +105 -0
  48. package/src/tools/deploy.ts +127 -0
  49. package/src/tools/handlers.ts +241 -0
  50. package/src/tools/index.ts +275 -0
  51. package/src/tools/projects.ts +89 -0
  52. package/src/tools/workflows.ts +117 -0
  53. package/tsconfig.json +19 -0
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ /**
3
+ * Database Tools
4
+ *
5
+ * Tools for interacting with project databases.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.getSchema = getSchema;
9
+ exports.queryDatabase = queryDatabase;
10
+ exports.getTableData = getTableData;
11
+ exports.getERD = getERD;
12
+ exports.listFunctions = listFunctions;
13
+ // ============================================================
14
+ // TODO: Implement these tools
15
+ // ============================================================
16
+ /**
17
+ * TODO: Get database schema (tables, columns, relationships)
18
+ *
19
+ * @param workspaceId - The workspace/project ID
20
+ * @returns Database schema information
21
+ */
22
+ async function getSchema(workspaceId) {
23
+ // TODO: Implement
24
+ // Endpoint: GET /api/studio/workspace/:workspaceId/db/tables
25
+ throw new Error('Not implemented yet');
26
+ }
27
+ /**
28
+ * TODO: Execute a SQL query (SELECT only for safety)
29
+ *
30
+ * @param workspaceId - The workspace/project ID
31
+ * @param query - SQL SELECT query
32
+ * @param params - Query parameters
33
+ * @returns Query results
34
+ */
35
+ async function queryDatabase(workspaceId, query, params) {
36
+ // TODO: Implement
37
+ // Endpoint: POST /api/studio/workspace/:workspaceId/db/sql
38
+ // Body: { sql: query, params }
39
+ // IMPORTANT: Validate query is SELECT only (no INSERT/UPDATE/DELETE)
40
+ throw new Error('Not implemented yet');
41
+ }
42
+ /**
43
+ * TODO: Get table data with pagination
44
+ *
45
+ * @param workspaceId - The workspace/project ID
46
+ * @param tableName - Table name
47
+ * @param options - Pagination and filter options
48
+ * @returns Table rows
49
+ */
50
+ async function getTableData(workspaceId, tableName, options) {
51
+ // TODO: Implement
52
+ // Endpoint: GET /api/studio/workspace/:workspaceId/db/data?table=:tableName
53
+ throw new Error('Not implemented yet');
54
+ }
55
+ /**
56
+ * TODO: Get ERD (Entity Relationship Diagram) data
57
+ *
58
+ * @param workspaceId - The workspace/project ID
59
+ * @returns ERD data including tables and relationships
60
+ */
61
+ async function getERD(workspaceId) {
62
+ // TODO: Implement
63
+ // Endpoint: GET /api/studio/workspace/:workspaceId/db/erd
64
+ throw new Error('Not implemented yet');
65
+ }
66
+ /**
67
+ * TODO: List database functions
68
+ *
69
+ * @param workspaceId - The workspace/project ID
70
+ * @returns List of stored procedures and functions
71
+ */
72
+ async function listFunctions(workspaceId) {
73
+ // TODO: Implement
74
+ // Endpoint: GET /api/studio/workspace/:workspaceId/db/functions
75
+ throw new Error('Not implemented yet');
76
+ }
77
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/tools/database.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAYH,8BAiBC;AAUD,sCAcC;AAUD,oCAaC;AAQD,wBAIC;AAQD,sCAIC;AAlGD,+DAA+D;AAC/D,8BAA8B;AAC9B,+DAA+D;AAE/D;;;;;GAKG;AACI,KAAK,UAAU,SAAS,CAAC,WAAmB;IAcjD,kBAAkB;IAClB,6DAA6D;IAC7D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,aAAa,CACjC,WAAmB,EACnB,KAAa,EACb,MAAc;IAMd,kBAAkB;IAClB,2DAA2D;IAC3D,+BAA+B;IAC/B,qEAAqE;IACrE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,YAAY,CAChC,WAAmB,EACnB,SAAiB,EACjB,OAKC;IAED,kBAAkB;IAClB,4EAA4E;IAC5E,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,MAAM,CAAC,WAAmB;IAC9C,kBAAkB;IAClB,0DAA0D;IAC1D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CAAC,WAAmB;IACrD,kBAAkB;IAClB,gEAAgE;IAChE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Deployment Tools
3
+ *
4
+ * Tools for managing deployments, builds, and environment variables.
5
+ */
6
+ /**
7
+ * TODO: Get deployment status and info
8
+ *
9
+ * @param workspaceId - The workspace/project ID
10
+ * @returns Current deployment status
11
+ */
12
+ export declare function getDeploymentStatus(workspaceId: number): Promise<{
13
+ status: string;
14
+ version?: string;
15
+ url?: string;
16
+ lastDeployedAt?: string;
17
+ }>;
18
+ /**
19
+ * TODO: List available builds
20
+ *
21
+ * @param workspaceId - The workspace/project ID
22
+ * @returns List of builds with their tags and status
23
+ */
24
+ export declare function listBuilds(workspaceId: number): Promise<any>;
25
+ /**
26
+ * TODO: Deploy a specific version
27
+ *
28
+ * @param workspaceId - The workspace/project ID
29
+ * @param version - Version tag to deploy
30
+ * @returns Deployment status
31
+ */
32
+ export declare function deployVersion(workspaceId: number, version: string): Promise<any>;
33
+ /**
34
+ * TODO: Get environment variables
35
+ *
36
+ * @param workspaceId - The workspace/project ID
37
+ * @returns Environment variables (values hidden)
38
+ */
39
+ export declare function getEnvVars(workspaceId: number): Promise<{
40
+ variables: Array<{
41
+ key: string;
42
+ hasValue: boolean;
43
+ isSystem: boolean;
44
+ }>;
45
+ }>;
46
+ /**
47
+ * TODO: Set an environment variable
48
+ *
49
+ * @param workspaceId - The workspace/project ID
50
+ * @param key - Variable name
51
+ * @param value - Variable value
52
+ */
53
+ export declare function setEnvVar(workspaceId: number, key: string, value: string): Promise<void>;
54
+ /**
55
+ * TODO: Control services (start/stop/restart)
56
+ *
57
+ * @param workspaceId - The workspace/project ID
58
+ * @param action - Action to perform
59
+ * @param service - Optional specific service
60
+ */
61
+ export declare function serviceControl(workspaceId: number, action: 'start' | 'stop' | 'restart', service?: string): Promise<void>;
62
+ /**
63
+ * TODO: Get service logs
64
+ *
65
+ * @param workspaceId - The workspace/project ID
66
+ * @param service - Service name
67
+ * @param lines - Number of log lines
68
+ * @returns Log output
69
+ */
70
+ export declare function getLogs(workspaceId: number, service: string, lines?: number): Promise<{
71
+ logs: string;
72
+ }>;
73
+ //# sourceMappingURL=deploy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/tools/deploy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC,CAID;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAIlE;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,GAAG,CAAC,CAKd;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7D,SAAS,EAAE,KAAK,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;CACJ,CAAC,CAID;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,EACpC,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAC3B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAI3B"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ /**
3
+ * Deployment Tools
4
+ *
5
+ * Tools for managing deployments, builds, and environment variables.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.getDeploymentStatus = getDeploymentStatus;
9
+ exports.listBuilds = listBuilds;
10
+ exports.deployVersion = deployVersion;
11
+ exports.getEnvVars = getEnvVars;
12
+ exports.setEnvVar = setEnvVar;
13
+ exports.serviceControl = serviceControl;
14
+ exports.getLogs = getLogs;
15
+ // ============================================================
16
+ // TODO: Implement these tools
17
+ // ============================================================
18
+ /**
19
+ * TODO: Get deployment status and info
20
+ *
21
+ * @param workspaceId - The workspace/project ID
22
+ * @returns Current deployment status
23
+ */
24
+ async function getDeploymentStatus(workspaceId) {
25
+ // TODO: Implement
26
+ // Endpoint: GET /api/studio/workspace/:workspaceId/deploy
27
+ throw new Error('Not implemented yet');
28
+ }
29
+ /**
30
+ * TODO: List available builds
31
+ *
32
+ * @param workspaceId - The workspace/project ID
33
+ * @returns List of builds with their tags and status
34
+ */
35
+ async function listBuilds(workspaceId) {
36
+ // TODO: Implement
37
+ // Endpoint: GET /api/studio/workspace/:workspaceId/deploy/builds
38
+ throw new Error('Not implemented yet');
39
+ }
40
+ /**
41
+ * TODO: Deploy a specific version
42
+ *
43
+ * @param workspaceId - The workspace/project ID
44
+ * @param version - Version tag to deploy
45
+ * @returns Deployment status
46
+ */
47
+ async function deployVersion(workspaceId, version) {
48
+ // TODO: Implement
49
+ // Endpoint: POST /api/studio/workspace/:workspaceId/deploy/deploy
50
+ // Body: { version }
51
+ throw new Error('Not implemented yet');
52
+ }
53
+ /**
54
+ * TODO: Get environment variables
55
+ *
56
+ * @param workspaceId - The workspace/project ID
57
+ * @returns Environment variables (values hidden)
58
+ */
59
+ async function getEnvVars(workspaceId) {
60
+ // TODO: Implement
61
+ // Endpoint: GET /api/studio/workspace/:workspaceId/deploy/env-var-values
62
+ throw new Error('Not implemented yet');
63
+ }
64
+ /**
65
+ * TODO: Set an environment variable
66
+ *
67
+ * @param workspaceId - The workspace/project ID
68
+ * @param key - Variable name
69
+ * @param value - Variable value
70
+ */
71
+ async function setEnvVar(workspaceId, key, value) {
72
+ // TODO: Implement
73
+ // Endpoint: POST /api/studio/workspace/:workspaceId/deploy/save-env-var
74
+ // Body: { key, value }
75
+ throw new Error('Not implemented yet');
76
+ }
77
+ /**
78
+ * TODO: Control services (start/stop/restart)
79
+ *
80
+ * @param workspaceId - The workspace/project ID
81
+ * @param action - Action to perform
82
+ * @param service - Optional specific service
83
+ */
84
+ async function serviceControl(workspaceId, action, service) {
85
+ // TODO: Implement
86
+ // Endpoint: POST /api/studio/workspace/:workspaceId/deploy/service-control
87
+ // Body: { action, service }
88
+ throw new Error('Not implemented yet');
89
+ }
90
+ /**
91
+ * TODO: Get service logs
92
+ *
93
+ * @param workspaceId - The workspace/project ID
94
+ * @param service - Service name
95
+ * @param lines - Number of log lines
96
+ * @returns Log output
97
+ */
98
+ async function getLogs(workspaceId, service, lines) {
99
+ // TODO: Implement
100
+ // Endpoint: GET /api/studio/workspace/:workspaceId/logs/:service
101
+ throw new Error('Not implemented yet');
102
+ }
103
+ //# sourceMappingURL=deploy.js.map
@@ -0,0 +1 @@
1
+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OAAO,CAC3B,WAAmB,EACnB,OAAe,EACf,KAAc;IAEd,kBAAkB;IAClB,iEAAiE;IACjE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Tool Handlers Factory
3
+ *
4
+ * Creates tool handlers bound to a specific Cadriciel client.
5
+ * Used by the HTTP server where each session has its own client.
6
+ */
7
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
8
+ import { CadricielClient } from '../client';
9
+ /**
10
+ * Register tool handlers with an MCP server
11
+ */
12
+ export declare function createToolHandlers(server: Server, client: CadricielClient): void;
13
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/tools/handlers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAKnE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAyL5C;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAwChF"}
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+ /**
3
+ * Tool Handlers Factory
4
+ *
5
+ * Creates tool handlers bound to a specific Cadriciel client.
6
+ * Used by the HTTP server where each session has its own client.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.createToolHandlers = createToolHandlers;
10
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
11
+ /**
12
+ * Tool definitions (schema only, handlers are created dynamically)
13
+ */
14
+ const TOOL_DEFINITIONS = [
15
+ {
16
+ name: 'list_projects',
17
+ description: 'List all Cadriciel projects accessible by the authenticated user',
18
+ inputSchema: {
19
+ type: 'object',
20
+ properties: {},
21
+ required: [],
22
+ },
23
+ },
24
+ {
25
+ name: 'get_project',
26
+ description: 'Get detailed information about a specific project',
27
+ inputSchema: {
28
+ type: 'object',
29
+ properties: {
30
+ projectId: {
31
+ type: 'number',
32
+ description: 'The project ID',
33
+ },
34
+ },
35
+ required: ['projectId'],
36
+ },
37
+ },
38
+ {
39
+ name: 'list_workflows',
40
+ description: 'List all workflows in a workspace',
41
+ inputSchema: {
42
+ type: 'object',
43
+ properties: {
44
+ workspaceId: {
45
+ type: 'number',
46
+ description: 'The workspace/project ID',
47
+ },
48
+ },
49
+ required: ['workspaceId'],
50
+ },
51
+ },
52
+ {
53
+ name: 'execute_workflow',
54
+ description: 'Execute a workflow with optional input parameters',
55
+ inputSchema: {
56
+ type: 'object',
57
+ properties: {
58
+ workspaceId: {
59
+ type: 'number',
60
+ description: 'The workspace/project ID',
61
+ },
62
+ workflowId: {
63
+ type: 'string',
64
+ description: 'The workflow ID to execute',
65
+ },
66
+ input: {
67
+ type: 'object',
68
+ description: 'Input parameters for the workflow',
69
+ },
70
+ },
71
+ required: ['workspaceId', 'workflowId'],
72
+ },
73
+ },
74
+ {
75
+ name: 'get_execution',
76
+ description: 'Get the status and results of a workflow execution',
77
+ inputSchema: {
78
+ type: 'object',
79
+ properties: {
80
+ workspaceId: {
81
+ type: 'number',
82
+ description: 'The workspace/project ID',
83
+ },
84
+ executionId: {
85
+ type: 'string',
86
+ description: 'The execution ID',
87
+ },
88
+ },
89
+ required: ['workspaceId', 'executionId'],
90
+ },
91
+ },
92
+ {
93
+ name: 'get_schema',
94
+ description: 'Get the database schema (tables, columns, relationships)',
95
+ inputSchema: {
96
+ type: 'object',
97
+ properties: {
98
+ workspaceId: {
99
+ type: 'number',
100
+ description: 'The workspace/project ID',
101
+ },
102
+ },
103
+ required: ['workspaceId'],
104
+ },
105
+ },
106
+ {
107
+ name: 'query_database',
108
+ description: 'Execute a read-only SQL query (SELECT only)',
109
+ inputSchema: {
110
+ type: 'object',
111
+ properties: {
112
+ workspaceId: {
113
+ type: 'number',
114
+ description: 'The workspace/project ID',
115
+ },
116
+ query: {
117
+ type: 'string',
118
+ description: 'SQL SELECT query to execute',
119
+ },
120
+ },
121
+ required: ['workspaceId', 'query'],
122
+ },
123
+ },
124
+ ];
125
+ /**
126
+ * Create tool handler implementations bound to a client
127
+ */
128
+ function createHandlers(client) {
129
+ return {
130
+ // ============================================================
131
+ // IMPLEMENTED
132
+ // ============================================================
133
+ async list_projects() {
134
+ const response = await client.get('/api/studio/projects');
135
+ if (!response.success) {
136
+ throw new Error(`Failed to list projects: ${response.error}`);
137
+ }
138
+ const projects = (response.data || []).map((p) => ({
139
+ id: p.id,
140
+ name: p.name || p.title,
141
+ description: p.description,
142
+ path: p.path || p.path_with_namespace,
143
+ created_at: p.created_at,
144
+ updated_at: p.updated_at || p.last_activity_at,
145
+ }));
146
+ return { projects };
147
+ },
148
+ // ============================================================
149
+ // TODO: Implement these
150
+ // ============================================================
151
+ async get_project(args) {
152
+ // TODO: Implement
153
+ // const response = await client.get(`/api/studio/workspace/${args.projectId}`);
154
+ throw new Error('Not implemented yet');
155
+ },
156
+ async list_workflows(args) {
157
+ // TODO: Implement
158
+ // const response = await client.get(`/api/studio/workspace/${args.workspaceId}/airjobs/workflows`);
159
+ throw new Error('Not implemented yet');
160
+ },
161
+ async execute_workflow(args) {
162
+ // TODO: Implement
163
+ // const response = await client.post(`/api/studio/workspace/${args.workspaceId}/airjobs/execute`, { ... });
164
+ throw new Error('Not implemented yet');
165
+ },
166
+ async get_execution(args) {
167
+ // TODO: Implement
168
+ // const response = await client.get(`/api/studio/workspace/${args.workspaceId}/airjobs/executions?id=${args.executionId}`);
169
+ throw new Error('Not implemented yet');
170
+ },
171
+ async get_schema(args) {
172
+ // TODO: Implement
173
+ // const response = await client.get(`/api/studio/workspace/${args.workspaceId}/db/tables`);
174
+ throw new Error('Not implemented yet');
175
+ },
176
+ async query_database(args) {
177
+ // TODO: Implement
178
+ // IMPORTANT: Validate query is SELECT only
179
+ // const response = await client.post(`/api/studio/workspace/${args.workspaceId}/db/sql`, { sql: args.query });
180
+ throw new Error('Not implemented yet');
181
+ },
182
+ };
183
+ }
184
+ /**
185
+ * Register tool handlers with an MCP server
186
+ */
187
+ function createToolHandlers(server, client) {
188
+ const handlers = createHandlers(client);
189
+ // List available tools
190
+ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
191
+ return { tools: TOOL_DEFINITIONS };
192
+ });
193
+ // Handle tool calls
194
+ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
195
+ const { name, arguments: args } = request.params;
196
+ const handler = handlers[name];
197
+ if (!handler) {
198
+ throw new Error(`Unknown tool: ${name}`);
199
+ }
200
+ try {
201
+ const result = await handler(args);
202
+ return {
203
+ content: [
204
+ {
205
+ type: 'text',
206
+ text: JSON.stringify(result, null, 2),
207
+ },
208
+ ],
209
+ };
210
+ }
211
+ catch (error) {
212
+ const message = error instanceof Error ? error.message : 'Unknown error';
213
+ return {
214
+ content: [
215
+ {
216
+ type: 'text',
217
+ text: `Error: ${message}`,
218
+ },
219
+ ],
220
+ isError: true,
221
+ };
222
+ }
223
+ });
224
+ }
225
+ //# sourceMappingURL=handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/tools/handlers.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAmMH,gDAwCC;AAxOD,iEAG4C;AAG5C;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACvB;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,kEAAkE;QAC/E,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;SACb;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,mDAAmD;QAChE,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gBAAgB;iBAC9B;aACF;YACD,QAAQ,EAAE,CAAC,WAAW,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IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;QAEjD,MAAM,OAAO,GAAI,QAAgB,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;qBACtC;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACzE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,UAAU,OAAO,EAAE;qBAC1B;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tool Registry
3
+ *
4
+ * Registers all available MCP tools with their schemas and handlers.
5
+ */
6
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
7
+ /**
8
+ * Register all tools with the MCP server
9
+ */
10
+ export declare function registerTools(server: Server): void;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AA6NnE;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA4ClD"}