uer-mcp 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/bin/uer-mcp.js ADDED
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn, execSync } = require('child_process');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+
7
+ function findPython() {
8
+ try {
9
+ // Try to find python in PATH
10
+ const pythonCmd = process.platform === 'win32' ? 'where python' : 'which python3 || which python';
11
+ const result = execSync(pythonCmd, { encoding: 'utf8' }).trim();
12
+ return result.split('\n')[0]; // Take first result
13
+ } catch {
14
+ throw new Error('Python not found. Please install Python 3.11+ from https://www.python.org/downloads/');
15
+ }
16
+ }
17
+
18
+ function findUv() {
19
+ try {
20
+ const uvCmd = process.platform === 'win32' ? 'where uv' : 'which uv';
21
+ const result = execSync(uvCmd, { encoding: 'utf8' }).trim();
22
+ return result.split('\n')[0];
23
+ } catch {
24
+ return '';
25
+ }
26
+ }
27
+
28
+ function checkPythonVersion(pythonPath) {
29
+ try {
30
+ const version = execSync(`"${pythonPath}" --version`, { encoding: 'utf8' });
31
+ const match = version.match(/Python (\d+)\.(\d+)/);
32
+ if (match) {
33
+ const major = parseInt(match[1]);
34
+ const minor = parseInt(match[2]);
35
+ if (major >= 3 && minor >= 11) {
36
+ return true;
37
+ }
38
+ }
39
+ return false;
40
+ } catch {
41
+ return false;
42
+ }
43
+ }
44
+
45
+ async function main() {
46
+ const pythonDir = path.join(__dirname, '..', 'python');
47
+ const serverPath = path.join(pythonDir, 'src', 'uer', 'server.py');
48
+
49
+ // Check if Python source exists
50
+ if (!fs.existsSync(serverPath)) {
51
+ console.error('Error: UER server files not found.');
52
+ console.error('This package may be corrupted. Please try reinstalling:');
53
+ console.error(' npm uninstall -g @uer/mcp');
54
+ console.error(' npx @uer/mcp@latest');
55
+ process.exit(1);
56
+ }
57
+
58
+ const python = findPython();
59
+
60
+ if (!checkPythonVersion(python)) {
61
+ console.error('Error: Python 3.11 or higher is required.');
62
+ console.error('Please install Python 3.11+ from https://www.python.org/downloads/');
63
+ process.exit(1);
64
+ }
65
+
66
+ const uv = findUv();
67
+
68
+ let command, args;
69
+
70
+ if (uv) {
71
+ // Use uv if available (recommended)
72
+ console.error('Starting UER MCP server with uv...');
73
+ command = uv;
74
+ args = ['--directory', pythonDir, 'run', 'python', '-m', 'uer.server'];
75
+ } else {
76
+ // Fallback to direct python
77
+ console.error('Starting UER MCP server with python...');
78
+ console.error('Tip: Install uv for better dependency management: https://docs.astral.sh/uv/');
79
+ command = python;
80
+ args = ['-m', 'uer.server'];
81
+ }
82
+
83
+ const child = spawn(command, args, {
84
+ stdio: 'inherit',
85
+ cwd: pythonDir,
86
+ env: process.env // Preserve user's API keys
87
+ });
88
+
89
+ child.on('error', (error) => {
90
+ console.error('Failed to start UER server:', error.message);
91
+ console.error('\nTroubleshooting:');
92
+ console.error('1. Ensure Python 3.11+ is installed');
93
+ console.error('2. Install uv: pip install uv');
94
+ console.error('3. Check that API keys are set in environment');
95
+ process.exit(1);
96
+ });
97
+
98
+ child.on('exit', (code) => {
99
+ if (code !== 0 && code !== null) {
100
+ console.error(`\nUER server exited with code ${code}`);
101
+ }
102
+ process.exit(code || 0);
103
+ });
104
+
105
+ // Handle Ctrl+C gracefully
106
+ process.on('SIGINT', () => {
107
+ child.kill('SIGINT');
108
+ });
109
+
110
+ process.on('SIGTERM', () => {
111
+ child.kill('SIGTERM');
112
+ });
113
+ }
114
+
115
+ main().catch((error) => {
116
+ console.error('Fatal error:', error.message);
117
+ process.exit(1);
118
+ });
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "uer-mcp",
3
+ "version": "1.0.0",
4
+ "description": "Universal Expert Registry - Multi-LLM MCP Server",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "uer-mcp": "./bin/uer-mcp.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "dist/",
12
+ "python/",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "prepare": "npm run build",
18
+ "build": "python scripts/build_python.py",
19
+ "prepack": "npm run build",
20
+ "test": "node scripts/test_package.js"
21
+ },
22
+ "keywords": [
23
+ "mcp",
24
+ "llm",
25
+ "anthropic",
26
+ "openai",
27
+ "gemini",
28
+ "claude",
29
+ "chatgpt",
30
+ "ai",
31
+ "model-context-protocol"
32
+ ],
33
+ "author": "Margus Martsepp <margusmartsepp@gmail.com>",
34
+ "license": "MIT",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/margusmartsepp/UER.git"
38
+ },
39
+ "bugs": {
40
+ "url": "https://github.com/margusmartsepp/UER/issues"
41
+ },
42
+ "homepage": "https://github.com/margusmartsepp/UER#readme",
43
+ "engines": {
44
+ "node": ">=14.0.0"
45
+ }
46
+ }