@deriv-com/fe-mcp-servers 0.0.7 → 0.0.8
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 +3 -3
- package/dist/shift-ai/mcp-server.js +5462 -0
- package/package.json +1 -4
- package/dist/shift-ai/src/mcp-server.js +0 -112
- package/dist/shift-ai/src/mcp.js +0 -96
- package/dist/shift-ai/src/test-mcp.js +0 -66
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deriv-com/fe-mcp-servers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Collection of Front-End Model Context Protocol (MCP) servers for reusability and standardization",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist/"
|
|
29
29
|
],
|
|
30
|
-
"bundledDependencies": [
|
|
31
|
-
"@modelcontextprotocol/sdk"
|
|
32
|
-
],
|
|
33
30
|
"dependencies": {
|
|
34
31
|
"@modelcontextprotocol/sdk": "^0.6.0"
|
|
35
32
|
},
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
-
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
-
import { shai } from './mcp.js';
|
|
5
|
-
|
|
6
|
-
const transport = new StdioServerTransport();
|
|
7
|
-
|
|
8
|
-
const server = new Server({
|
|
9
|
-
name: 'ShiftAI MCP Server',
|
|
10
|
-
version: '0.0.1',
|
|
11
|
-
}, {
|
|
12
|
-
capabilities: {
|
|
13
|
-
tools: {},
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// Register tools list handler
|
|
18
|
-
server.setRequestHandler(ListToolsRequestSchema, async (request) => {
|
|
19
|
-
return {
|
|
20
|
-
tools: [
|
|
21
|
-
{
|
|
22
|
-
name: 'shai',
|
|
23
|
-
description: `Generates code wrapped according to simple AI code provenance rules.
|
|
24
|
-
|
|
25
|
-
# AI Code Wrapping Rules
|
|
26
|
-
|
|
27
|
-
All code suggestions from any AI tool or agent must be wrapped in simple comment markers for the file type.
|
|
28
|
-
|
|
29
|
-
## Comment Styles by Language
|
|
30
|
-
|
|
31
|
-
| Language/File Type | Wrapper Format |
|
|
32
|
-
|------------------------|-----------------------------------|
|
|
33
|
-
| JavaScript/TypeScript/Dart/Java/C/C++/C#/PHP/Go/Rust/Swift/Kotlin/Scala | // [AI]\\ncode here\\n// [/AI] |
|
|
34
|
-
| Python/Shell/Ruby/PERL/R/YAML/TOML | # [AI]\\ncode here\\n# [/AI] |
|
|
35
|
-
| CSS/SCSS/Sass/Less | /* [AI] */\\ncode here\\n/* [/AI] */ |
|
|
36
|
-
| HTML/XML/Markdown | <!-- [AI] -->\\ncode here\\n<!-- [/AI] --> |
|
|
37
|
-
|
|
38
|
-
## Examples
|
|
39
|
-
|
|
40
|
-
**JavaScript:**
|
|
41
|
-
// [AI]
|
|
42
|
-
function fibonacci(n) {
|
|
43
|
-
const sequence = [0, 1];
|
|
44
|
-
for (let i = 2; i < n; i++) {
|
|
45
|
-
sequence[i] = sequence[i - 1] + sequence[i - 2];
|
|
46
|
-
}
|
|
47
|
-
return sequence.slice(0, n);
|
|
48
|
-
}
|
|
49
|
-
// [/AI]
|
|
50
|
-
|
|
51
|
-
**Python:**
|
|
52
|
-
# [AI]
|
|
53
|
-
def fibonacci(n):
|
|
54
|
-
sequence = [0, 1]
|
|
55
|
-
for i in range(2, n):
|
|
56
|
-
sequence.append(sequence[i-1] + sequence[i-2])
|
|
57
|
-
return sequence[:n]
|
|
58
|
-
# [/AI]
|
|
59
|
-
|
|
60
|
-
**HTML:**
|
|
61
|
-
<!-- [AI] -->
|
|
62
|
-
<div>Content here</div>
|
|
63
|
-
<!-- [/AI] -->
|
|
64
|
-
|
|
65
|
-
**CSS:**
|
|
66
|
-
/* [AI] */
|
|
67
|
-
.class {
|
|
68
|
-
property: value;
|
|
69
|
-
}
|
|
70
|
-
/* [/AI] */
|
|
71
|
-
|
|
72
|
-
## Key Rules
|
|
73
|
-
|
|
74
|
-
1. Always use the correct comment syntax for the file type
|
|
75
|
-
2. The code inside the wrapper must be actual code, not commented out
|
|
76
|
-
3. Use simple opening and closing markers - no complex metadata required
|
|
77
|
-
4. Consistent formatting - opening marker on its own line, closing marker on its own line
|
|
78
|
-
|
|
79
|
-
This simple approach enables automated detection and tracking of AI-generated code while maintaining readability and simplicity.`,
|
|
80
|
-
inputSchema: {
|
|
81
|
-
type: 'object',
|
|
82
|
-
properties: {
|
|
83
|
-
prompt: { type: 'string' },
|
|
84
|
-
code: { type: 'string' }
|
|
85
|
-
},
|
|
86
|
-
required: ['prompt']
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
// Register tool call handler
|
|
94
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
95
|
-
if (request.params.name === 'shai') {
|
|
96
|
-
const { prompt, code } = request.params.arguments || {};
|
|
97
|
-
const result = shai(prompt, code);
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
content: [
|
|
101
|
-
{
|
|
102
|
-
type: 'text',
|
|
103
|
-
text: JSON.stringify(result, null, 2)
|
|
104
|
-
}
|
|
105
|
-
],
|
|
106
|
-
structuredContent: result
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
server.connect(transport);
|
package/dist/shift-ai/src/mcp.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// MCP: Cursor AI Prompt Compliance Checker
|
|
2
|
-
// Ensures prompts and code suggestions follow cursor-rules.md
|
|
3
|
-
// Compatible with Cursor, VS Code, and other AI tools
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Instructs the AI to generate code according to the simple AI code wrapping rules.
|
|
7
|
-
* @param {string} prompt - The user prompt to the AI (plain text).
|
|
8
|
-
* @param {string} [code] - The code block suggested by the AI (optional).
|
|
9
|
-
* @returns {{ message: string }}
|
|
10
|
-
*/
|
|
11
|
-
function shai(prompt, code) {
|
|
12
|
-
return {
|
|
13
|
-
message: `IMPORTANT: You must wrap your code output with simple AI markers as shown below.
|
|
14
|
-
|
|
15
|
-
# AI Code Wrapping Rules
|
|
16
|
-
|
|
17
|
-
All code suggestions from any AI tool or agent must be wrapped in simple comment markers for the file type.
|
|
18
|
-
|
|
19
|
-
## Comment Styles by Language
|
|
20
|
-
|
|
21
|
-
| Language/File Type | Wrapper Format |
|
|
22
|
-
|------------------------|-----------------------------------|
|
|
23
|
-
| JavaScript/TypeScript/Dart/Java/C/C++/C#/PHP/Go/Rust/Swift/Kotlin/Scala | // [AI]\\ncode here\\n// [/AI] |
|
|
24
|
-
| Python/Shell/Ruby/PERL/R/YAML/TOML | # [AI]\\ncode here\\n# [/AI] |
|
|
25
|
-
| CSS/SCSS/Sass/Less | /* [AI] */\\ncode here\\n/* [/AI] */ |
|
|
26
|
-
| HTML/XML/Markdown | <!-- [AI] -->\\ncode here\\n<!-- [/AI] --> |
|
|
27
|
-
|
|
28
|
-
## Examples
|
|
29
|
-
|
|
30
|
-
**JavaScript:**
|
|
31
|
-
\`\`\`javascript
|
|
32
|
-
// [AI]
|
|
33
|
-
function fibonacci(n) {
|
|
34
|
-
const sequence = [0, 1];
|
|
35
|
-
for (let i = 2; i < n; i++) {
|
|
36
|
-
sequence[i] = sequence[i - 1] + sequence[i - 2];
|
|
37
|
-
}
|
|
38
|
-
return sequence.slice(0, n);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
console.log(fibonacci(10));
|
|
42
|
-
// [/AI]
|
|
43
|
-
\`\`\`
|
|
44
|
-
|
|
45
|
-
**Python:**
|
|
46
|
-
\`\`\`python
|
|
47
|
-
# [AI]
|
|
48
|
-
def fibonacci(n):
|
|
49
|
-
sequence = [0, 1]
|
|
50
|
-
for i in range(2, n):
|
|
51
|
-
sequence.append(sequence[i-1] + sequence[i-2])
|
|
52
|
-
return sequence[:n]
|
|
53
|
-
|
|
54
|
-
print(fibonacci(10))
|
|
55
|
-
# [/AI]
|
|
56
|
-
\`\`\`
|
|
57
|
-
|
|
58
|
-
**HTML:**
|
|
59
|
-
\`\`\`html
|
|
60
|
-
<!-- [AI] -->
|
|
61
|
-
<div class="fibonacci-result">
|
|
62
|
-
<h2>Fibonacci Sequence</h2>
|
|
63
|
-
<p>Result: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]</p>
|
|
64
|
-
</div>
|
|
65
|
-
<!-- [/AI] -->
|
|
66
|
-
\`\`\`
|
|
67
|
-
|
|
68
|
-
**CSS:**
|
|
69
|
-
\`\`\`css
|
|
70
|
-
/* [AI] */
|
|
71
|
-
.fibonacci-result {
|
|
72
|
-
padding: 20px;
|
|
73
|
-
background: #f5f5f5;
|
|
74
|
-
border-radius: 8px;
|
|
75
|
-
margin: 10px 0;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.fibonacci-result h2 {
|
|
79
|
-
color: #333;
|
|
80
|
-
margin-bottom: 10px;
|
|
81
|
-
}
|
|
82
|
-
/* [/AI] */
|
|
83
|
-
\`\`\`
|
|
84
|
-
|
|
85
|
-
## Key Rules
|
|
86
|
-
|
|
87
|
-
1. **Always use the correct comment syntax** for the file type
|
|
88
|
-
2. **The code inside the wrapper must be actual code**, not commented out
|
|
89
|
-
3. **Use simple opening and closing markers** - no complex metadata required
|
|
90
|
-
4. **Consistent formatting** - opening marker on its own line, closing marker on its own line
|
|
91
|
-
|
|
92
|
-
This simple approach enables automated detection and tracking of AI-generated code while maintaining readability and simplicity.`
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export { shai };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
|
|
3
|
-
const server = spawn('node', ['mcp-server.js'], {
|
|
4
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
let requestId = 1;
|
|
8
|
-
|
|
9
|
-
function sendRequest(method, params = {}) {
|
|
10
|
-
const request = {
|
|
11
|
-
jsonrpc: "2.0",
|
|
12
|
-
id: requestId++,
|
|
13
|
-
method,
|
|
14
|
-
params
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
console.log(`Sending: ${JSON.stringify(request)}`);
|
|
18
|
-
server.stdin.write(JSON.stringify(request) + '\n');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function handleResponse() {
|
|
22
|
-
return new Promise((resolve) => {
|
|
23
|
-
server.stdout.once('data', (data) => {
|
|
24
|
-
const response = JSON.parse(data.toString().trim());
|
|
25
|
-
console.log(`Received: ${JSON.stringify(response, null, 2)}`);
|
|
26
|
-
resolve(response);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async function testServer() {
|
|
32
|
-
try {
|
|
33
|
-
// 1. Initialize
|
|
34
|
-
console.log('\n=== Step 1: Initialize ===');
|
|
35
|
-
sendRequest('initialize', {
|
|
36
|
-
protocolVersion: '2024-11-05',
|
|
37
|
-
capabilities: { tools: {} },
|
|
38
|
-
clientInfo: { name: 'test-client', version: '1.0.0' }
|
|
39
|
-
});
|
|
40
|
-
await handleResponse();
|
|
41
|
-
|
|
42
|
-
// 2. List tools
|
|
43
|
-
console.log('\n=== Step 2: List tools ===');
|
|
44
|
-
sendRequest('tools/list');
|
|
45
|
-
await handleResponse();
|
|
46
|
-
|
|
47
|
-
// 3. Call tool with simple format
|
|
48
|
-
console.log('\n=== Step 3: Call shai tool ===');
|
|
49
|
-
sendRequest('tools/call', {
|
|
50
|
-
name: 'shai',
|
|
51
|
-
arguments: {
|
|
52
|
-
prompt: 'create a simple fibonacci function',
|
|
53
|
-
code: '// [AI]\nfunction fibonacci(n) {\n return n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2);\n}\n// [/AI]'
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
await handleResponse();
|
|
57
|
-
|
|
58
|
-
console.log('\n=== Test completed successfully! ===');
|
|
59
|
-
} catch (error) {
|
|
60
|
-
console.error('Test failed:', error);
|
|
61
|
-
} finally {
|
|
62
|
-
server.kill();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
testServer();
|