agentek-youtrack-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.
Files changed (44) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +332 -0
  3. package/README.npm.md +436 -0
  4. package/dist/bin/youtrack-mcp.js +158 -0
  5. package/dist/index.js +129 -0
  6. package/dist/python/main.py +74 -0
  7. package/dist/python/requirements.txt +13 -0
  8. package/dist/python/youtrack_mcp/__init__.py +5 -0
  9. package/dist/python/youtrack_mcp/__pycache__/__init__.cpython-311.pyc +0 -0
  10. package/dist/python/youtrack_mcp/__pycache__/version.cpython-311.pyc +0 -0
  11. package/dist/python/youtrack_mcp/api/__init__.py +3 -0
  12. package/dist/python/youtrack_mcp/api/articles.py +317 -0
  13. package/dist/python/youtrack_mcp/api/client.py +466 -0
  14. package/dist/python/youtrack_mcp/api/issues.py +3008 -0
  15. package/dist/python/youtrack_mcp/api/mcp_wrappers.py +304 -0
  16. package/dist/python/youtrack_mcp/api/projects.py +1009 -0
  17. package/dist/python/youtrack_mcp/api/search.py +244 -0
  18. package/dist/python/youtrack_mcp/api/spaces.py +46 -0
  19. package/dist/python/youtrack_mcp/api/users.py +149 -0
  20. package/dist/python/youtrack_mcp/config.py +273 -0
  21. package/dist/python/youtrack_mcp/mcp_server.py +158 -0
  22. package/dist/python/youtrack_mcp/mcp_wrappers.py +324 -0
  23. package/dist/python/youtrack_mcp/tools/__init__.py +8 -0
  24. package/dist/python/youtrack_mcp/tools/articles.py +487 -0
  25. package/dist/python/youtrack_mcp/tools/create_project_tool.py +51 -0
  26. package/dist/python/youtrack_mcp/tools/issues/__init__.py +208 -0
  27. package/dist/python/youtrack_mcp/tools/issues/attachments.py +161 -0
  28. package/dist/python/youtrack_mcp/tools/issues/basic_operations.py +322 -0
  29. package/dist/python/youtrack_mcp/tools/issues/custom_fields.py +365 -0
  30. package/dist/python/youtrack_mcp/tools/issues/dedicated_updates.py +601 -0
  31. package/dist/python/youtrack_mcp/tools/issues/diagnostics.py +363 -0
  32. package/dist/python/youtrack_mcp/tools/issues/linking.py +283 -0
  33. package/dist/python/youtrack_mcp/tools/issues/utilities.py +291 -0
  34. package/dist/python/youtrack_mcp/tools/loader.py +383 -0
  35. package/dist/python/youtrack_mcp/tools/projects.py +826 -0
  36. package/dist/python/youtrack_mcp/tools/projects.py-e +411 -0
  37. package/dist/python/youtrack_mcp/tools/resources.py +744 -0
  38. package/dist/python/youtrack_mcp/tools/search.py +297 -0
  39. package/dist/python/youtrack_mcp/tools/spaces.py +69 -0
  40. package/dist/python/youtrack_mcp/tools/users.py +185 -0
  41. package/dist/python/youtrack_mcp/utils.py +87 -0
  42. package/dist/python/youtrack_mcp/version.py +5 -0
  43. package/package.json +61 -0
  44. package/requirements.txt +13 -0
