opik-mcp 0.0.3 → 0.0.5
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 +3 -3
- package/build/cli.js +10 -39
- package/build/config.js +1 -1
- package/build/index.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
<a href="https://www.comet.com/site/products/opik/?from=llm&utm_source=opik&utm_medium=github&utm_content=header_img&utm_campaign=opik-mcp">
|
|
4
4
|
<picture>
|
|
5
|
-
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/logo-dark-mode.svg">
|
|
6
|
-
<source media="(prefers-color-scheme: light)" srcset="docs/assets/logo-light-mode.svg">
|
|
7
|
-
<img alt="Comet Opik logo" src="docs/assets/logo-light-mode.svg" width="200" />
|
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/comet-ml/opik-mcp/refs/heads/main/docs/assets/logo-dark-mode.svg">
|
|
6
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/comet-ml/opik-mcp/refs/heads/main/docs/assets/logo-light-mode.svg">
|
|
7
|
+
<img alt="Comet Opik logo" src="https://raw.githubusercontent.com/comet-ml/opik-mcp/refs/heads/main/docs/assets/logo-light-mode.svg" width="200" />
|
|
8
8
|
</picture>
|
|
9
9
|
</a>
|
|
10
10
|
<br>
|
package/build/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import yargs from 'yargs';
|
|
3
3
|
import { hideBin } from 'yargs/helpers';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
4
|
+
import { main } from './index.js';
|
|
5
|
+
import configImport from './config.js';
|
|
6
|
+
const config = configImport;
|
|
7
7
|
// Parse command line arguments
|
|
8
8
|
const argv = yargs(hideBin(process.argv))
|
|
9
9
|
.scriptName('opik-mcp')
|
|
@@ -28,44 +28,15 @@ const argv = yargs(hideBin(process.argv))
|
|
|
28
28
|
.help()
|
|
29
29
|
.alias('help', 'h')
|
|
30
30
|
.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
31
|
// Only start the server if we're running the serve command
|
|
67
32
|
if (argv._[0] === 'serve') {
|
|
68
|
-
|
|
33
|
+
// Update config based on CLI arguments
|
|
34
|
+
configImport.transport = argv.transport;
|
|
35
|
+
if (argv.transport === 'sse') {
|
|
36
|
+
configImport.ssePort = argv.port;
|
|
37
|
+
}
|
|
38
|
+
// Start the server using main from index.ts
|
|
39
|
+
main().catch(error => {
|
|
69
40
|
console.error(`Fatal error: ${error}`);
|
|
70
41
|
process.exit(1);
|
|
71
42
|
});
|
package/build/config.js
CHANGED
|
@@ -124,7 +124,7 @@ function parseCommandLineArgs() {
|
|
|
124
124
|
/**
|
|
125
125
|
* Load environment variables with fallbacks
|
|
126
126
|
*/
|
|
127
|
-
function loadConfig() {
|
|
127
|
+
export function loadConfig() {
|
|
128
128
|
// Parse command-line arguments first
|
|
129
129
|
const args = parseCommandLineArgs();
|
|
130
130
|
// Try to load from process.env and command-line args, with command-line taking precedence
|
package/build/index.js
CHANGED
|
@@ -10,8 +10,9 @@ import './utils/env.js';
|
|
|
10
10
|
// Setup file-based logging
|
|
11
11
|
const logFile = '/tmp/opik-mcp.log';
|
|
12
12
|
// Import configuration
|
|
13
|
-
import
|
|
14
|
-
const config =
|
|
13
|
+
import { loadConfig } from './config.js';
|
|
14
|
+
const config = loadConfig();
|
|
15
|
+
console.log(config);
|
|
15
16
|
// Define logging functions
|
|
16
17
|
function logToFile(message) {
|
|
17
18
|
// Only log if debug mode is enabled
|