@cplace/test-mcp-server 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.
- package/README.md +105 -0
- package/dist/api.d.ts +7 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +50 -0
- package/dist/api.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +212 -0
- package/dist/index.js.map +1 -0
- package/dist/searchConversion.d.ts +2 -0
- package/dist/searchConversion.d.ts.map +1 -0
- package/dist/searchConversion.js +286 -0
- package/dist/searchConversion.js.map +1 -0
- package/dist/searchSchema.d.ts +2601 -0
- package/dist/searchSchema.d.ts.map +1 -0
- package/dist/searchSchema.js +103 -0
- package/dist/searchSchema.js.map +1 -0
- package/dist/types.d.ts +102 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +154 -0
- package/dist/utils.js.map +1 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @cplace/mcp-server
|
|
2
|
+
|
|
3
|
+
An MCP (Model Context Protocol) server that provides Claude Desktop with tools to interact with cplace APIs. This server exposes cplace functionality through a set of MCP tools for workspace management, page operations, and search capabilities.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Workspace Information**: Get workspaces, types, and metadata
|
|
8
|
+
- **Datamodel Information**: Get attributes and metadata
|
|
9
|
+
- **Page Retrieval**: Get pages by UID
|
|
10
|
+
- **Person Retrieval**: Get persons by UID or name
|
|
11
|
+
- **Complex Search**: Structured attribute filtering with multiple conditions
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### For Development/Local Use
|
|
16
|
+
|
|
17
|
+
1. Clone this repository
|
|
18
|
+
2. Install dependencies:
|
|
19
|
+
```bash
|
|
20
|
+
npm install
|
|
21
|
+
```
|
|
22
|
+
3. Build the project:
|
|
23
|
+
```bash
|
|
24
|
+
npm run build
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Configuration with Claude Desktop
|
|
28
|
+
|
|
29
|
+
### For Local Development
|
|
30
|
+
|
|
31
|
+
Add this entry to your Claude Desktop MCP server configuration file:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"cplace": {
|
|
37
|
+
"command": "node",
|
|
38
|
+
"args": ["/absolute/path/to/this/project/dist/index.js"],
|
|
39
|
+
"env": {
|
|
40
|
+
"CPLACE_URL": "https://your-cplace-instance.com",
|
|
41
|
+
"API_TOKEN": "your-api-token"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### For NPM Installation (when published)
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"cplace": {
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": ["@cplace/test-mcp-server"],
|
|
56
|
+
"env": {
|
|
57
|
+
"CPLACE_URL": "https://your-cplace-instance.com",
|
|
58
|
+
"API_TOKEN": "your-api-token"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Available Tools
|
|
66
|
+
|
|
67
|
+
- `cplace_list_workspaces` - Get all workspaces with essential properties
|
|
68
|
+
- `cplace_get_workspace_details` - Get comprehensive workspace details
|
|
69
|
+
- `cplace_get_types_in_workspace` - Get types from workspace
|
|
70
|
+
- `cplace_get_type_datamodel` - Get the datamodel of a type including its attributes, constraints, and permissions
|
|
71
|
+
- `cplace_get_page_by_id` - Get page by ID with full details
|
|
72
|
+
- `cplace_get_person_by_id` - Get details about a person including their name and email
|
|
73
|
+
- `cplace_search_person` - Search a person by their name
|
|
74
|
+
- `cplace_search_pages` - Search pages of a type in cplace
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
1. Obtain an API Token for your cplace system (see [cplace documentation](https://docs.cplace.io/lowcode/low-code-cli/authentication/))
|
|
79
|
+
2. Configure your credentials (see Configuration section above)
|
|
80
|
+
3. If Claude Desktop is running, close it
|
|
81
|
+
4. Add the MCP server configuration to Claude Desktop
|
|
82
|
+
5. Open Claude Desktop - the cplace tools should now be available
|
|
83
|
+
|
|
84
|
+
## Changing the cplace System
|
|
85
|
+
|
|
86
|
+
To change `CPLACE_URL` or `API_TOKEN`, update the values in the Claude Desktop configuration, then close & reopen Claude Desktop.
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Install dependencies
|
|
92
|
+
npm install
|
|
93
|
+
|
|
94
|
+
# Build
|
|
95
|
+
npm run build
|
|
96
|
+
|
|
97
|
+
# Run in development
|
|
98
|
+
npm run dev
|
|
99
|
+
|
|
100
|
+
# Lint
|
|
101
|
+
npm run lint
|
|
102
|
+
|
|
103
|
+
# Format code
|
|
104
|
+
npm run format
|
|
105
|
+
```
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CplaceConfig } from './types.js';
|
|
2
|
+
export declare class CplaceApiClient {
|
|
3
|
+
private config;
|
|
4
|
+
constructor(config: CplaceConfig);
|
|
5
|
+
makeApiRequest<T = any>(endpoint: string, method?: 'GET' | 'POST', params?: Record<string, any>, data?: any): Promise<T | string>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAEvD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,EAAE,YAAY;IAI1B,cAAc,CAAC,CAAC,GAAG,GAAG,EAC1B,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,KAAK,GAAG,MAAc,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC;CA6CvB"}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
export class CplaceApiClient {
|
|
3
|
+
config;
|
|
4
|
+
constructor(config) {
|
|
5
|
+
this.config = config;
|
|
6
|
+
}
|
|
7
|
+
async makeApiRequest(endpoint, method = 'GET', params, data) {
|
|
8
|
+
try {
|
|
9
|
+
const headers = {
|
|
10
|
+
'X-Cplace-Api-Token': this.config.apiToken,
|
|
11
|
+
'Content-Type': 'application/json'
|
|
12
|
+
};
|
|
13
|
+
const url = new URL(`cplace-api/cf.cplace.citizenAi/mcp/${endpoint}`, this.config.url).toString();
|
|
14
|
+
let response;
|
|
15
|
+
if (method === 'GET') {
|
|
16
|
+
response = await axios.get(url, { headers, params });
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
response = await axios.post(url, data, { headers });
|
|
20
|
+
}
|
|
21
|
+
const responseData = response.data;
|
|
22
|
+
if (responseData.result !== undefined) {
|
|
23
|
+
const result = responseData.result;
|
|
24
|
+
if (typeof result === 'string' && result !== null && (result.trim().startsWith('[') || result.trim().startsWith('{'))) {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(result);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return `API Error: ${responseData.error || 'Unknown error'}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (axios.isAxiosError(error)) {
|
|
42
|
+
return `Request failed: ${error.message}`;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return `Invalid response: ${error}`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAG7C,MAAM,OAAO,eAAe;IAClB,MAAM,CAAe;IAE7B,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,SAAyB,KAAK,EAC9B,MAA4B,EAC5B,IAAU;QAEV,IAAI,CAAC;YACH,MAAM,OAAO,GAAG;gBACd,oBAAoB,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;gBAC1C,cAAc,EAAE,kBAAkB;aACnC,CAAC;YAEF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,sCAAsC,QAAQ,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;YAElG,IAAI,QAAuC,CAAC;YAE5C,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBACrB,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;YACvD,CAAC;iBAAM,CAAC;gBACN,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;YAED,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;YAEnC,IAAI,YAAY,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBACtC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;gBAGnC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;oBACtH,IAAI,CAAC;wBACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;oBAC5B,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBAEf,OAAO,MAAM,CAAC;oBAChB,CAAC;gBACH,CAAC;qBAAM,CAAC;oBAEN,OAAO,MAAM,CAAC;gBAChB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,cAAc,YAAY,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC;YAC/D,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,OAAO,mBAAmB,KAAK,CAAC,OAAO,EAAE,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACN,OAAO,qBAAqB,KAAK,EAAE,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import * as dotenv from 'dotenv';
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { CplaceApiClient } from './api.js';
|
|
7
|
+
import SearchFilterSchema from "./searchSchema.js";
|
|
8
|
+
import { convertSearchFilterToCplaceFormat } from "./searchConversion.js";
|
|
9
|
+
import { filterSearchResult } from "./utils.js";
|
|
10
|
+
dotenv.config();
|
|
11
|
+
const config = {
|
|
12
|
+
url: process.env.CPLACE_URL || '',
|
|
13
|
+
apiToken: process.env.API_TOKEN || ''
|
|
14
|
+
};
|
|
15
|
+
if (!config.url || !config.apiToken) {
|
|
16
|
+
throw new Error('CPLACE_URL and API_TOKEN environment variables are required');
|
|
17
|
+
}
|
|
18
|
+
const client = new CplaceApiClient(config);
|
|
19
|
+
const server = new McpServer({
|
|
20
|
+
name: "cplace-mcp-server",
|
|
21
|
+
version: "1.0.0"
|
|
22
|
+
});
|
|
23
|
+
server.registerTool("cplace_list_workspaces", {
|
|
24
|
+
description: "Get a list of all workspaces with essential properties (id, name, displayName, totalPages, isFavorite, installed apps)",
|
|
25
|
+
inputSchema: {},
|
|
26
|
+
annotations: { title: "List Workspaces" }
|
|
27
|
+
}, async () => {
|
|
28
|
+
const workspaces = await client.makeApiRequest('json/workspaces');
|
|
29
|
+
if (Array.isArray(workspaces)) {
|
|
30
|
+
const filteredWorkspaces = workspaces.map((workspace) => ({
|
|
31
|
+
id: workspace.id,
|
|
32
|
+
name: workspace.name,
|
|
33
|
+
displayName: workspace.displayName,
|
|
34
|
+
totalPages: workspace.totalPages,
|
|
35
|
+
isFavorite: workspace.isFavorite,
|
|
36
|
+
installedApps: workspace.apps?.installed?.map((app) => app.name) || []
|
|
37
|
+
}));
|
|
38
|
+
return {
|
|
39
|
+
content: [{ type: "text", text: JSON.stringify(filteredWorkspaces, null, 2) }]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return {
|
|
44
|
+
content: [{ type: "text", text: JSON.stringify(workspaces, null, 2) }]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
server.registerTool("cplace_get_workspace_details", {
|
|
49
|
+
description: "Get comprehensive details for a specific workspace including all metadata and type definitions",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
workspaceId: z.string().describe("The ID of the workspace to get details for")
|
|
52
|
+
},
|
|
53
|
+
annotations: { title: "Get Workspace Details" }
|
|
54
|
+
}, async ({ workspaceId }) => {
|
|
55
|
+
const workspaces = await client.makeApiRequest('json/workspaces');
|
|
56
|
+
if (Array.isArray(workspaces)) {
|
|
57
|
+
const workspace = workspaces.find((w) => w.id === workspaceId);
|
|
58
|
+
if (workspace) {
|
|
59
|
+
return {
|
|
60
|
+
content: [{ type: "text", text: JSON.stringify(workspace, null, 2) }]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
content: [{ type: "text", text: `Workspace ${workspaceId} not found` }]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return {
|
|
69
|
+
content: [{ type: "text", text: `Failed to retrieve workspaces: ${workspaces}` }]
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
server.registerTool("cplace_get_types_in_workspace", {
|
|
74
|
+
description: "Get a list of all types available in a certain workspace",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
workspaceId: z.string().describe("The ID of the workspace to get types for")
|
|
77
|
+
},
|
|
78
|
+
annotations: { title: "Get Types in Workspace" }
|
|
79
|
+
}, async ({ workspaceId }) => {
|
|
80
|
+
const workspaces = await client.makeApiRequest('json/workspaces');
|
|
81
|
+
if (Array.isArray(workspaces)) {
|
|
82
|
+
const workspace = workspaces.find((w) => w.id === workspaceId);
|
|
83
|
+
if (workspace) {
|
|
84
|
+
const types = workspace.typeDefinitions?.types || [];
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: JSON.stringify(types, null, 2) }]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
content: [{ type: "text", text: `Workspace ${workspaceId} not found` }]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return {
|
|
95
|
+
content: [{ type: "text", text: `Failed to retrieve workspaces: ${workspaces}` }]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
server.registerTool("cplace_get_type_datamodel", {
|
|
100
|
+
description: "Get the datamodel of a type including its attributes, constraints, and permissions. Use this before performing a search to understand the type structure.",
|
|
101
|
+
inputSchema: {
|
|
102
|
+
workspaceId: z.string().describe("The ID of the workspace"),
|
|
103
|
+
internalName: z.string().describe("The internal name of the type")
|
|
104
|
+
},
|
|
105
|
+
annotations: { title: "Get Type Details" }
|
|
106
|
+
}, async ({ workspaceId, internalName }) => {
|
|
107
|
+
const result = await client.makeApiRequest('json/type-definition', 'GET', {
|
|
108
|
+
workspaceId,
|
|
109
|
+
internalName
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
server.registerTool("cplace_get_page_by_id", {
|
|
116
|
+
description: "Get comprehensive page information including relationships and metadata",
|
|
117
|
+
inputSchema: {
|
|
118
|
+
id: z.string().describe("The ID of the page to get, e.g. 'page/kkt8ol745jqur4581kelm5ply'")
|
|
119
|
+
},
|
|
120
|
+
annotations: { title: "Get Page by ID" }
|
|
121
|
+
}, async ({ id }) => {
|
|
122
|
+
const result = await client.makeApiRequest('json/page', 'GET', { id });
|
|
123
|
+
return {
|
|
124
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
server.registerTool("cplace_get_person_by_id", {
|
|
128
|
+
description: "Get details about a person including their name and email.",
|
|
129
|
+
inputSchema: {
|
|
130
|
+
id: z.string().describe("The ID of the person to get, e.g. 'person/kkt8ol745jqur4581kelm5ply'")
|
|
131
|
+
},
|
|
132
|
+
annotations: { title: "Get Person by ID" }
|
|
133
|
+
}, async ({ id }) => {
|
|
134
|
+
const result = await client.makeApiRequest('json/person', 'GET', { id });
|
|
135
|
+
return {
|
|
136
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
server.registerTool("cplace_search_person", {
|
|
140
|
+
description: "Search a person by their name.",
|
|
141
|
+
inputSchema: {
|
|
142
|
+
name: z.string().describe("The name of the person or part of the name to search for"),
|
|
143
|
+
},
|
|
144
|
+
annotations: { title: "Get Person by ID" }
|
|
145
|
+
}, async ({ name }) => {
|
|
146
|
+
const result = await client.makeApiRequest('json/person', 'GET', { name });
|
|
147
|
+
return {
|
|
148
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
server.registerTool("cplace_search_pages", {
|
|
152
|
+
description: "Search pages of a type in cplace.",
|
|
153
|
+
inputSchema: {
|
|
154
|
+
spaceId: z.string().optional().describe("The ID of the workspace to search in. If not provided, searches across all accessible workspaces."),
|
|
155
|
+
internalTypeName: z.string().describe("The internal name of the type to filter by"),
|
|
156
|
+
search_filter: SearchFilterSchema.describe('Search Filters'),
|
|
157
|
+
limit: z.number().min(1).max(1000).default(50).describe("Maximum number of results to return (1-1000)"),
|
|
158
|
+
offset: z.number().min(0).max(10000).default(0).describe("Number of results to skip for pagination, cannot be larger than 10000"),
|
|
159
|
+
},
|
|
160
|
+
annotations: { title: "Search Pages" }
|
|
161
|
+
}, async ({ spaceId, internalTypeName, search_filter, limit = 50, offset = 0, }) => {
|
|
162
|
+
if (!search_filter) {
|
|
163
|
+
return {
|
|
164
|
+
content: [{ type: "text", text: "search_filter is required" }]
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
const cplaceFilter = convertSearchFilterToCplaceFormat(search_filter);
|
|
169
|
+
if (spaceId) {
|
|
170
|
+
cplaceFilter.filters.unshift({
|
|
171
|
+
type: "Workspace",
|
|
172
|
+
workspaceIds: [spaceId]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
if (internalTypeName) {
|
|
176
|
+
cplaceFilter.filters.unshift({
|
|
177
|
+
type: "Type",
|
|
178
|
+
types: [internalTypeName]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
const result = await client.makeApiRequest('json/search', 'GET', {
|
|
182
|
+
filter: JSON.stringify(cplaceFilter),
|
|
183
|
+
limit,
|
|
184
|
+
offset
|
|
185
|
+
});
|
|
186
|
+
const filteredResults = result.results ? result.results.map((item) => filterSearchResult(item, {
|
|
187
|
+
minimal: false,
|
|
188
|
+
includeAttributes: true,
|
|
189
|
+
includeMetadata: false,
|
|
190
|
+
truncateLargeValues: true
|
|
191
|
+
})) : [];
|
|
192
|
+
const filteredResult = { ...result, results: filteredResults };
|
|
193
|
+
return {
|
|
194
|
+
content: [{ type: "text", text: JSON.stringify(filteredResult, null, 2) }]
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
return {
|
|
199
|
+
content: [{ type: "text", text: `Error converting or executing search: ${error instanceof Error ? error.message : String(error)}` }]
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
async function runServer() {
|
|
204
|
+
const transport = new StdioServerTransport();
|
|
205
|
+
await server.connect(transport);
|
|
206
|
+
console.error("cplace MCP Server running on stdio");
|
|
207
|
+
}
|
|
208
|
+
runServer().catch((error) => {
|
|
209
|
+
console.error("Fatal error running server:", error);
|
|
210
|
+
process.exit(1);
|
|
211
|
+
});
|
|
212
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAA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