@pure-ds/core 0.7.8 → 0.7.9
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/.cursorrules
CHANGED
|
@@ -49,11 +49,11 @@ PDS follows the [Pure Web Manifesto](https://pureweb.dev/manifesto): "The browse
|
|
|
49
49
|
2. Otherwise use workspace root paths (pure-ds development)
|
|
50
50
|
3. Prefer reading actual files over guessing - the data is authoritative
|
|
51
51
|
|
|
52
|
-
## 🔌 MCP
|
|
52
|
+
## 🔌 MCP Lookup Protocol (Optional)
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Use MCP as an optimization, not a prerequisite. For fast, simple lookups, read local SSoT files directly first.
|
|
55
55
|
|
|
56
|
-
###
|
|
56
|
+
### When MCP is already connected
|
|
57
57
|
|
|
58
58
|
1. **Tokens** → call `get_tokens`
|
|
59
59
|
2. **Primitives / utilities / selectors** → call `find_utility_class`
|
|
@@ -66,8 +66,9 @@ If an MCP server named `pure-ds` is available, **use MCP tools first** before ge
|
|
|
66
66
|
|
|
67
67
|
- Do not invent class names, tokens, attributes, events, or selectors.
|
|
68
68
|
- If a value is not found in MCP results, state it is unavailable and suggest nearest matches.
|
|
69
|
-
- Prefer MCP results over memory
|
|
70
|
-
- If MCP is unavailable,
|
|
69
|
+
- Prefer MCP results over memory when MCP is already available.
|
|
70
|
+
- If MCP is unavailable, slow to start, or errors, continue immediately with direct SSoT file reads using the paths above.
|
|
71
|
+
- Never block or fail an answer solely because MCP is unavailable.
|
|
71
72
|
- If neither MCP nor file reads are available, provide only conservative guidance and clearly mark uncertainty.
|
|
72
73
|
|
|
73
74
|
---
|
|
@@ -49,11 +49,11 @@ PDS follows the [Pure Web Manifesto](https://pureweb.dev/manifesto): "The browse
|
|
|
49
49
|
2. Otherwise use workspace root paths (pure-ds development)
|
|
50
50
|
3. Prefer reading actual files over guessing - the data is authoritative
|
|
51
51
|
|
|
52
|
-
## 🔌 MCP
|
|
52
|
+
## 🔌 MCP Lookup Protocol (Optional)
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Use MCP as an optimization, not a prerequisite. For fast, simple lookups, read local SSoT files directly first.
|
|
55
55
|
|
|
56
|
-
###
|
|
56
|
+
### When MCP is already connected
|
|
57
57
|
|
|
58
58
|
1. **Tokens** → call `get_tokens`
|
|
59
59
|
2. **Primitives / utilities / selectors** → call `find_utility_class`
|
|
@@ -66,8 +66,9 @@ If an MCP server named `pure-ds` is available, **use MCP tools first** before ge
|
|
|
66
66
|
|
|
67
67
|
- Do not invent class names, tokens, attributes, events, or selectors.
|
|
68
68
|
- If a value is not found in MCP results, state it is unavailable and suggest nearest matches.
|
|
69
|
-
- Prefer MCP results over memory
|
|
70
|
-
- If MCP is unavailable,
|
|
69
|
+
- Prefer MCP results over memory when MCP is already available.
|
|
70
|
+
- If MCP is unavailable, slow to start, or errors, continue immediately with direct SSoT file reads using the paths above.
|
|
71
|
+
- Never block or fail an answer solely because MCP is unavailable.
|
|
71
72
|
- If neither MCP nor file reads are available, provide only conservative guidance and clearly mark uncertainty.
|
|
72
73
|
|
|
73
74
|
---
|
package/package.json
CHANGED
|
@@ -57,6 +57,7 @@ async function runHealthCheck() {
|
|
|
57
57
|
|
|
58
58
|
const state = { buffer: Buffer.alloc(0) };
|
|
59
59
|
let initialized = false;
|
|
60
|
+
let serverName = 'pure-ds';
|
|
60
61
|
|
|
61
62
|
const timer = setTimeout(() => {
|
|
62
63
|
console.error('❌ MCP health check timed out while waiting for server responses.');
|
|
@@ -75,6 +76,7 @@ async function runHealthCheck() {
|
|
|
75
76
|
parseFrames(state, chunk, (message) => {
|
|
76
77
|
if (message.id === 1 && message.result?.serverInfo?.name) {
|
|
77
78
|
initialized = true;
|
|
79
|
+
serverName = message.result.serverInfo.name;
|
|
78
80
|
child.stdin.write(frame({ jsonrpc: '2.0', id: 2, method: 'tools/list', params: {} }));
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
@@ -92,7 +94,7 @@ async function runHealthCheck() {
|
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
console.log('✅ PDS MCP health check passed');
|
|
95
|
-
console.log(` Server: ${
|
|
97
|
+
console.log(` Server: ${serverName}`);
|
|
96
98
|
console.log(` Tools: ${toolNames.sort().join(', ')}`);
|
|
97
99
|
clearTimeout(timer);
|
|
98
100
|
child.kill();
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { createPdsMcpContext, getPdsMcpTools, runPdsMcpTool } from '../lib/pds-mcp-core.js';
|
|
4
4
|
|
|
5
|
-
const SERVER_NAME = '
|
|
5
|
+
const SERVER_NAME = 'pure-ds';
|
|
6
6
|
const SERVER_VERSION = '0.1.0';
|
|
7
|
-
const
|
|
7
|
+
const DEFAULT_PROTOCOL_VERSION = '2024-11-05';
|
|
8
|
+
const SUPPORTED_PROTOCOL_VERSIONS = new Set([
|
|
9
|
+
'2024-11-05',
|
|
10
|
+
'2025-03-26',
|
|
11
|
+
'2025-06-18',
|
|
12
|
+
]);
|
|
8
13
|
|
|
9
14
|
const ctx = createPdsMcpContext({ projectRoot: process.cwd() });
|
|
10
15
|
const tools = getPdsMcpTools();
|
|
@@ -34,8 +39,13 @@ async function handleMessage(message) {
|
|
|
34
39
|
|
|
35
40
|
try {
|
|
36
41
|
if (method === 'initialize') {
|
|
42
|
+
const requestedProtocolVersion = params?.protocolVersion;
|
|
43
|
+
const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.has(requestedProtocolVersion)
|
|
44
|
+
? requestedProtocolVersion
|
|
45
|
+
: DEFAULT_PROTOCOL_VERSION;
|
|
46
|
+
|
|
37
47
|
return sendResponse(id, {
|
|
38
|
-
protocolVersion
|
|
48
|
+
protocolVersion,
|
|
39
49
|
capabilities: {
|
|
40
50
|
tools: {},
|
|
41
51
|
},
|
|
@@ -138,3 +148,8 @@ process.on('uncaughtException', (error) => {
|
|
|
138
148
|
const text = error?.stack || error?.message || String(error);
|
|
139
149
|
process.stderr.write(`[pds-mcp-server] uncaughtException: ${text}\n`);
|
|
140
150
|
});
|
|
151
|
+
|
|
152
|
+
process.on('unhandledRejection', (error) => {
|
|
153
|
+
const text = error?.stack || error?.message || String(error);
|
|
154
|
+
process.stderr.write(`[pds-mcp-server] unhandledRejection: ${text}\n`);
|
|
155
|
+
});
|
|
@@ -5,22 +5,27 @@ import { existsSync } from 'fs';
|
|
|
5
5
|
import path from 'path';
|
|
6
6
|
|
|
7
7
|
const projectRoot = process.cwd();
|
|
8
|
-
const serverCommand =
|
|
8
|
+
const serverCommand = process.execPath;
|
|
9
9
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
'
|
|
13
|
-
'
|
|
10
|
+
function getServerScriptCandidates() {
|
|
11
|
+
return [
|
|
12
|
+
'node_modules/@pure-ds/core/packages/pds-cli/bin/pds-mcp-server.js',
|
|
13
|
+
'node_modules/pure-ds/packages/pds-cli/bin/pds-mcp-server.js',
|
|
14
|
+
'packages/pds-cli/bin/pds-mcp-server.js',
|
|
14
15
|
];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function resolveServerScriptPath() {
|
|
19
|
+
const candidatePaths = getServerScriptCandidates();
|
|
15
20
|
|
|
16
|
-
for (const
|
|
17
|
-
const absolutePath = path.join(projectRoot,
|
|
21
|
+
for (const candidate of candidatePaths) {
|
|
22
|
+
const absolutePath = path.join(projectRoot, candidate);
|
|
18
23
|
if (existsSync(absolutePath)) {
|
|
19
|
-
return
|
|
24
|
+
return absolutePath;
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
|
|
23
|
-
return candidatePaths[0];
|
|
28
|
+
return path.join(projectRoot, candidatePaths[0]);
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
const serverArgs = [resolveServerScriptPath()];
|
|
@@ -49,6 +54,7 @@ async function setupVSCodeConfig() {
|
|
|
49
54
|
type: 'stdio',
|
|
50
55
|
command: serverCommand,
|
|
51
56
|
args: serverArgs,
|
|
57
|
+
cwd: projectRoot,
|
|
52
58
|
};
|
|
53
59
|
|
|
54
60
|
await writeJson(configPath, { ...current, servers });
|
|
@@ -63,6 +69,7 @@ async function setupCursorConfig() {
|
|
|
63
69
|
mcpServers['pure-ds'] = {
|
|
64
70
|
command: serverCommand,
|
|
65
71
|
args: serverArgs,
|
|
72
|
+
cwd: projectRoot,
|
|
66
73
|
};
|
|
67
74
|
|
|
68
75
|
await writeJson(configPath, { ...current, mcpServers });
|