mlgym-deploy 2.0.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/ADD_TO_CURSOR_SETTINGS.json +28 -0
- package/CURSOR_SETUP.md +119 -0
- package/README.md +43 -0
- package/claude-desktop-config.json +8 -0
- package/cursor-config.json +13 -0
- package/cursor-integration.js +165 -0
- package/cursor-prompt-config.json +27 -0
- package/deploy-hello-world.sh +103 -0
- package/index-v2.js +1040 -0
- package/index-v3-explicit.js +129 -0
- package/index.js +5238 -0
- package/package.json +45 -0
- package/tests/README.md +90 -0
- package/tests/mlgym_auth_login_test.sh +170 -0
- package/tests/mlgym_auth_logout_test.sh +157 -0
- package/tests/mlgym_deployments_test.sh +204 -0
- package/tests/mlgym_project_init_test.sh +148 -0
- package/tests/mlgym_projects_get_test.sh +159 -0
- package/tests/mlgym_projects_list_test.sh +162 -0
- package/tests/mlgym_user_create_test.sh +203 -0
- package/tests/run-all-tests.sh +63 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"workbench.colorTheme": "Atom One Dark",
|
|
3
|
+
"workbench.startupEditor": "none",
|
|
4
|
+
"cmake.configureOnOpen": true,
|
|
5
|
+
"cmake.options.statusBarVisibility": "visible",
|
|
6
|
+
"cmake.showOptionsMovedNotification": false,
|
|
7
|
+
"redhat.telemetry.enabled": true,
|
|
8
|
+
"makefile.configureOnOpen": true,
|
|
9
|
+
"explorer.confirmDelete": false,
|
|
10
|
+
"git.openRepositoryInParentFolders": "never",
|
|
11
|
+
"workbench.iconTheme": "material-icon-theme",
|
|
12
|
+
"editor.formatOnSave": true,
|
|
13
|
+
"editor.defaultFormatter": "charliermarsh.ruff",
|
|
14
|
+
"jupyter.interactiveWindow.textEditor.executeSelection": true,
|
|
15
|
+
"git.autofetch": true,
|
|
16
|
+
"json.schemas": [],
|
|
17
|
+
"mcpServers": {
|
|
18
|
+
"gitlab-backend": {
|
|
19
|
+
"command": "node",
|
|
20
|
+
"args": ["/home/chka/NetBeansProjects/gitlab_backend/mcp-server/index.js"],
|
|
21
|
+
"env": {
|
|
22
|
+
"GITLAB_BACKEND_URL": "https://backend.eu.ezb.net",
|
|
23
|
+
"GITLAB_URL": "https://git.mlgym.io",
|
|
24
|
+
"COOLIFY_URL": "https://coolify.eu.ezb.net"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/CURSOR_SETUP.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# MCP Setup Guide for Cursor IDE
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
✅ Node.js installed
|
|
5
|
+
✅ MCP dependencies installed (already done)
|
|
6
|
+
✅ Cursor IDE with MCP support
|
|
7
|
+
|
|
8
|
+
## Setup Instructions
|
|
9
|
+
|
|
10
|
+
### 1. Configure MCP in Cursor
|
|
11
|
+
|
|
12
|
+
Open Cursor Settings (Cmd/Ctrl+,) and add the MCP server configuration:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"mcp.servers": {
|
|
17
|
+
"gitlab-backend": {
|
|
18
|
+
"command": "node",
|
|
19
|
+
"args": ["${workspaceFolder}/mcp-server/index.js"],
|
|
20
|
+
"env": {
|
|
21
|
+
"GITLAB_BACKEND_URL": "https://backend.eu.ezb.net",
|
|
22
|
+
"GITLAB_URL": "https://git.mlgym.io",
|
|
23
|
+
"COOLIFY_URL": "https://coolify.eu.ezb.net"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2. Using MCP Tools in Cursor
|
|
31
|
+
|
|
32
|
+
#### Option A: VS Code Tasks (Already Configured)
|
|
33
|
+
1. Press `Cmd+Shift+P` (Mac) or `Ctrl+Shift+P` (Linux/Windows)
|
|
34
|
+
2. Type "Tasks: Run Task"
|
|
35
|
+
3. Select either:
|
|
36
|
+
- **MCP: Create User** - Create a new GitLab/Coolify user
|
|
37
|
+
- **MCP: Init Project** - Initialize a project with deployment
|
|
38
|
+
|
|
39
|
+
#### Option B: Direct MCP Commands in Chat
|
|
40
|
+
Once MCP is configured, you can use these commands directly in Cursor chat:
|
|
41
|
+
- `@mcp mlgym_user_create` - Create a user
|
|
42
|
+
- `@mcp mlgym_project_init` - Initialize a project
|
|
43
|
+
|
|
44
|
+
#### Option C: Command Line Interface
|
|
45
|
+
```bash
|
|
46
|
+
# Create a user
|
|
47
|
+
node mcp-server/cursor-integration.js create-user
|
|
48
|
+
|
|
49
|
+
# Initialize a project
|
|
50
|
+
node mcp-server/cursor-integration.js init-project
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. MCP Tool Details
|
|
54
|
+
|
|
55
|
+
#### mlgym_user_create
|
|
56
|
+
Creates a complete user with:
|
|
57
|
+
- GitLab account
|
|
58
|
+
- Coolify account
|
|
59
|
+
- SSH key generation and registration
|
|
60
|
+
- Authentication token storage
|
|
61
|
+
|
|
62
|
+
**Parameters:**
|
|
63
|
+
- `email` (required): User email address
|
|
64
|
+
- `name` (required): User full name
|
|
65
|
+
- `password` (required): User password
|
|
66
|
+
|
|
67
|
+
#### mlgym_project_init
|
|
68
|
+
Initializes a project with:
|
|
69
|
+
- GitLab repository creation
|
|
70
|
+
- Webhook setup for CI/CD
|
|
71
|
+
- Coolify deployment configuration
|
|
72
|
+
- Returns deployment URL
|
|
73
|
+
|
|
74
|
+
**Parameters:**
|
|
75
|
+
- `name` (required): Project name
|
|
76
|
+
- `description` (optional): Project description
|
|
77
|
+
- `enable_deployment` (boolean): Enable Coolify deployment
|
|
78
|
+
- `local_path` (optional): Local directory to initialize
|
|
79
|
+
|
|
80
|
+
### 4. Testing MCP Connection
|
|
81
|
+
|
|
82
|
+
Test that MCP is working:
|
|
83
|
+
```bash
|
|
84
|
+
# Test the MCP server directly
|
|
85
|
+
node mcp-server/index.js
|
|
86
|
+
|
|
87
|
+
# Should output the MCP protocol initialization message
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 5. Authentication
|
|
91
|
+
|
|
92
|
+
MCP stores authentication tokens in `~/.mlgym/mcp_config.json` automatically after first user creation.
|
|
93
|
+
|
|
94
|
+
### 6. Troubleshooting
|
|
95
|
+
|
|
96
|
+
If MCP tools don't appear in Cursor:
|
|
97
|
+
1. Restart Cursor after configuration
|
|
98
|
+
2. Check the MCP server is accessible:
|
|
99
|
+
```bash
|
|
100
|
+
node mcp-server/index.js
|
|
101
|
+
```
|
|
102
|
+
3. Verify settings in Cursor preferences
|
|
103
|
+
4. Check Cursor logs for MCP errors
|
|
104
|
+
|
|
105
|
+
## Quick Test
|
|
106
|
+
|
|
107
|
+
1. Open Terminal in Cursor
|
|
108
|
+
2. Run: `node mcp-server/cursor-integration.js create-user`
|
|
109
|
+
3. Follow the prompts to create a test user
|
|
110
|
+
4. Verify user was created in GitLab and Coolify
|
|
111
|
+
|
|
112
|
+
## Environment Variables
|
|
113
|
+
|
|
114
|
+
The MCP server uses these endpoints:
|
|
115
|
+
- Backend: https://backend.eu.ezb.net
|
|
116
|
+
- GitLab: https://git.mlgym.io
|
|
117
|
+
- Coolify: https://coolify.eu.ezb.net
|
|
118
|
+
|
|
119
|
+
These are pre-configured in the `.cursor/settings.json` file.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# mlgym-deploy
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for GitLab Backend - User creation and project deployment.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g mlgym-deploy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### As MCP Server
|
|
14
|
+
|
|
15
|
+
Configure in your MCP client settings:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"mlgym": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["-y", "mlgym-deploy"]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Available Tools
|
|
29
|
+
|
|
30
|
+
- `mlgym_user_create` - Create a new user with GitLab, Coolify, and SSH key setup
|
|
31
|
+
- `mlgym_project_init` - Initialize a project with GitLab repository and Coolify deployment
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
Set the backend URL via environment variable:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
export MLGYM_BACKEND_URL=https://backend.eu.ezb.net
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcp.servers": {
|
|
3
|
+
"gitlab-backend": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": ["/home/chka/NetBeansProjects/gitlab_backend/mcp-server/index.js"],
|
|
6
|
+
"env": {
|
|
7
|
+
"GITLAB_BACKEND_URL": "https://backend.eu.ezb.net",
|
|
8
|
+
"GITLAB_URL": "https://git.mlgym.io",
|
|
9
|
+
"COOLIFY_URL": "https://coolify.eu.ezb.net"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cursor Integration for GitLab Backend MCP
|
|
5
|
+
* This script provides command-line access to MCP tools for use in Cursor
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { spawn } from 'child_process';
|
|
9
|
+
import readline from 'readline';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = path.dirname(__filename);
|
|
15
|
+
|
|
16
|
+
// MCP server path
|
|
17
|
+
const MCP_SERVER = path.join(__dirname, 'index.js');
|
|
18
|
+
|
|
19
|
+
// Create interface for user input
|
|
20
|
+
const rl = readline.createInterface({
|
|
21
|
+
input: process.stdin,
|
|
22
|
+
output: process.stdout
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Helper to call MCP server
|
|
26
|
+
async function callMCPTool(toolName, args) {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const mcp = spawn('node', [MCP_SERVER], {
|
|
29
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
let output = '';
|
|
33
|
+
let error = '';
|
|
34
|
+
|
|
35
|
+
// Send request
|
|
36
|
+
const request = {
|
|
37
|
+
jsonrpc: '2.0',
|
|
38
|
+
method: 'tools/call',
|
|
39
|
+
params: {
|
|
40
|
+
name: toolName,
|
|
41
|
+
arguments: args
|
|
42
|
+
},
|
|
43
|
+
id: 1
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
mcp.stdin.write(JSON.stringify(request) + '\n');
|
|
47
|
+
|
|
48
|
+
mcp.stdout.on('data', (data) => {
|
|
49
|
+
output += data.toString();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
mcp.stderr.on('data', (data) => {
|
|
53
|
+
error += data.toString();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
mcp.on('close', (code) => {
|
|
57
|
+
if (code !== 0) {
|
|
58
|
+
reject(new Error(`MCP server exited with code ${code}: ${error}`));
|
|
59
|
+
} else {
|
|
60
|
+
try {
|
|
61
|
+
const response = JSON.parse(output);
|
|
62
|
+
resolve(response.result);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
resolve(output);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Command handlers
|
|
72
|
+
const commands = {
|
|
73
|
+
'create-user': async () => {
|
|
74
|
+
console.log('\n🚀 Create GitLab Backend User\n');
|
|
75
|
+
|
|
76
|
+
const email = await question('Email: ');
|
|
77
|
+
const name = await question('Name: ');
|
|
78
|
+
const password = await question('Password: ');
|
|
79
|
+
|
|
80
|
+
console.log('\nCreating user...');
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const result = await callMCPTool('mlgym_user_create', {
|
|
84
|
+
email,
|
|
85
|
+
name,
|
|
86
|
+
password
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
console.log('\n✅ User created successfully!');
|
|
90
|
+
console.log(JSON.stringify(result, null, 2));
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error('\n❌ Error:', error.message);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
'init-project': async () => {
|
|
97
|
+
console.log('\n🚀 Initialize GitLab Project\n');
|
|
98
|
+
|
|
99
|
+
const name = await question('Project name: ');
|
|
100
|
+
const description = await question('Description (optional): ');
|
|
101
|
+
const enableDeployment = await question('Enable deployment? (y/n): ');
|
|
102
|
+
const localPath = await question('Local path (default: .): ') || '.';
|
|
103
|
+
|
|
104
|
+
console.log('\nInitializing project...');
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
const result = await callMCPTool('mlgym_project_init', {
|
|
108
|
+
name,
|
|
109
|
+
description,
|
|
110
|
+
enable_deployment: enableDeployment.toLowerCase() === 'y',
|
|
111
|
+
local_path: localPath
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
console.log('\n✅ Project initialized successfully!');
|
|
115
|
+
console.log(JSON.stringify(result, null, 2));
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error('\n❌ Error:', error.message);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
'help': async () => {
|
|
122
|
+
console.log(`
|
|
123
|
+
GitLab Backend MCP Tools for Cursor
|
|
124
|
+
====================================
|
|
125
|
+
|
|
126
|
+
Commands:
|
|
127
|
+
create-user - Create a new GitLab/Coolify user
|
|
128
|
+
init-project - Initialize a new project with deployment
|
|
129
|
+
help - Show this help message
|
|
130
|
+
exit - Exit the tool
|
|
131
|
+
|
|
132
|
+
Usage:
|
|
133
|
+
node cursor-integration.js <command>
|
|
134
|
+
|
|
135
|
+
Examples:
|
|
136
|
+
node cursor-integration.js create-user
|
|
137
|
+
node cursor-integration.js init-project
|
|
138
|
+
`);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Helper to prompt for input
|
|
143
|
+
function question(prompt) {
|
|
144
|
+
return new Promise((resolve) => {
|
|
145
|
+
rl.question(prompt, resolve);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Main execution
|
|
150
|
+
async function main() {
|
|
151
|
+
const command = process.argv[2] || 'help';
|
|
152
|
+
|
|
153
|
+
if (command === 'exit') {
|
|
154
|
+
rl.close();
|
|
155
|
+
process.exit(0);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const handler = commands[command] || commands.help;
|
|
159
|
+
await handler();
|
|
160
|
+
|
|
161
|
+
rl.close();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Run
|
|
165
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcp_client_config": {
|
|
3
|
+
"force_explicit_prompts": true,
|
|
4
|
+
"never_assume_values": true,
|
|
5
|
+
"always_ask_user": [
|
|
6
|
+
"email",
|
|
7
|
+
"name",
|
|
8
|
+
"password",
|
|
9
|
+
"accept_terms",
|
|
10
|
+
"project_name",
|
|
11
|
+
"project_description"
|
|
12
|
+
],
|
|
13
|
+
"validation_rules": {
|
|
14
|
+
"email": "Must be a valid email address provided by user",
|
|
15
|
+
"name": "Must be user's full name, minimum 2 characters",
|
|
16
|
+
"password": "Must be provided by user, minimum 8 characters",
|
|
17
|
+
"accept_terms": "User must explicitly type 'yes' or 'true' to accept terms",
|
|
18
|
+
"project_name": "Must be provided by user, lowercase alphanumeric with hyphens",
|
|
19
|
+
"project_description": "Must be provided by user, minimum 10 characters"
|
|
20
|
+
},
|
|
21
|
+
"error_messages": {
|
|
22
|
+
"missing_field": "This field is required and must be provided by the user",
|
|
23
|
+
"assumed_value": "Auto-detection is disabled. User must provide this value explicitly.",
|
|
24
|
+
"terms_not_accepted": "User must explicitly accept the terms and conditions"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Test script to demonstrate MCP server functionality for deploying hello-world-example
|
|
4
|
+
|
|
5
|
+
echo "============================================"
|
|
6
|
+
echo "MCP Server Deployment Test"
|
|
7
|
+
echo "Project: /home/chka/lab/hello-world-example"
|
|
8
|
+
echo "============================================"
|
|
9
|
+
echo
|
|
10
|
+
|
|
11
|
+
# Colors for output
|
|
12
|
+
GREEN='\033[0;32m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
# Test user credentials (for demo)
|
|
17
|
+
TEST_EMAIL="test-mcp-$(date +%s)@example.com"
|
|
18
|
+
TEST_NAME="MCP Test User"
|
|
19
|
+
TEST_PASSWORD="Test123!MCP"
|
|
20
|
+
PROJECT_NAME="hello-world-mcp-$(date +%s)"
|
|
21
|
+
|
|
22
|
+
echo -e "${YELLOW}Step 1: Testing MCP Server Protocol${NC}"
|
|
23
|
+
echo "---------------------------------------"
|
|
24
|
+
|
|
25
|
+
# Test MCP initialization
|
|
26
|
+
INIT_REQUEST='{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"1.0.0","capabilities":{},"clientInfo":{"name":"deploy-test","version":"1.0.0"}},"id":1}'
|
|
27
|
+
echo "$INIT_REQUEST" | node /home/chka/NetBeansProjects/gitlab_backend/mcp-server/index.js 2>/dev/null | head -1 | grep -q "gitlab-backend-mcp"
|
|
28
|
+
|
|
29
|
+
if [ $? -eq 0 ]; then
|
|
30
|
+
echo -e "${GREEN}✅ MCP server initialized successfully${NC}"
|
|
31
|
+
else
|
|
32
|
+
echo "❌ MCP server initialization failed"
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
echo
|
|
37
|
+
echo -e "${YELLOW}Step 2: Creating User via MCP${NC}"
|
|
38
|
+
echo "---------------------------------------"
|
|
39
|
+
echo "Email: $TEST_EMAIL"
|
|
40
|
+
echo "Name: $TEST_NAME"
|
|
41
|
+
echo
|
|
42
|
+
|
|
43
|
+
# Create user using MCP tool
|
|
44
|
+
USER_REQUEST=$(cat <<EOF
|
|
45
|
+
{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"1.0.0","capabilities":{},"clientInfo":{"name":"deploy-test","version":"1.0.0"}},"id":1}
|
|
46
|
+
{"jsonrpc":"2.0","method":"tools/call","params":{"name":"mlgym_user_create","arguments":{"email":"$TEST_EMAIL","name":"$TEST_NAME","password":"$TEST_PASSWORD"}},"id":2}
|
|
47
|
+
EOF
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
echo "Calling mlgym_user_create..."
|
|
51
|
+
USER_RESPONSE=$(echo "$USER_REQUEST" | node /home/chka/NetBeansProjects/gitlab_backend/mcp-server/index.js 2>/dev/null | tail -1)
|
|
52
|
+
|
|
53
|
+
if echo "$USER_RESPONSE" | grep -q '"content"'; then
|
|
54
|
+
echo -e "${GREEN}✅ User created successfully via MCP${NC}"
|
|
55
|
+
echo "$USER_RESPONSE" | python3 -m json.tool | head -20
|
|
56
|
+
else
|
|
57
|
+
echo "❌ User creation failed"
|
|
58
|
+
echo "$USER_RESPONSE"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
echo
|
|
62
|
+
echo -e "${YELLOW}Step 3: Initializing Project with Deployment${NC}"
|
|
63
|
+
echo "---------------------------------------"
|
|
64
|
+
echo "Project Name: $PROJECT_NAME"
|
|
65
|
+
echo "Local Path: /home/chka/lab/hello-world-example"
|
|
66
|
+
echo
|
|
67
|
+
|
|
68
|
+
# Initialize project with deployment
|
|
69
|
+
PROJECT_REQUEST=$(cat <<EOF
|
|
70
|
+
{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"1.0.0","capabilities":{},"clientInfo":{"name":"deploy-test","version":"1.0.0"}},"id":1}
|
|
71
|
+
{"jsonrpc":"2.0","method":"tools/call","params":{"name":"mlgym_project_init","arguments":{"name":"$PROJECT_NAME","description":"Hello World Example deployed via MCP","enable_deployment":true,"local_path":"/home/chka/lab/hello-world-example"}},"id":3}
|
|
72
|
+
EOF
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
echo "Calling mlgym_project_init..."
|
|
76
|
+
PROJECT_RESPONSE=$(echo "$PROJECT_REQUEST" | node /home/chka/NetBeansProjects/gitlab_backend/mcp-server/index.js 2>/dev/null | tail -1)
|
|
77
|
+
|
|
78
|
+
if echo "$PROJECT_RESPONSE" | grep -q '"content"'; then
|
|
79
|
+
echo -e "${GREEN}✅ Project initialized with deployment via MCP${NC}"
|
|
80
|
+
echo "$PROJECT_RESPONSE" | python3 -m json.tool | head -30
|
|
81
|
+
|
|
82
|
+
# Extract deployment URL if available
|
|
83
|
+
DEPLOYMENT_URL=$(echo "$PROJECT_RESPONSE" | grep -o 'https://[^"]*' | grep -v gitlab | head -1)
|
|
84
|
+
if [ ! -z "$DEPLOYMENT_URL" ]; then
|
|
85
|
+
echo
|
|
86
|
+
echo -e "${GREEN}🚀 Deployment URL: $DEPLOYMENT_URL${NC}"
|
|
87
|
+
fi
|
|
88
|
+
else
|
|
89
|
+
echo "❌ Project initialization failed"
|
|
90
|
+
echo "$PROJECT_RESPONSE"
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
echo
|
|
94
|
+
echo "============================================"
|
|
95
|
+
echo "MCP Deployment Test Complete"
|
|
96
|
+
echo "============================================"
|
|
97
|
+
echo
|
|
98
|
+
echo "To use with Claude in natural language:"
|
|
99
|
+
echo "1. 'Create a user account for john@example.com'"
|
|
100
|
+
echo "2. 'Deploy my hello-world project to GitLab and Coolify'"
|
|
101
|
+
echo "3. 'Initialize a new project with deployment enabled'"
|
|
102
|
+
echo
|
|
103
|
+
echo "The MCP server translates these requests into API calls!"
|