@emplyx/mcp-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 +108 -0
- package/bin/emplyx-mcp +100 -0
- package/lib/postinstall.js +120 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# @emplyx/mcp-server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for Emplyx HR Platform. Exposes 346+ HR management tools to AI assistants like Claude.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @emplyx/mcp-server
|
|
9
|
+
# or use with npx
|
|
10
|
+
npx @emplyx/mcp-server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
### 1. Get an API Key
|
|
16
|
+
|
|
17
|
+
1. Log into your Emplyx admin panel
|
|
18
|
+
2. Go to **Settings > API Keys**
|
|
19
|
+
3. Create a new API key with the required scopes
|
|
20
|
+
|
|
21
|
+
### 2. Configure Claude Desktop
|
|
22
|
+
|
|
23
|
+
Add to your `claude_desktop_config.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"emplyx": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["@emplyx/mcp-server"],
|
|
31
|
+
"env": {
|
|
32
|
+
"EMPLYX_API_KEY": "emplyx_live_your_key_here"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Configuration File Location
|
|
40
|
+
|
|
41
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
42
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
43
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
44
|
+
|
|
45
|
+
## Environment Variables
|
|
46
|
+
|
|
47
|
+
| Variable | Required | Description |
|
|
48
|
+
|----------|----------|-------------|
|
|
49
|
+
| `EMPLYX_API_KEY` | Yes | Your Emplyx API key (format: `emplyx_live_xxx`) |
|
|
50
|
+
| `EMPLYX_API_URL` | No | API endpoint (default: production) |
|
|
51
|
+
|
|
52
|
+
## Available Tools
|
|
53
|
+
|
|
54
|
+
The server exposes tools based on your API key's scopes:
|
|
55
|
+
|
|
56
|
+
| Scope | Tools |
|
|
57
|
+
|-------|-------|
|
|
58
|
+
| `employees:read` | Search employees, get employee details |
|
|
59
|
+
| `employees:write` | Create, update, deactivate employees |
|
|
60
|
+
| `schedules:read` | List shifts, view schedules |
|
|
61
|
+
| `schedules:write` | Assign shifts, manage schedules |
|
|
62
|
+
| `absences:read` | View absence requests, balances |
|
|
63
|
+
| `absences:write` | Create/approve/reject absence requests |
|
|
64
|
+
| `clockings:read` | View time entries, timelines |
|
|
65
|
+
| `clockings:write` | Create corrections, approve requests |
|
|
66
|
+
| `documents:read` | List documents |
|
|
67
|
+
| `documents:write` | Upload, manage documents |
|
|
68
|
+
| `*` | Full access to all 346+ tools |
|
|
69
|
+
|
|
70
|
+
## Example Usage
|
|
71
|
+
|
|
72
|
+
Once configured, you can ask Claude things like:
|
|
73
|
+
|
|
74
|
+
- "Show me employees who are on vacation this week"
|
|
75
|
+
- "Create an absence request for Juan from Feb 1-5"
|
|
76
|
+
- "What are the active shifts in the company?"
|
|
77
|
+
- "Search for employees named Maria"
|
|
78
|
+
|
|
79
|
+
## Supported Platforms
|
|
80
|
+
|
|
81
|
+
- macOS (arm64, x64)
|
|
82
|
+
- Linux (x64, arm64)
|
|
83
|
+
- Windows (x64)
|
|
84
|
+
|
|
85
|
+
## Troubleshooting
|
|
86
|
+
|
|
87
|
+
### "Invalid API Key"
|
|
88
|
+
|
|
89
|
+
Ensure your API key:
|
|
90
|
+
1. Starts with `emplyx_live_`
|
|
91
|
+
2. Has not been revoked
|
|
92
|
+
3. Has the required scopes
|
|
93
|
+
|
|
94
|
+
### "Binary not found"
|
|
95
|
+
|
|
96
|
+
The package includes pre-compiled binaries. If missing:
|
|
97
|
+
1. Reinstall the package
|
|
98
|
+
2. Check if your platform is supported
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT - See [LICENSE](LICENSE) for details.
|
|
103
|
+
|
|
104
|
+
## Support
|
|
105
|
+
|
|
106
|
+
- Documentation: https://docs.emplyx.com/mcp
|
|
107
|
+
- Issues: https://github.com/emplyx/mcp-server/issues
|
|
108
|
+
- Email: support@emplyx.com
|
package/bin/emplyx-mcp
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Emplyx MCP Server CLI
|
|
10
|
+
*
|
|
11
|
+
* This script detects the current platform and executes the appropriate
|
|
12
|
+
* pre-compiled .NET binary for the Emplyx MCP server.
|
|
13
|
+
*
|
|
14
|
+
* Configuration:
|
|
15
|
+
* - EMPLYX_API_KEY: Required. Your Emplyx API key (emplyx_live_xxx)
|
|
16
|
+
* - EMPLYX_API_URL: Optional. API endpoint (default: https://api.emplyx.com)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function getPlatformBinary() {
|
|
20
|
+
const platform = os.platform();
|
|
21
|
+
const arch = os.arch();
|
|
22
|
+
|
|
23
|
+
const platformMap = {
|
|
24
|
+
'darwin-arm64': 'osx-arm64',
|
|
25
|
+
'darwin-x64': 'osx-x64',
|
|
26
|
+
'linux-x64': 'linux-x64',
|
|
27
|
+
'linux-arm64': 'linux-arm64',
|
|
28
|
+
'win32-x64': 'win-x64'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const key = `${platform}-${arch}`;
|
|
32
|
+
const dir = platformMap[key];
|
|
33
|
+
|
|
34
|
+
if (!dir) {
|
|
35
|
+
console.error(`Error: Unsupported platform: ${key}`);
|
|
36
|
+
console.error('Supported platforms: darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64');
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const ext = platform === 'win32' ? '.exe' : '';
|
|
41
|
+
const binaryName = `Emplyx.MCP${ext}`;
|
|
42
|
+
const binaryPath = path.join(__dirname, '..', 'dist', dir, binaryName);
|
|
43
|
+
|
|
44
|
+
if (!fs.existsSync(binaryPath)) {
|
|
45
|
+
console.error(`Error: Binary not found at ${binaryPath}`);
|
|
46
|
+
console.error('Please ensure the package was installed correctly.');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return binaryPath;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function checkApiKey() {
|
|
54
|
+
const apiKey = process.env.EMPLYX_API_KEY;
|
|
55
|
+
|
|
56
|
+
if (!apiKey) {
|
|
57
|
+
console.error('Error: EMPLYX_API_KEY environment variable is required');
|
|
58
|
+
console.error('');
|
|
59
|
+
console.error('To get an API key:');
|
|
60
|
+
console.error('1. Log into Emplyx admin panel');
|
|
61
|
+
console.error('2. Go to Settings > API Keys');
|
|
62
|
+
console.error('3. Create a new API key with the required scopes');
|
|
63
|
+
console.error('');
|
|
64
|
+
console.error('Usage:');
|
|
65
|
+
console.error(' EMPLYX_API_KEY=emplyx_live_xxx npx @emplyx/mcp-server');
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (!apiKey.startsWith('emplyx_live_')) {
|
|
70
|
+
console.error('Error: Invalid API key format');
|
|
71
|
+
console.error('API keys should start with "emplyx_live_"');
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Main
|
|
77
|
+
checkApiKey();
|
|
78
|
+
const binary = getPlatformBinary();
|
|
79
|
+
|
|
80
|
+
// Spawn the .NET binary with inherited stdio for MCP communication
|
|
81
|
+
const child = spawn(binary, process.argv.slice(2), {
|
|
82
|
+
stdio: 'inherit',
|
|
83
|
+
env: process.env
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
child.on('error', (err) => {
|
|
87
|
+
console.error(`Error starting MCP server: ${err.message}`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
child.on('exit', (code, signal) => {
|
|
92
|
+
if (signal) {
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
process.exit(code || 0);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Handle termination signals
|
|
99
|
+
process.on('SIGTERM', () => child.kill('SIGTERM'));
|
|
100
|
+
process.on('SIGINT', () => child.kill('SIGINT'));
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
const VERSION = '1.0.0';
|
|
10
|
+
const GITHUB_REPO = 'ezemiz/emplyx';
|
|
11
|
+
const BASE_URL = `https://github.com/${GITHUB_REPO}/releases/download/mcp-v${VERSION}`;
|
|
12
|
+
|
|
13
|
+
function getPlatformInfo() {
|
|
14
|
+
const platform = os.platform();
|
|
15
|
+
const arch = os.arch();
|
|
16
|
+
|
|
17
|
+
const platformMap = {
|
|
18
|
+
'darwin-arm64': { dir: 'osx-arm64', file: 'Emplyx.MCP' },
|
|
19
|
+
'darwin-x64': { dir: 'osx-x64', file: 'Emplyx.MCP' },
|
|
20
|
+
'linux-x64': { dir: 'linux-x64', file: 'Emplyx.MCP' },
|
|
21
|
+
'linux-arm64': { dir: 'linux-arm64', file: 'Emplyx.MCP' },
|
|
22
|
+
'win32-x64': { dir: 'win-x64', file: 'Emplyx.MCP.exe' }
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const key = `${platform}-${arch}`;
|
|
26
|
+
return platformMap[key];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function downloadFile(url, dest) {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
const file = fs.createWriteStream(dest);
|
|
32
|
+
|
|
33
|
+
const request = (url) => {
|
|
34
|
+
https.get(url, (response) => {
|
|
35
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
36
|
+
// Follow redirect
|
|
37
|
+
request(response.headers.location);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (response.statusCode !== 200) {
|
|
42
|
+
reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const totalSize = parseInt(response.headers['content-length'], 10);
|
|
47
|
+
let downloadedSize = 0;
|
|
48
|
+
|
|
49
|
+
response.on('data', (chunk) => {
|
|
50
|
+
downloadedSize += chunk.length;
|
|
51
|
+
const percent = ((downloadedSize / totalSize) * 100).toFixed(1);
|
|
52
|
+
process.stdout.write(`\rDownloading Emplyx MCP Server... ${percent}%`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
response.pipe(file);
|
|
56
|
+
|
|
57
|
+
file.on('finish', () => {
|
|
58
|
+
file.close();
|
|
59
|
+
console.log('\nDownload complete!');
|
|
60
|
+
resolve();
|
|
61
|
+
});
|
|
62
|
+
}).on('error', (err) => {
|
|
63
|
+
fs.unlink(dest, () => {});
|
|
64
|
+
reject(err);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
request(url);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function main() {
|
|
73
|
+
const platformInfo = getPlatformInfo();
|
|
74
|
+
|
|
75
|
+
if (!platformInfo) {
|
|
76
|
+
console.log('Unsupported platform. Skipping binary download.');
|
|
77
|
+
console.log('You can manually download the binary from:');
|
|
78
|
+
console.log(` ${BASE_URL}`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const distDir = path.join(__dirname, '..', 'dist', platformInfo.dir);
|
|
83
|
+
const binaryPath = path.join(distDir, platformInfo.file);
|
|
84
|
+
|
|
85
|
+
// Check if binary already exists
|
|
86
|
+
if (fs.existsSync(binaryPath)) {
|
|
87
|
+
console.log('Emplyx MCP Server binary already installed.');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
console.log(`Installing Emplyx MCP Server for ${os.platform()}-${os.arch()}...`);
|
|
92
|
+
|
|
93
|
+
// Create dist directory
|
|
94
|
+
fs.mkdirSync(distDir, { recursive: true });
|
|
95
|
+
|
|
96
|
+
// Download binary (filename: emplyx-mcp-{platform} or emplyx-mcp-{platform}.exe)
|
|
97
|
+
const ext = os.platform() === 'win32' ? '.exe' : '';
|
|
98
|
+
const url = `${BASE_URL}/emplyx-mcp-${platformInfo.dir}${ext}`;
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
await downloadFile(url, binaryPath);
|
|
102
|
+
|
|
103
|
+
// Make executable on Unix
|
|
104
|
+
if (os.platform() !== 'win32') {
|
|
105
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
console.log('Emplyx MCP Server installed successfully!');
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error(`\nFailed to download binary: ${error.message}`);
|
|
111
|
+
console.error('You can manually download from:');
|
|
112
|
+
console.error(` https://github.com/${GITHUB_REPO}/releases`);
|
|
113
|
+
process.exit(0); // Don't fail the install
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
main().catch((err) => {
|
|
118
|
+
console.error('Installation error:', err.message);
|
|
119
|
+
process.exit(0); // Don't fail the install
|
|
120
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@emplyx/mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP Server for Emplyx HR Platform - Access 346+ HR management tools via Model Context Protocol",
|
|
5
|
+
"bin": {
|
|
6
|
+
"emplyx-mcp": "./bin/emplyx-mcp"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node lib/postinstall.js || true"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"mcp",
|
|
13
|
+
"emplyx",
|
|
14
|
+
"hr",
|
|
15
|
+
"human-resources",
|
|
16
|
+
"claude",
|
|
17
|
+
"anthropic",
|
|
18
|
+
"ai",
|
|
19
|
+
"model-context-protocol"
|
|
20
|
+
],
|
|
21
|
+
"author": "Emplyx <dev@emplyx.com>",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18.0.0"
|
|
25
|
+
},
|
|
26
|
+
"os": [
|
|
27
|
+
"darwin",
|
|
28
|
+
"linux",
|
|
29
|
+
"win32"
|
|
30
|
+
],
|
|
31
|
+
"cpu": [
|
|
32
|
+
"x64",
|
|
33
|
+
"arm64"
|
|
34
|
+
],
|
|
35
|
+
"files": [
|
|
36
|
+
"bin/",
|
|
37
|
+
"lib/",
|
|
38
|
+
"README.md"
|
|
39
|
+
],
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/ezemiz/emplyx"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://emplyx.com",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/ezemiz/emplyx/issues"
|
|
47
|
+
}
|
|
48
|
+
}
|