opik-mcp 0.0.3 → 0.0.4

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 (2) hide show
  1. package/build/cli.js +9 -39
  2. package/package.json +1 -1
package/build/cli.js CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import yargs from 'yargs';
3
3
  import { hideBin } from 'yargs/helpers';
4
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
- import { SSEServerTransport } from './transports/sse-transport.js';
6
- import { startServerWithTransport } from './mcp-server.js';
4
+ import { main } from './index.js';
5
+ import configImport from './config.js';
7
6
  // Parse command line arguments
8
7
  const argv = yargs(hideBin(process.argv))
9
8
  .scriptName('opik-mcp')
@@ -28,44 +27,15 @@ const argv = yargs(hideBin(process.argv))
28
27
  .help()
29
28
  .alias('help', 'h')
30
29
  .parseSync();
31
- /**
32
- * Function to start the MCP server with the specified transport
33
- */
34
- async function startServer() {
35
- let transport;
36
- // Create the appropriate transport based on command line argument
37
- if (argv.transport === 'sse') {
38
- console.log(`Starting MCP server with SSE transport on port ${argv.port}`);
39
- transport = new SSEServerTransport({ port: argv.port });
40
- }
41
- else {
42
- console.log('Starting MCP server with stdio transport');
43
- transport = new StdioServerTransport();
44
- }
45
- try {
46
- // Start the server with the configured transport
47
- await startServerWithTransport(transport);
48
- if (argv.transport === 'sse') {
49
- console.log(`Server is now accessible at http://localhost:${argv.port}`);
50
- console.log(`- Health check: http://localhost:${argv.port}/health`);
51
- console.log(`- SSE events: http://localhost:${argv.port}/events`);
52
- console.log(`- Send messages: POST to http://localhost:${argv.port}/send`);
53
- }
54
- // Keep the process alive
55
- process.on('SIGINT', async () => {
56
- console.log('Shutting down server...');
57
- await transport.close();
58
- process.exit(0);
59
- });
60
- }
61
- catch (error) {
62
- console.error(`Error starting server: ${error}`);
63
- process.exit(1);
64
- }
65
- }
66
30
  // Only start the server if we're running the serve command
67
31
  if (argv._[0] === 'serve') {
68
- startServer().catch(error => {
32
+ // Update config based on CLI arguments
33
+ configImport.transport = argv.transport;
34
+ if (argv.transport === 'sse') {
35
+ configImport.ssePort = argv.port;
36
+ }
37
+ // Start the server using main from index.ts
38
+ main().catch(error => {
69
39
  console.error(`Fatal error: ${error}`);
70
40
  process.exit(1);
71
41
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opik-mcp",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "MCP server to interact with Opik - Enables automated prompt optimization",
5
5
  "type": "module",
6
6
  "bin": {