praglife-form-builder-server 1.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/README.md +45 -0
- package/bin/darwin-amd64/server +0 -0
- package/bin/darwin-arm64/server +0 -0
- package/bin/linux-amd64/server +0 -0
- package/bin/linux-arm64/server +0 -0
- package/bin/windows-amd64/server.exe +0 -0
- package/bin/windows-arm64/server.exe +0 -0
- package/index.js +60 -0
- package/package.json +31 -0
- package/scripts/build.js +43 -0
- package/scripts/install.js +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# PragLife Form Builder MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server for building healthcare forms with validation and business rules.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx praglife-form-builder-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install globally:
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g praglife-form-builder-mcp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Configuration
|
|
17
|
+
|
|
18
|
+
Add to your MCP config:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"praglife-form-builder": {
|
|
23
|
+
"command": "npx",
|
|
24
|
+
"args": ["-y", "praglife-form-builder-mcp"],
|
|
25
|
+
"disabled": false
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- Generate complete form definitions
|
|
33
|
+
- Validate form structure
|
|
34
|
+
- Business rule expressions
|
|
35
|
+
- Field type validation
|
|
36
|
+
- Healthcare-specific components
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Requirements
|
|
40
|
+
|
|
41
|
+
- Node.js >= 14.0.0
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
function getBinaryPath() {
|
|
8
|
+
const platform = os.platform();
|
|
9
|
+
const arch = os.arch();
|
|
10
|
+
|
|
11
|
+
// Map platform/arch to binary directory names
|
|
12
|
+
let binaryDir;
|
|
13
|
+
if (platform === 'darwin') {
|
|
14
|
+
if (arch === 'arm64') binaryDir = 'darwin-arm64';
|
|
15
|
+
else binaryDir = 'darwin-amd64';
|
|
16
|
+
} else if (platform === 'linux') {
|
|
17
|
+
if (arch === 'arm64') binaryDir = 'linux-arm64';
|
|
18
|
+
else binaryDir = 'linux-amd64';
|
|
19
|
+
} else if (platform === 'win32') {
|
|
20
|
+
if (arch === 'arm64') binaryDir = 'windows-arm64';
|
|
21
|
+
else binaryDir = 'windows-amd64';
|
|
22
|
+
} else {
|
|
23
|
+
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const binaryName = platform === 'win32' ? 'server.exe' : 'server';
|
|
28
|
+
return path.join(__dirname, 'bin', binaryDir, binaryName);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function startServer() {
|
|
32
|
+
const binaryPath = getBinaryPath();
|
|
33
|
+
const server = spawn(binaryPath, process.argv.slice(2), {
|
|
34
|
+
stdio: 'inherit'
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
server.on('error', (error) => {
|
|
38
|
+
if (error.code === 'ENOENT') {
|
|
39
|
+
console.error('Binary not found. Please run: npm run build');
|
|
40
|
+
} else {
|
|
41
|
+
console.error('Failed to start server:', error);
|
|
42
|
+
}
|
|
43
|
+
process.exit(1);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
server.on('close', (code) => {
|
|
47
|
+
process.exit(code);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Handle SIGINT and SIGTERM
|
|
52
|
+
process.on('SIGINT', () => {
|
|
53
|
+
process.exit(0);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
process.on('SIGTERM', () => {
|
|
57
|
+
process.exit(0);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
startServer();
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "praglife-form-builder-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "PragLife Form Builder MCP Server",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"praglife-form-builder-mcp": "index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"index.js",
|
|
12
|
+
"scripts/",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"postinstall": "node scripts/install.js",
|
|
17
|
+
"build": "node scripts/build.js",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"mcp",
|
|
22
|
+
"form-builder",
|
|
23
|
+
"praglife",
|
|
24
|
+
"healthcare"
|
|
25
|
+
],
|
|
26
|
+
"author": "PragLife",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=14.0.0"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/scripts/build.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
// Create bin directory structure
|
|
8
|
+
const binDir = path.join(__dirname, '../bin');
|
|
9
|
+
const platforms = [
|
|
10
|
+
{ os: 'darwin', arch: 'amd64', output: 'darwin-amd64/server' },
|
|
11
|
+
{ os: 'darwin', arch: 'arm64', output: 'darwin-arm64/server' },
|
|
12
|
+
{ os: 'linux', arch: 'amd64', output: 'linux-amd64/server' },
|
|
13
|
+
{ os: 'linux', arch: 'arm64', output: 'linux-arm64/server' },
|
|
14
|
+
{ os: 'windows', arch: 'amd64', output: 'windows-amd64/server.exe' },
|
|
15
|
+
{ os: 'windows', arch: 'arm64', output: 'windows-arm64/server.exe' }
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
console.log('Building Go MCP server for multiple platforms...');
|
|
19
|
+
|
|
20
|
+
// Ensure bin directory exists
|
|
21
|
+
if (!fs.existsSync(binDir)) {
|
|
22
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Build for each platform
|
|
26
|
+
platforms.forEach(({ os, arch, output }) => {
|
|
27
|
+
const outputDir = path.dirname(path.join(binDir, output));
|
|
28
|
+
if (!fs.existsSync(outputDir)) {
|
|
29
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log(`Building for ${os}-${arch}...`);
|
|
33
|
+
try {
|
|
34
|
+
execSync(`GOOS=${os} GOARCH=${arch} go build -o ${path.join(binDir, output)} ../main.go`, {
|
|
35
|
+
stdio: 'inherit'
|
|
36
|
+
});
|
|
37
|
+
console.log(`✓ Built ${os}-${arch}`);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(`✗ Failed to build for ${os}-${arch}:`, error.message);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
console.log('\nBuild complete!');
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
function getPlatform() {
|
|
7
|
+
const platform = process.platform;
|
|
8
|
+
const arch = process.arch;
|
|
9
|
+
|
|
10
|
+
if (platform === 'darwin') {
|
|
11
|
+
return arch === 'arm64' ? 'darwin-arm64' : 'darwin-amd64';
|
|
12
|
+
} else if (platform === 'linux') {
|
|
13
|
+
return arch === 'arm64' ? 'linux-arm64' : 'linux-amd64';
|
|
14
|
+
} else if (platform === 'win32') {
|
|
15
|
+
return arch === 'arm64' ? 'windows-arm64' : 'windows-amd64';
|
|
16
|
+
}
|
|
17
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function checkBinaryExists() {
|
|
21
|
+
const platform = getPlatform();
|
|
22
|
+
const binaryPath = path.join(__dirname, '../bin', platform, process.platform === 'win32' ? 'server.exe' : 'server');
|
|
23
|
+
return fs.existsSync(binaryPath);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Check if binary exists, if not try to download
|
|
27
|
+
if (!checkBinaryExists()) {
|
|
28
|
+
console.log('Binary not found for your platform.');
|
|
29
|
+
console.log('Please run "npm run build" from the source repository.');
|
|
30
|
+
console.log('Or download pre-built binaries from releases.');
|
|
31
|
+
}
|