@nirvana-labs/nirvana-mcp 1.52.0 → 1.53.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/code-tool-worker.js +2 -2
- package/code-tool-worker.js.map +1 -1
- package/code-tool-worker.mjs +2 -2
- package/code-tool-worker.mjs.map +1 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +19 -3
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +19 -3
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +1 -1
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +1 -1
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +21 -2
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +21 -2
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts +2 -4
- package/http.d.mts.map +1 -1
- package/http.d.ts +2 -4
- package/http.d.ts.map +1 -1
- package/http.js +52 -19
- package/http.js.map +1 -1
- package/http.mjs +52 -19
- package/http.mjs.map +1 -1
- package/index.js +12 -11
- package/index.js.map +1 -1
- package/index.mjs +12 -11
- package/index.mjs.map +1 -1
- package/instructions.d.mts.map +1 -1
- package/instructions.d.ts.map +1 -1
- package/instructions.js +2 -1
- package/instructions.js.map +1 -1
- package/instructions.mjs +2 -1
- package/instructions.mjs.map +1 -1
- package/logger.d.mts +7 -0
- package/logger.d.mts.map +1 -0
- package/logger.d.ts +7 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +29 -0
- package/logger.js.map +1 -0
- package/logger.mjs +22 -0
- package/logger.mjs.map +1 -0
- package/methods.js +6 -6
- package/methods.js.map +1 -1
- package/methods.mjs +6 -6
- package/methods.mjs.map +1 -1
- package/options.d.mts +1 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +1 -0
- package/options.d.ts.map +1 -1
- package/options.js +9 -0
- package/options.js.map +1 -1
- package/options.mjs +9 -0
- package/options.mjs.map +1 -1
- package/package.json +15 -4
- package/server.js +1 -1
- package/server.mjs +1 -1
- package/src/code-tool-worker.ts +2 -2
- package/src/code-tool.ts +27 -3
- package/src/docs-search-tool.ts +34 -3
- package/src/http.ts +53 -21
- package/src/index.ts +14 -12
- package/src/instructions.ts +2 -1
- package/src/logger.ts +28 -0
- package/src/methods.ts +6 -6
- package/src/options.ts +11 -0
- package/src/server.ts +1 -1
- package/src/stdio.ts +2 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +2 -1
- package/stdio.js.map +1 -1
- package/stdio.mjs +2 -1
- package/stdio.mjs.map +1 -1
package/src/index.ts
CHANGED
|
@@ -5,15 +5,20 @@ import { McpOptions, parseCLIOptions } from './options';
|
|
|
5
5
|
import { launchStdioServer } from './stdio';
|
|
6
6
|
import { launchStreamableHTTPServer } from './http';
|
|
7
7
|
import type { McpTool } from './types';
|
|
8
|
+
import { configureLogger, getLogger } from './logger';
|
|
8
9
|
|
|
9
10
|
async function main() {
|
|
10
11
|
const options = parseOptionsOrError();
|
|
12
|
+
configureLogger({
|
|
13
|
+
level: options.debug ? 'debug' : 'info',
|
|
14
|
+
pretty: options.logFormat === 'pretty',
|
|
15
|
+
});
|
|
11
16
|
|
|
12
17
|
const selectedTools = await selectToolsOrError(options);
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
selectedTools.
|
|
19
|
+
getLogger().info(
|
|
20
|
+
{ tools: selectedTools.map((e) => e.tool.name) },
|
|
21
|
+
`MCP Server starting with ${selectedTools.length} tools`,
|
|
17
22
|
);
|
|
18
23
|
|
|
19
24
|
switch (options.transport) {
|
|
@@ -23,7 +28,6 @@ async function main() {
|
|
|
23
28
|
case 'http':
|
|
24
29
|
await launchStreamableHTTPServer({
|
|
25
30
|
mcpOptions: options,
|
|
26
|
-
debug: options.debug,
|
|
27
31
|
port: options.socket ?? options.port,
|
|
28
32
|
});
|
|
29
33
|
break;
|
|
@@ -32,7 +36,8 @@ async function main() {
|
|
|
32
36
|
|
|
33
37
|
if (require.main === module) {
|
|
34
38
|
main().catch((error) => {
|
|
35
|
-
|
|
39
|
+
// Logger might not be initialized yet
|
|
40
|
+
console.error('Fatal error in main()', error);
|
|
36
41
|
process.exit(1);
|
|
37
42
|
});
|
|
38
43
|
}
|
|
@@ -41,7 +46,8 @@ function parseOptionsOrError() {
|
|
|
41
46
|
try {
|
|
42
47
|
return parseCLIOptions();
|
|
43
48
|
} catch (error) {
|
|
44
|
-
|
|
49
|
+
// Logger is initialized after options, so use console.error here
|
|
50
|
+
console.error('Error parsing options', error);
|
|
45
51
|
process.exit(1);
|
|
46
52
|
}
|
|
47
53
|
}
|
|
@@ -50,16 +56,12 @@ async function selectToolsOrError(options: McpOptions): Promise<McpTool[]> {
|
|
|
50
56
|
try {
|
|
51
57
|
const includedTools = selectTools(options);
|
|
52
58
|
if (includedTools.length === 0) {
|
|
53
|
-
|
|
59
|
+
getLogger().error('No tools match the provided filters');
|
|
54
60
|
process.exit(1);
|
|
55
61
|
}
|
|
56
62
|
return includedTools;
|
|
57
63
|
} catch (error) {
|
|
58
|
-
|
|
59
|
-
console.error('Error filtering tools:', error.message);
|
|
60
|
-
} else {
|
|
61
|
-
console.error('Error filtering tools:', error);
|
|
62
|
-
}
|
|
64
|
+
getLogger().error({ error }, 'Error filtering tools');
|
|
63
65
|
process.exit(1);
|
|
64
66
|
}
|
|
65
67
|
}
|
package/src/instructions.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { readEnv } from './util';
|
|
4
|
+
import { getLogger } from './logger';
|
|
4
5
|
|
|
5
6
|
const INSTRUCTIONS_CACHE_TTL_MS = 15 * 60 * 1000; // 15 minutes
|
|
6
7
|
|
|
@@ -50,7 +51,7 @@ async function fetchLatestInstructions(stainlessApiKey: string | undefined): Pro
|
|
|
50
51
|
|
|
51
52
|
let instructions: string | undefined;
|
|
52
53
|
if (!response.ok) {
|
|
53
|
-
|
|
54
|
+
getLogger().warn(
|
|
54
55
|
'Warning: failed to retrieve MCP server instructions. Proceeding with default instructions...',
|
|
55
56
|
);
|
|
56
57
|
|
package/src/logger.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { pino, type Level, type Logger } from 'pino';
|
|
4
|
+
import pretty from 'pino-pretty';
|
|
5
|
+
|
|
6
|
+
let _logger: Logger | undefined;
|
|
7
|
+
|
|
8
|
+
export function configureLogger({ level, pretty: usePretty }: { level: Level; pretty: boolean }): void {
|
|
9
|
+
_logger = pino(
|
|
10
|
+
{
|
|
11
|
+
level,
|
|
12
|
+
timestamp: pino.stdTimeFunctions.isoTime,
|
|
13
|
+
formatters: {
|
|
14
|
+
level(label) {
|
|
15
|
+
return { level: label };
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
usePretty ? pretty({ colorize: true, levelFirst: true, destination: 2 }) : process.stderr,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getLogger(): Logger {
|
|
24
|
+
if (!_logger) {
|
|
25
|
+
throw new Error('Logger has not been configured. Call configureLogger() before using the logger.');
|
|
26
|
+
}
|
|
27
|
+
return _logger;
|
|
28
|
+
}
|
package/src/methods.ts
CHANGED
|
@@ -95,16 +95,16 @@ export const sdkMethods: SdkMethod[] = [
|
|
|
95
95
|
httpPath: '/v1/organizations/{organization_id}',
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
|
-
clientCallName: 'client.
|
|
99
|
-
fullyQualifiedName: '
|
|
98
|
+
clientCallName: 'client.auditLogs.list',
|
|
99
|
+
fullyQualifiedName: 'auditLogs.list',
|
|
100
100
|
httpMethod: 'get',
|
|
101
|
-
httpPath: '/v1/
|
|
101
|
+
httpPath: '/v1/audit_logs',
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
|
-
clientCallName: 'client.
|
|
105
|
-
fullyQualifiedName: '
|
|
104
|
+
clientCallName: 'client.auditLogs.get',
|
|
105
|
+
fullyQualifiedName: 'auditLogs.get',
|
|
106
106
|
httpMethod: 'get',
|
|
107
|
-
httpPath: '/v1/
|
|
107
|
+
httpPath: '/v1/audit_logs/{audit_log_id}',
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
clientCallName: 'client.projects.create',
|
package/src/options.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { readEnv } from './util';
|
|
|
8
8
|
|
|
9
9
|
export type CLIOptions = McpOptions & {
|
|
10
10
|
debug: boolean;
|
|
11
|
+
logFormat: 'json' | 'pretty';
|
|
11
12
|
transport: 'stdio' | 'http';
|
|
12
13
|
port: number | undefined;
|
|
13
14
|
socket: string | undefined;
|
|
@@ -52,6 +53,11 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
52
53
|
"Where to run code execution in code tool; 'stainless-sandbox' will execute code in Stainless-hosted sandboxes whereas 'local' will execute code locally on the MCP server machine.",
|
|
53
54
|
})
|
|
54
55
|
.option('debug', { type: 'boolean', description: 'Enable debug logging' })
|
|
56
|
+
.option('log-format', {
|
|
57
|
+
type: 'string',
|
|
58
|
+
choices: ['json', 'pretty'],
|
|
59
|
+
description: 'Format for log output; defaults to json unless tty is detected',
|
|
60
|
+
})
|
|
55
61
|
.option('no-tools', {
|
|
56
62
|
type: 'string',
|
|
57
63
|
array: true,
|
|
@@ -97,6 +103,10 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
97
103
|
const includeDocsTools = shouldIncludeToolType('docs');
|
|
98
104
|
|
|
99
105
|
const transport = argv.transport as 'stdio' | 'http';
|
|
106
|
+
const logFormat =
|
|
107
|
+
argv.logFormat ? (argv.logFormat as 'json' | 'pretty')
|
|
108
|
+
: process.stderr.isTTY ? 'pretty'
|
|
109
|
+
: 'json';
|
|
100
110
|
|
|
101
111
|
return {
|
|
102
112
|
...(includeCodeTool !== undefined && { includeCodeTool }),
|
|
@@ -108,6 +118,7 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
108
118
|
codeBlockedMethods: argv.codeBlockedMethods,
|
|
109
119
|
codeExecutionMode: argv.codeExecutionMode as McpCodeExecutionMode,
|
|
110
120
|
transport,
|
|
121
|
+
logFormat,
|
|
111
122
|
port: argv.port,
|
|
112
123
|
socket: argv.socket,
|
|
113
124
|
};
|
package/src/server.ts
CHANGED
package/src/stdio.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
2
|
import { McpOptions } from './options';
|
|
3
3
|
import { initMcpServer, newMcpServer } from './server';
|
|
4
|
+
import { getLogger } from './logger';
|
|
4
5
|
|
|
5
6
|
export const launchStdioServer = async (mcpOptions: McpOptions) => {
|
|
6
7
|
const server = await newMcpServer(mcpOptions.stainlessApiKey);
|
|
@@ -9,5 +10,5 @@ export const launchStdioServer = async (mcpOptions: McpOptions) => {
|
|
|
9
10
|
|
|
10
11
|
const transport = new StdioServerTransport();
|
|
11
12
|
await server.connect(transport);
|
|
12
|
-
|
|
13
|
+
getLogger().info('MCP Server running on stdio');
|
|
13
14
|
};
|
package/stdio.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAIrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAQ7D,CAAC"}
|
package/stdio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAIrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAQ7D,CAAC"}
|
package/stdio.js
CHANGED
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.launchStdioServer = void 0;
|
|
4
4
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
5
|
const server_1 = require("./server.js");
|
|
6
|
+
const logger_1 = require("./logger.js");
|
|
6
7
|
const launchStdioServer = async (mcpOptions) => {
|
|
7
8
|
const server = await (0, server_1.newMcpServer)(mcpOptions.stainlessApiKey);
|
|
8
9
|
await (0, server_1.initMcpServer)({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
|
|
9
10
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
10
11
|
await server.connect(transport);
|
|
11
|
-
|
|
12
|
+
(0, logger_1.getLogger)().info('MCP Server running on stdio');
|
|
12
13
|
};
|
|
13
14
|
exports.launchStdioServer = launchStdioServer;
|
|
14
15
|
//# sourceMappingURL=stdio.js.map
|
package/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AACvD,wCAAqC;AAE9B,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE9D,MAAM,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IAEzF,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,IAAA,kBAAS,GAAE,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAClD,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
|
package/stdio.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
2
|
import { initMcpServer, newMcpServer } from "./server.mjs";
|
|
3
|
+
import { getLogger } from "./logger.mjs";
|
|
3
4
|
export const launchStdioServer = async (mcpOptions) => {
|
|
4
5
|
const server = await newMcpServer(mcpOptions.stainlessApiKey);
|
|
5
6
|
await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
|
|
6
7
|
const transport = new StdioServerTransport();
|
|
7
8
|
await server.connect(transport);
|
|
8
|
-
|
|
9
|
+
getLogger().info('MCP Server running on stdio');
|
|
9
10
|
};
|
|
10
11
|
//# sourceMappingURL=stdio.mjs.map
|
package/stdio.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OAEzE,EAAE,aAAa,EAAE,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OAEzE,EAAE,aAAa,EAAE,YAAY,EAAE;OAC/B,EAAE,SAAS,EAAE;AAEpB,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE9D,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IAEzF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,SAAS,EAAE,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAClD,CAAC,CAAC"}
|