@deriv-com/fe-mcp-servers 0.0.8 → 0.0.10
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 +60 -56
- package/bin/fe-mcp.js +424 -0
- package/dist/shift-ai/README.md +124 -77
- package/dist/shift-ai/mcp-server.js +16185 -3065
- package/package.json +7 -3
package/dist/shift-ai/README.md
CHANGED
|
@@ -1,136 +1,183 @@
|
|
|
1
1
|
# ShiftAI MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Model Context Protocol (MCP) server that provides AI code generation with automatic code provenance wrapping according to simple AI code wrapping rules.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 🚀 Installation & Setup
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **Simple Comment Markers**: Uses language-appropriate comment syntax for wrapping
|
|
9
|
-
- **AI Code Provenance**: Enables automated detection and tracking of AI-generated code
|
|
10
|
-
- **MCP Protocol**: Full compatibility with MCP-enabled AI tools and IDEs
|
|
11
|
-
- **Zero Configuration**: Works out of the box with sensible defaults
|
|
12
|
-
- **Language Detection**: Automatically applies correct comment syntax for each file type
|
|
13
|
-
|
|
14
|
-
## 🚀 Installation
|
|
15
|
-
|
|
16
|
-
### Install the Package
|
|
7
|
+
### Step 1: Install the Package
|
|
17
8
|
```bash
|
|
18
9
|
npm install -g @deriv-com/fe-mcp-servers
|
|
19
10
|
```
|
|
20
11
|
|
|
21
|
-
### Get
|
|
22
|
-
|
|
12
|
+
### Step 2: Get Configuration Path
|
|
13
|
+
Get the exact path for your MCP configuration:
|
|
23
14
|
|
|
24
15
|
```bash
|
|
25
|
-
echo "$(npm root -g)/@deriv-com/fe-mcp-servers/dist/shift-ai/
|
|
16
|
+
echo "$(npm root -g)/@deriv-com/fe-mcp-servers/dist/shift-ai/mcp-server.js"
|
|
26
17
|
```
|
|
27
18
|
|
|
28
|
-
|
|
19
|
+
**Important**: Use the **bundled executable path** (without `src/`) for MCP configuration.
|
|
29
20
|
|
|
30
|
-
|
|
21
|
+
### Step 3: Configure MCP Client
|
|
22
|
+
Add to your MCP client configuration (e.g., in Cursor settings):
|
|
31
23
|
|
|
32
|
-
### Cursor IDE
|
|
33
24
|
```json
|
|
34
25
|
{
|
|
35
26
|
"mcpServers": {
|
|
36
27
|
"shift-ai": {
|
|
37
28
|
"command": "node",
|
|
38
|
-
"args": ["
|
|
29
|
+
"args": ["/Users/user/.nvm/versions/node/v20.17.0/lib/node_modules/@deriv-com/fe-mcp-servers/dist/shift-ai/mcp-server.js"]
|
|
39
30
|
}
|
|
40
31
|
}
|
|
41
32
|
}
|
|
42
33
|
```
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
## 🛠️ Development Structure
|
|
36
|
+
|
|
37
|
+
### Source Code (Development)
|
|
38
|
+
```
|
|
39
|
+
shift-ai/
|
|
40
|
+
├── src/
|
|
41
|
+
│ ├── mcp-server.js # Main MCP server implementation
|
|
42
|
+
│ ├── mcp.js # Core ShiftAI functionality
|
|
43
|
+
│ └── test-mcp.js # Test suite
|
|
44
|
+
└── README.md # This documentation
|
|
54
45
|
```
|
|
55
46
|
|
|
56
|
-
###
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
47
|
+
### Built Output (Distribution)
|
|
48
|
+
After building, the package creates:
|
|
49
|
+
```
|
|
50
|
+
dist/
|
|
51
|
+
└── shift-ai/
|
|
52
|
+
├── mcp-server.js # Bundled executable (all dependencies included)
|
|
53
|
+
└── README.md # Documentation
|
|
66
54
|
```
|
|
67
55
|
|
|
68
|
-
##
|
|
56
|
+
## 🔧 Build Process
|
|
69
57
|
|
|
70
|
-
|
|
58
|
+
The build process uses esbuild to:
|
|
59
|
+
1. Bundle all dependencies into a single file
|
|
60
|
+
2. Create a standalone executable
|
|
61
|
+
3. Include proper Node.js shebang for direct execution
|
|
62
|
+
4. No external dependency resolution needed at runtime
|
|
71
63
|
|
|
72
|
-
|
|
64
|
+
## ⚡ Available Tools
|
|
73
65
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```
|
|
66
|
+
### `shai` Tool
|
|
67
|
+
Generates code wrapped according to simple AI code provenance rules.
|
|
77
68
|
|
|
78
|
-
|
|
79
|
-
shai: create a login form with validation
|
|
80
|
-
```
|
|
69
|
+
**Parameters:**
|
|
81
70
|
|
|
71
|
+
- `prompt` (string, required): The instruction or prompt for code generation
|
|
72
|
+
- `code` (string, optional): Existing code to be wrapped with AI markers
|
|
73
|
+
|
|
74
|
+
**Returns:**
|
|
75
|
+
|
|
76
|
+
- Formatted instructions with examples for proper AI code wrapping
|
|
77
|
+
|
|
78
|
+
## 🎯 Usage Examples
|
|
79
|
+
|
|
80
|
+
Once configured in your MCP client, you can use the `shai` tool in your conversations:
|
|
81
|
+
|
|
82
|
+
### Simple Code Generation
|
|
83
|
+
|
|
84
|
+
**Input:**
|
|
82
85
|
```
|
|
83
|
-
shai
|
|
86
|
+
Use shai to create a login form component in React
|
|
84
87
|
```
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
**What happens:**
|
|
90
|
+
The AI will receive instructions to wrap any generated code with proper AI markers for React/JavaScript.
|
|
91
|
+
|
|
92
|
+
### Code Refactoring
|
|
87
93
|
|
|
94
|
+
**Input:**
|
|
88
95
|
```
|
|
89
|
-
shai:
|
|
96
|
+
shai: refactor this function to be more efficient:
|
|
90
97
|
|
|
91
|
-
function
|
|
92
|
-
|
|
98
|
+
function calculateTotal(items) {
|
|
99
|
+
let total = 0;
|
|
100
|
+
for (let i = 0; i < items.length; i++) {
|
|
101
|
+
total += items[i].price * items[i].quantity;
|
|
102
|
+
}
|
|
103
|
+
return total;
|
|
93
104
|
}
|
|
94
105
|
```
|
|
95
106
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
**Expected Output:**
|
|
108
|
+
```javascript
|
|
109
|
+
// [AI]
|
|
110
|
+
function calculateTotal(items) {
|
|
111
|
+
return items.reduce((total, item) => total + (item.price * item.quantity), 0);
|
|
112
|
+
}
|
|
113
|
+
// [/AI]
|
|
100
114
|
```
|
|
101
115
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
### `shai` Tool
|
|
116
|
+
### Multi-Language Support
|
|
105
117
|
|
|
106
|
-
|
|
118
|
+
**Python Example:**
|
|
119
|
+
```
|
|
120
|
+
shai: create a data validation function in Python
|
|
121
|
+
```
|
|
107
122
|
|
|
108
|
-
**
|
|
123
|
+
**Expected Output:**
|
|
124
|
+
```python
|
|
125
|
+
# [AI]
|
|
126
|
+
def validate_email(email):
|
|
127
|
+
import re
|
|
128
|
+
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
|
|
129
|
+
return re.match(pattern, email) is not None
|
|
130
|
+
# [/AI]
|
|
131
|
+
```
|
|
109
132
|
|
|
110
|
-
|
|
111
|
-
|
|
133
|
+
**CSS Example:**
|
|
134
|
+
```
|
|
135
|
+
shai: create a responsive navigation bar style
|
|
136
|
+
```
|
|
112
137
|
|
|
113
|
-
**
|
|
138
|
+
**Expected Output:**
|
|
139
|
+
```css
|
|
140
|
+
/* [AI] */
|
|
141
|
+
.navbar {
|
|
142
|
+
display: flex;
|
|
143
|
+
justify-content: space-between;
|
|
144
|
+
align-items: center;
|
|
145
|
+
padding: 1rem 2rem;
|
|
146
|
+
background-color: #333;
|
|
147
|
+
color: white;
|
|
148
|
+
}
|
|
114
149
|
|
|
115
|
-
-
|
|
150
|
+
@media (max-width: 768px) {
|
|
151
|
+
.navbar {
|
|
152
|
+
flex-direction: column;
|
|
153
|
+
padding: 1rem;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/* [/AI] */
|
|
157
|
+
```
|
|
116
158
|
|
|
117
|
-
|
|
159
|
+
### Code Review and Improvement
|
|
118
160
|
|
|
161
|
+
**Input:**
|
|
119
162
|
```
|
|
120
|
-
|
|
121
|
-
├── src/
|
|
122
|
-
│ ├── mcp-server.js # Main MCP server implementation
|
|
123
|
-
│ ├── mcp.js # Core shai function
|
|
124
|
-
│ └── test-mcp.js # Test suite
|
|
125
|
-
└── README.md # This file
|
|
163
|
+
shai: analyze and improve this API endpoint for better error handling
|
|
126
164
|
```
|
|
127
165
|
|
|
128
|
-
|
|
166
|
+
**Benefits:**
|
|
167
|
+
- Ensures all AI-generated code suggestions are properly marked
|
|
168
|
+
- Maintains code provenance tracking
|
|
169
|
+
- Enables automated detection of AI-assisted code
|
|
170
|
+
- Supports team transparency and compliance requirements
|
|
171
|
+
|
|
172
|
+
### Common Use Cases
|
|
129
173
|
|
|
130
|
-
|
|
131
|
-
|
|
174
|
+
1. **Feature Development**: `shai: implement user authentication`
|
|
175
|
+
2. **Bug Fixes**: `shai: fix the memory leak in this component`
|
|
176
|
+
3. **Code Optimization**: `shai: optimize this database query`
|
|
177
|
+
4. **Testing**: `shai: write unit tests for this function`
|
|
178
|
+
5. **Documentation**: `shai: add JSDoc comments to this module`
|
|
132
179
|
|
|
133
|
-
##
|
|
180
|
+
## Comment Formats
|
|
134
181
|
|
|
135
182
|
| Language/File Type | Wrapper Format |
|
|
136
183
|
|----------------------- |-----------------------------------|
|