package/README.npm.md ADDED
@@ -0,0 +1,436 @@
1
+ # YouTrack MCP Server
2
+
3
+ [![npm version](https://badge.fury.io/js/agentek-youtrack-mcp.svg)](https://www.npmjs.com/package/agentek-youtrack-mcp)
4
+ [![npm downloads](https://img.shields.io/npm/dm/agentek-youtrack-mcp.svg)](https://www.npmjs.com/package/agentek-youtrack-mcp)
5
+
6
+ A Model Context Protocol (MCP) server for JetBrains YouTrack, enabling seamless integration with Claude Desktop and other MCP clients.
7
+
8
+ ## Quick Start
9
+
10
+ Choose your preferred installation method:
11
+
12
+ ### Option 1: npm/Node.js (Recommended)
13
+
14
+ **Installation:**
15
+ ```bash
16
+ # Install globally
17
+ npm install -g agentek-youtrack-mcp
18
+
19
+ # Or use with npx (no installation required)
20
+ npx agentek-youtrack-mcp
21
+ ```
22
+
23
+ **Usage:**
24
+ ```bash
25
+ # Run with stdio transport (for Claude Desktop)
26
+ npx agentek-youtrack-mcp
27
+
28
+ # Run with HTTP transport
29
+ npx agentek-youtrack-mcp --http --port 8000
30
+
31
+ # Show help
32
+ npx agentek-youtrack-mcp --help
33
+ ```
34
+
35
+ ### Option 2: Docker
36
+
37
+ **Using Docker Hub:**
38
+ ```bash
39
+ # Use the latest stable release
40
+ docker run --rm \
41
+ -e YOUTRACK_URL="https://your.youtrack.cloud" \
42
+ -e YOUTRACK_API_TOKEN="your-token" \
43
+ windbit/agentek-youtrack-mcp:latest
44
+
45
+ # Or use the latest development build
46
+ docker run --rm \
47
+ -e YOUTRACK_URL="https://your.youtrack.cloud" \
48
+ -e YOUTRACK_API_TOKEN="your-token" \
49
+ windbit/agentek-youtrack-mcp:1.11.1_wip
50
+ ```
51
+
52
+ **Available Docker Tags:**
53
+ - `latest` - Latest stable release
54
+ - `1.11.1` - Specific version tags
55
+ - `1.11.1_wip` - Work-in-progress builds from main branch
56
+ - `pr-<number>` - Pull request builds for testing
57
+
58
+ ## Configuration
59
+
60
+ ### Environment Variables
61
+
62
+ Set these environment variables for both npm and Docker options:
63
+
64
+ ```bash
65
+ export YOUTRACK_URL="https://your.youtrack.cloud"
66
+ export YOUTRACK_API_TOKEN="your-token"
67
+ export YOUTRACK_VERIFY_SSL="true" # Optional, default: true
68
+ ```
69
+
70
+ ### Claude Desktop Integration
71
+
72
+ Choose your preferred method:
73
+
74
+ #### Using npm/Node.js:
75
+ ```json
76
+ {
77
+ "mcpServers": {
78
+ "youtrack": {
79
+ "command": "npx",
80
+ "args": ["agentek-youtrack-mcp"],
81
+ "env": {
82
+ "YOUTRACK_URL": "https://your.youtrack.cloud",
83
+ "YOUTRACK_API_TOKEN": "your-token"
84
+ }
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ #### Using Docker Hub:
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "youtrack": {
95
+ "command": "docker",
96
+ "args": [
97
+ "run", "--rm",
98
+ "-e", "YOUTRACK_URL=https://your.youtrack.cloud",
99
+ "-e", "YOUTRACK_API_TOKEN=your-token",
100
+ "windbit/agentek-youtrack-mcp:latest"
101
+ ]
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ #### Using GitHub Container Registry:
108
+ ```json
109
+ {
110
+ "mcpServers": {
111
+ "youtrack": {
112
+ "command": "docker",
113
+ "args": [
114
+ "run", "--rm",
115
+ "-e", "YOUTRACK_URL=https://your.youtrack.cloud",
116
+ "-e", "YOUTRACK_API_TOKEN=your-token",
117
+ "ghcr.io/windbit/agentek-youtrack-mcp:latest"
118
+ ]
119
+ }
120
+ }
121
+ }
122
+ ```
123
+
124
+ #### Using GitHub Packages npm:
125
+ ```json
126
+ {
127
+ "mcpServers": {
128
+ "youtrack": {
129
+ "command": "npx",
130
+ "args": ["@windbit/agentek-youtrack-mcp"],
131
+ "env": {
132
+ "YOUTRACK_URL": "https://your.youtrack.cloud",
133
+ "YOUTRACK_API_TOKEN": "your-token"
134
+ }
135
+ }
136
+ }
137
+ }
138
+ ```
139
+
140
+ ## Features
141
+
142
+ - **Issue Management**: Create, read, update, and delete YouTrack issues
143
+ - **Project Management**: Access project information and custom fields
144
+ - **Search Capabilities**: Advanced search with filters and custom fields
145
+ - **User Management**: Retrieve user information and permissions
146
+ - **Attachment Support**: Download, process, and delete issue attachments (up to 10MB)
147
+ - **Multi-Platform Support**: ARM64/Apple Silicon and AMD64 architecture support
148
+
149
+ ## Requirements
150
+
151
+ ### For npm/Node.js option:
152
+ - **Node.js**: 18.0.0 or higher
153
+ - **Python**: 3.8 or higher (automatically detected)
154
+ - **YouTrack**: Cloud or Server instance with API access
155
+
156
+ ### For Docker option:
157
+ - **Docker**: Latest version
158
+ - **YouTrack**: Cloud or Server instance with API access
159
+
160
+ *Note: Docker option includes all dependencies pre-installed*
161
+
162
+ ## API Commands
163
+
164
+ Once configured, you can use these commands in Claude:
165
+
166
+ - Create, update, and manage YouTrack issues
167
+ - Search issues with advanced filters
168
+ - Access project information and custom fields
169
+ - Download, analyze, and delete issue attachments
170
+ - Manage user permissions and assignments
171
+
172
+ ## CLI Options
173
+
174
+ ```
175
+ Usage:
176
+ npx agentek-youtrack-mcp [options] [-- server-args]
177
+
178
+ Options:
179
+ --help, -h Show help message
180
+ --version, -v Show version information
181
+ --info Show server information
182
+ --stdio Use stdio transport (default)
183
+ --http Use HTTP transport
184
+ --host <host> Host to bind HTTP server (default: 0.0.0.0)
185
+ --port <port> Port for HTTP server (default: 8000)
186
+
187
+ Environment Variables:
188
+ YOUTRACK_URL Your YouTrack instance URL (required)
189
+ YOUTRACK_API_TOKEN Your YouTrack API token (required)
190
+ YOUTRACK_VERIFY_SSL Verify SSL certificates (default: true)
191
+ ```
192
+
193
+ ## Examples
194
+
195
+ ### Basic Usage
196
+
197
+ #### npm/Node.js:
198
+ ```bash
199
+ # Set environment variables
200
+ export YOUTRACK_URL="https://prodcamp.youtrack.cloud"
201
+ export YOUTRACK_API_TOKEN="your-token"
202
+
203
+ # Run the server
204
+ npx agentek-youtrack-mcp
205
+ ```
206
+
207
+ #### Docker Hub:
208
+ ```bash
209
+ # Run with environment variables
210
+ docker run --rm \
211
+ -e YOUTRACK_URL="https://prodcamp.youtrack.cloud" \
212
+ -e YOUTRACK_API_TOKEN="your-token" \
213
+ windbit/agentek-youtrack-mcp:latest
214
+ ```
215
+
216
+ #### GitHub Container Registry:
217
+ ```bash
218
+ # Run with environment variables
219
+ docker run --rm \
220
+ -e YOUTRACK_URL="https://prodcamp.youtrack.cloud" \
221
+ -e YOUTRACK_API_TOKEN="your-token" \
222
+ ghcr.io/windbit/agentek-youtrack-mcp:latest
223
+ ```
224
+
225
+ #### GitHub Packages npm:
226
+ ```bash
227
+ # Set up GitHub registry (one-time setup)
228
+ npm config set @windbit:registry https://npm.pkg.github.com
229
+
230
+ # Run with npx
231
+ npx @windbit/agentek-youtrack-mcp
232
+ ```
233
+
234
+ ### HTTP Mode
235
+
236
+ #### npm/Node.js:
237
+ ```bash
238
+ # Start HTTP server on port 8000
239
+ npx agentek-youtrack-mcp --http --port 8000
240
+
241
+ # Test the server
242
+ curl http://localhost:8000/api/tools
243
+ ```
244
+
245
+ #### Docker Hub:
246
+ ```bash
247
+ # Start HTTP server with port mapping
248
+ docker run --rm -p 8000:8000 \
249
+ -e YOUTRACK_URL="https://prodcamp.youtrack.cloud" \
250
+ -e YOUTRACK_API_TOKEN="your-token" \
251
+ windbit/agentek-youtrack-mcp:latest --transport http --host 0.0.0.0
252
+
253
+ # Test the server
254
+ curl http://localhost:8000/api/tools
255
+ ```
256
+
257
+ #### GitHub Container Registry:
258
+ ```bash
259
+ # Start HTTP server with port mapping
260
+ docker run --rm -p 8000:8000 \
261
+ -e YOUTRACK_URL="https://prodcamp.youtrack.cloud" \
262
+ -e YOUTRACK_API_TOKEN="your-token" \
263
+ ghcr.io/windbit/agentek-youtrack-mcp:latest --transport http --host 0.0.0.0
264
+
265
+ # Test the server
266
+ curl http://localhost:8000/api/tools
267
+ ```
268
+
269
+ #### GitHub Packages npm:
270
+ ```bash
271
+ # Start HTTP server
272
+ npx @windbit/agentek-youtrack-mcp --http --port 8000
273
+
274
+ # Test the server
275
+ curl http://localhost:8000/api/tools
276
+ ```
277
+
278
+ ### Development Mode
279
+
280
+ #### npm/Node.js:
281
+ ```bash
282
+ # Run with debug logging
283
+ npx agentek-youtrack-mcp -- --log-level DEBUG
284
+ ```
285
+
286
+ #### Docker Hub:
287
+ ```bash
288
+ # Run with debug logging
289
+ docker run --rm \
290
+ -e YOUTRACK_URL="https://prodcamp.youtrack.cloud" \
291
+ -e YOUTRACK_API_TOKEN="your-token" \
292
+ windbit/agentek-youtrack-mcp:latest --log-level DEBUG
293
+ ```
294
+
295
+ #### GitHub Container Registry:
296
+ ```bash
297
+ # Run with debug logging
298
+ docker run --rm \
299
+ -e YOUTRACK_URL="https://prodcamp.youtrack.cloud" \
300
+ -e YOUTRACK_API_TOKEN="your-token" \
301
+ ghcr.io/windbit/agentek-youtrack-mcp:latest --log-level DEBUG
302
+ ```
303
+
304
+ #### GitHub Packages npm:
305
+ ```bash
306
+ # Run with debug logging
307
+ npx @windbit/agentek-youtrack-mcp -- --log-level DEBUG
308
+ ```
309
+
310
+ ## Troubleshooting
311
+
312
+ ### npm/Node.js Issues
313
+
314
+ #### Python Not Found
315
+ If you get a "Python not found" error:
316
+
317
+ ```bash
318
+ # Install Python 3.8+
319
+ # macOS with Homebrew:
320
+ brew install python
321
+
322
+ # Ubuntu/Debian:
323
+ sudo apt-get install python3
324
+
325
+ # Windows: Download from python.org
326
+ ```
327
+
328
+ #### Permission Errors
329
+ ```bash
330
+ # Check your YouTrack API token
331
+ npx agentek-youtrack-mcp --info
332
+
333
+ # Verify your environment variables
334
+ echo $YOUTRACK_URL
335
+ echo $YOUTRACK_API_TOKEN
336
+ ```
337
+
338
+ ### Docker Issues
339
+
340
+ #### Container Won't Start
341
+ ```bash
342
+ # Check Docker is running
343
+ docker --version
344
+
345
+ # Check container logs
346
+ docker run --rm \
347
+ -e YOUTRACK_URL="https://your.youtrack.cloud" \
348
+ -e YOUTRACK_API_TOKEN="your-token" \
349
+ windbit/agentek-youtrack-mcp:latest --version
350
+ ```
351
+
352
+ #### Port Already in Use
353
+ ```bash
354
+ # Use a different port
355
+ docker run --rm -p 8001:8000 \
356
+ -e YOUTRACK_URL="https://your.youtrack.cloud" \
357
+ -e YOUTRACK_API_TOKEN="your-token" \
358
+ windbit/agentek-youtrack-mcp:latest --transport http
359
+ ```
360
+
361
+ #### GitHub Container Registry Authentication
362
+ ```bash
363
+ # If you get pull errors from ghcr.io, you might need to authenticate
364
+ docker login ghcr.io
365
+
366
+ # Then try pulling again
367
+ docker pull ghcr.io/windbit/agentek-youtrack-mcp:latest
368
+ ```
369
+
370
+ ### GitHub Packages Issues
371
+
372
+ #### npm Registry Configuration
373
+ ```bash
374
+ # If @windbit/agentek-youtrack-mcp is not found, configure the registry
375
+ npm config set @windbit:registry https://npm.pkg.github.com
376
+
377
+ # You might need authentication for GitHub Packages npm
378
+ npm login --registry=https://npm.pkg.github.com
379
+ ```
380
+
381
+ #### Package Not Found
382
+ If GitHub Packages npm shows "package not found":
383
+ - The package is published only on releases
384
+ - Check if a release has been created
385
+ - Fallback to npmjs.org version: `npm install -g agentek-youtrack-mcp`
386
+
387
+ ### Common Issues (Both Options)
388
+
389
+ #### Connection Issues
390
+ If you can't connect to YouTrack:
391
+
392
+ - Verify your YouTrack URL is correct
393
+ - Check that your API token has proper permissions
394
+ - Ensure your network allows connections to YouTrack
395
+ - Try testing the API token manually:
396
+ ```bash
397
+ curl -H "Authorization: Bearer your-token" \
398
+ "https://your.youtrack.cloud/api/admin/projects"
399
+ ```
400
+
401
+ ## Which Option Should I Choose?
402
+
403
+ ### Choose **npm/Node.js** if you:
404
+ - āœ… Already have Node.js installed
405
+ - āœ… Want faster startup times
406
+ - āœ… Prefer lighter resource usage
407
+ - āœ… Need to modify or debug the server
408
+
409
+ **Registry Options:**
410
+ - **npmjs.org** (recommended): `agentek-youtrack-mcp` - Better discovery, wider usage
411
+ - **GitHub Packages**: `@windbit/agentek-youtrack-mcp` - Integrated with GitHub, requires registry config
412
+
413
+ ### Choose **Docker** if you:
414
+ - āœ… Want isolated, consistent environments
415
+ - āœ… Don't want to install Node.js/Python
416
+ - āœ… Are running in containerized infrastructure
417
+ - āœ… Want guaranteed dependency compatibility
418
+
419
+ **Registry Options:**
420
+ - **Docker Hub** (recommended): `windbit/agentek-youtrack-mcp` - Faster, no auth required
421
+ - **GitHub Container Registry**: `ghcr.io/windbit/agentek-youtrack-mcp` - Integrated with GitHub, may require auth
422
+
423
+ ## Support
424
+
425
+ - **GitHub**: [Issues and bug reports](https://github.com/windbit/agentek-youtrack-mcp/issues)
426
+ - **Documentation**: [Full documentation](https://github.com/windbit/agentek-youtrack-mcp)
427
+
428
+ ### Package Registries
429
+ - **Docker Hub**: [windbit/agentek-youtrack-mcp](https://hub.docker.com/r/windbit/agentek-youtrack-mcp)
430
+ - **GitHub Container Registry**: [ghcr.io/windbit/agentek-youtrack-mcp](https://github.com/windbit/agentek-youtrack-mcp/pkgs/container/youtrack-mcp)
431
+ - **npmjs.org**: [agentek-youtrack-mcp](https://www.npmjs.com/package/agentek-youtrack-mcp)
432
+ - **GitHub Packages npm**: [@windbit/agentek-youtrack-mcp](https://github.com/windbit/agentek-youtrack-mcp/pkgs/npm/%40windbit%2Fagentek-youtrack-mcp)
433
+
434
+ ## License
435
+
436
+ MIT
@@ -0,0 +1,158 @@
1
+ #!/usr/bin/env node
2
+
3
+ import YouTrackMCPServer from '../index.js';
4
+ import { readFileSync } from 'fs';
5
+ import { fileURLToPath } from 'url';
6
+ import { dirname, join } from 'path';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
10
+
11
+ /**
12
+ * YouTrack MCP Server CLI
13
+ *
14
+ * This CLI tool allows you to run the YouTrack MCP server from the command line
15
+ * after installing it via npm.
16
+ */
17
+
18
+ function showHelp() {
19
+ console.log(`
20
+ šŸ“‹ YouTrack MCP Server CLI
21
+
22
+ Usage:
23
+ npx agentek-youtrack-mcp [options] [-- server-args]
24
+ agentek-youtrack-mcp [options] [-- server-args]
25
+
26
+ Options:
27
+ --help, -h Show this help message
28
+ --version, -v Show version information
29
+ --info Show server information
30
+ --stdio Use stdio transport (default)
31
+ --http Use HTTP transport with --host and --port
32
+ --host <host> Host to bind HTTP server (default: 0.0.0.0)
33
+ --port <port> Port for HTTP server (default: 8000)
34
+
35
+ Environment Variables:
36
+ YOUTRACK_URL Your YouTrack instance URL (required)
37
+ YOUTRACK_API_TOKEN Your YouTrack API token (required)
38
+ YOUTRACK_VERIFY_SSL Verify SSL certificates (default: true)
39
+
40
+ Examples:
41
+ # Run with stdio transport (for Claude Desktop)
42
+ npx agentek-youtrack-mcp
43
+
44
+ # Run with HTTP transport
45
+ npx agentek-youtrack-mcp --http --port 8000
46
+
47
+ # Pass arguments to the Python server
48
+ npx agentek-youtrack-mcp -- --log-level DEBUG
49
+
50
+ # Set environment variables inline
51
+ YOUTRACK_URL=https://your.youtrack.cloud YOUTRACK_API_TOKEN=your-token npx agentek-youtrack-mcp
52
+
53
+ Configuration for Claude Desktop:
54
+ Add this to your Claude Desktop config:
55
+ {
56
+ "mcpServers": {
57
+ "youtrack": {
58
+ "command": "npx",
59
+ "args": ["agentek-youtrack-mcp"],
60
+ "env": {
61
+ "YOUTRACK_URL": "https://your.youtrack.cloud",
62
+ "YOUTRACK_API_TOKEN": "your-token"
63
+ }
64
+ }
65
+ }
66
+ }
67
+ `);
68
+ }
69
+
70
+ function showVersion() {
71
+ try {
72
+ const packageJsonPath = join(__dirname, '..', '..', 'package.json');
73
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
74
+ console.log(`YouTrack MCP Server v${packageJson.version}`);
75
+ } catch (error) {
76
+ console.log('YouTrack MCP Server v1.11.1');
77
+ }
78
+ }
79
+
80
+ async function main() {
81
+ const args = process.argv.slice(2);
82
+
83
+ // Handle help and version flags
84
+ if (args.includes('--help') || args.includes('-h')) {
85
+ showHelp();
86
+ return;
87
+ }
88
+
89
+ if (args.includes('--version') || args.includes('-v')) {
90
+ showVersion();
91
+ return;
92
+ }
93
+
94
+ try {
95
+ const server = new YouTrackMCPServer();
96
+
97
+ if (args.includes('--info')) {
98
+ console.log('šŸ“Š Server Information:');
99
+ console.log(JSON.stringify(server.getInfo(), null, 2));
100
+ return;
101
+ }
102
+
103
+ // Parse arguments
104
+ const serverArgs = [];
105
+ let useHttp = false;
106
+ let host = '0.0.0.0';
107
+ let port = '8000';
108
+
109
+ for (let i = 0; i < args.length; i++) {
110
+ const arg = args[i];
111
+
112
+ if (arg === '--') {
113
+ // Everything after -- goes to the Python server
114
+ serverArgs.push(...args.slice(i + 1));
115
+ break;
116
+ }
117
+
118
+ switch (arg) {
119
+ case '--stdio':
120
+ useHttp = false;
121
+ break;
122
+ case '--http':
123
+ useHttp = true;
124
+ break;
125
+ case '--host':
126
+ host = args[++i];
127
+ break;
128
+ case '--port':
129
+ port = args[++i];
130
+ break;
131
+ default:
132
+ // Pass unknown args to the Python server
133
+ serverArgs.push(arg);
134
+ }
135
+ }
136
+
137
+ // Configure transport
138
+ if (useHttp) {
139
+ serverArgs.push('--transport', 'http', '--host', host);
140
+ console.log(`🌐 Starting HTTP server on http://${host}:${port}`);
141
+ } else {
142
+ serverArgs.push('--transport', 'stdio');
143
+ console.log('šŸ“” Starting stdio transport (for Claude Desktop)');
144
+ }
145
+
146
+ // Start the server
147
+ await server.start(serverArgs);
148
+
149
+ } catch (error) {
150
+ console.error('āŒ Error:', error.message);
151
+ process.exit(1);
152
+ }
153
+ }
154
+
155
+ main().catch(error => {
156
+ console.error('āŒ Unexpected error:', error);
157
+ process.exit(1);
158
+ });
package/dist/index.js ADDED
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from 'child_process';
4
+ import { fileURLToPath } from 'url';
5
+ import { dirname, join } from 'path';
6
+ import { existsSync } from 'fs';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
10
+
11
+ /**
12
+ * YouTrack MCP Server Node.js Wrapper
13
+ *
14
+ * This wrapper allows the Python-based YouTrack MCP server to be installed
15
+ * and executed via npm/npx, following MCP packaging conventions.
16
+ */
17
+ class YouTrackMCPServer {
18
+ constructor() {
19
+ this.pythonPath = null;
20
+ this.serverPath = null;
21
+ this.setupPaths();
22
+ }
23
+
24
+ setupPaths() {
25
+ // Use python3 by default, fall back to python
26
+ // The actual existence check will happen when we try to run it
27
+ this.pythonPath = 'python3';
28
+
29
+ // Find the server main.py file
30
+ const possiblePaths = [
31
+ join(__dirname, 'python', 'main.py'), // From dist/
32
+ join(__dirname, '..', 'python', 'main.py'), // From python/ directory
33
+ join(__dirname, 'main.py') // Current directory
34
+ ];
35
+
36
+ for (const path of possiblePaths) {
37
+ if (existsSync(path)) {
38
+ this.serverPath = path;
39
+ break;
40
+ }
41
+ }
42
+
43
+ if (!this.serverPath) {
44
+ throw new Error('YouTrack MCP server main.py not found');
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Start the YouTrack MCP server
50
+ * @param {string[]} args - Command line arguments to pass to the Python server
51
+ * @param {Object} options - Additional options
52
+ * @returns {Promise<void>}
53
+ */
54
+ async start(args = [], options = {}) {
55
+ console.log('šŸš€ Starting YouTrack MCP Server...');
56
+
57
+ // Validate environment variables
58
+ this.validateEnvironment();
59
+
60
+ const pythonArgs = [this.serverPath, ...args];
61
+
62
+ console.log(`šŸ“ Using Python: ${this.pythonPath}`);
63
+ console.log(`šŸ“ Server path: ${this.serverPath}`);
64
+ console.log(`šŸ“ Arguments: ${pythonArgs.slice(1).join(' ')}`);
65
+
66
+ return new Promise((resolve, reject) => {
67
+ const child = spawn(this.pythonPath, pythonArgs, {
68
+ stdio: options.stdio || 'inherit',
69
+ env: { ...process.env, ...options.env },
70
+ cwd: options.cwd || process.cwd()
71
+ });
72
+
73
+ child.on('error', (error) => {
74
+ console.error('āŒ Failed to start YouTrack MCP server:', error.message);
75
+ reject(error);
76
+ });
77
+
78
+ child.on('exit', (code) => {
79
+ if (code === 0) {
80
+ console.log('āœ… YouTrack MCP server exited successfully');
81
+ resolve();
82
+ } else {
83
+ console.error(`āŒ YouTrack MCP server exited with code ${code}`);
84
+ reject(new Error(`Server exited with code ${code}`));
85
+ }
86
+ });
87
+
88
+ // Handle graceful shutdown
89
+ process.on('SIGINT', () => {
90
+ console.log('\nšŸ›‘ Shutting down YouTrack MCP server...');
91
+ child.kill('SIGINT');
92
+ });
93
+
94
+ process.on('SIGTERM', () => {
95
+ console.log('\nšŸ›‘ Terminating YouTrack MCP server...');
96
+ child.kill('SIGTERM');
97
+ });
98
+ });
99
+ }
100
+
101
+ validateEnvironment() {
102
+ const requiredVars = ['YOUTRACK_URL', 'YOUTRACK_API_TOKEN'];
103
+ const missingVars = requiredVars.filter(varName => !process.env[varName]);
104
+
105
+ if (missingVars.length > 0) {
106
+ console.warn('āš ļø Warning: Missing environment variables:', missingVars.join(', '));
107
+ console.warn(' The server may not function properly without these variables.');
108
+ console.warn(' Please set them in your environment or .env file.');
109
+ } else {
110
+ console.log('āœ… Environment variables validated');
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Get server information
116
+ */
117
+ getInfo() {
118
+ return {
119
+ name: 'YouTrack MCP Server',
120
+ version: '1.11.1',
121
+ description: 'A Model Context Protocol server for JetBrains YouTrack',
122
+ pythonPath: this.pythonPath,
123
+ serverPath: this.serverPath,
124
+ homepage: 'https://github.com/windbit/agentek-youtrack-mcp'
125
+ };
126
+ }
127
+ }
128
+
129
+ export default YouTrackMCPServer;