@llamaindex/llama-cloud-mcp 1.6.0 → 1.7.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-paths.cjs +6 -0
- package/code-tool-paths.cjs.map +1 -0
- package/code-tool-paths.d.cts +2 -0
- package/code-tool-paths.d.cts.map +1 -0
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool-worker.d.mts +5 -0
- package/code-tool-worker.d.mts.map +1 -0
- package/code-tool-worker.d.ts +5 -0
- package/code-tool-worker.d.ts.map +1 -0
- package/code-tool-worker.js +345 -0
- package/code-tool-worker.js.map +1 -0
- package/code-tool-worker.mjs +340 -0
- package/code-tool-worker.mjs.map +1 -0
- package/code-tool.d.mts +8 -2
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +8 -2
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +260 -37
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +224 -37
- 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 +62 -41
- package/http.js.map +1 -1
- package/http.mjs +62 -41
- package/http.mjs.map +1 -1
- package/index.js +13 -12
- package/index.js.map +1 -1
- package/index.mjs +13 -12
- package/index.mjs.map +1 -1
- package/instructions.d.mts +2 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +2 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +56 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +53 -0
- package/instructions.mjs.map +1 -0
- 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/options.d.mts +4 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +4 -0
- package/options.d.ts.map +1 -1
- package/options.js +23 -0
- package/options.js.map +1 -1
- package/options.mjs +23 -0
- package/options.mjs.map +1 -1
- package/package.json +42 -5
- package/server.d.mts.map +1 -1
- package/server.d.ts.map +1 -1
- package/server.js +61 -46
- package/server.js.map +1 -1
- package/server.mjs +60 -45
- package/server.mjs.map +1 -1
- package/src/code-tool-paths.cts +3 -0
- package/src/code-tool-types.ts +1 -0
- package/src/code-tool-worker.ts +391 -0
- package/src/code-tool.ts +291 -47
- package/src/docs-search-tool.ts +34 -3
- package/src/http.ts +63 -42
- package/src/index.ts +15 -13
- package/src/instructions.ts +75 -0
- package/src/logger.ts +28 -0
- package/src/options.ts +32 -0
- package/src/server.ts +63 -56
- 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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { readEnv } from './util';
|
|
4
|
+
import { getLogger } from './logger';
|
|
5
|
+
|
|
6
|
+
const INSTRUCTIONS_CACHE_TTL_MS = 15 * 60 * 1000; // 15 minutes
|
|
7
|
+
|
|
8
|
+
interface InstructionsCacheEntry {
|
|
9
|
+
fetchedInstructions: string;
|
|
10
|
+
fetchedAt: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const instructionsCache = new Map<string, InstructionsCacheEntry>();
|
|
14
|
+
|
|
15
|
+
// Periodically evict stale entries so the cache doesn't grow unboundedly.
|
|
16
|
+
const _cacheCleanupInterval = setInterval(() => {
|
|
17
|
+
const now = Date.now();
|
|
18
|
+
for (const [key, entry] of instructionsCache) {
|
|
19
|
+
if (now - entry.fetchedAt > INSTRUCTIONS_CACHE_TTL_MS) {
|
|
20
|
+
instructionsCache.delete(key);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, INSTRUCTIONS_CACHE_TTL_MS);
|
|
24
|
+
|
|
25
|
+
// Don't keep the process alive just for cleanup.
|
|
26
|
+
_cacheCleanupInterval.unref();
|
|
27
|
+
|
|
28
|
+
export async function getInstructions(stainlessApiKey: string | undefined): Promise<string> {
|
|
29
|
+
const cacheKey = stainlessApiKey ?? '';
|
|
30
|
+
const cached = instructionsCache.get(cacheKey);
|
|
31
|
+
|
|
32
|
+
if (cached && Date.now() - cached.fetchedAt <= INSTRUCTIONS_CACHE_TTL_MS) {
|
|
33
|
+
return cached.fetchedInstructions;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const fetchedInstructions = await fetchLatestInstructions(stainlessApiKey);
|
|
37
|
+
instructionsCache.set(cacheKey, { fetchedInstructions, fetchedAt: Date.now() });
|
|
38
|
+
return fetchedInstructions;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function fetchLatestInstructions(stainlessApiKey: string | undefined): Promise<string> {
|
|
42
|
+
// Setting the stainless API key is optional, but may be required
|
|
43
|
+
// to authenticate requests to the Stainless API.
|
|
44
|
+
const response = await fetch(
|
|
45
|
+
readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/llamacloud-prod',
|
|
46
|
+
{
|
|
47
|
+
method: 'GET',
|
|
48
|
+
headers: { ...(stainlessApiKey && { Authorization: stainlessApiKey }) },
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
let instructions: string | undefined;
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
getLogger().warn(
|
|
55
|
+
'Warning: failed to retrieve MCP server instructions. Proceeding with default instructions...',
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
instructions = `
|
|
59
|
+
This is the llamacloud-prod MCP server. You will use Code Mode to help the user perform
|
|
60
|
+
actions. You can use search_docs tool to learn about how to take action with this server. Then,
|
|
61
|
+
you will write TypeScript code using the execute tool take action. It is CRITICAL that you be
|
|
62
|
+
thoughtful and deliberate when executing code. Always try to entirely solve the problem in code
|
|
63
|
+
block: it can be as long as you need to get the job done!
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
instructions ??= ((await response.json()) as { instructions: string }).instructions;
|
|
68
|
+
instructions = `
|
|
69
|
+
If needed, you can get the current time by executing Date.now().
|
|
70
|
+
|
|
71
|
+
${instructions}
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
return instructions;
|
|
75
|
+
}
|
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/options.ts
CHANGED
|
@@ -8,19 +8,24 @@ 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;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export type McpOptions = {
|
|
18
|
+
includeCodeTool?: boolean | undefined;
|
|
17
19
|
includeDocsTools?: boolean | undefined;
|
|
18
20
|
stainlessApiKey?: string | undefined;
|
|
19
21
|
codeAllowHttpGets?: boolean | undefined;
|
|
20
22
|
codeAllowedMethods?: string[] | undefined;
|
|
21
23
|
codeBlockedMethods?: string[] | undefined;
|
|
24
|
+
codeExecutionMode: McpCodeExecutionMode;
|
|
22
25
|
};
|
|
23
26
|
|
|
27
|
+
export type McpCodeExecutionMode = 'stainless-sandbox' | 'local';
|
|
28
|
+
|
|
24
29
|
export function parseCLIOptions(): CLIOptions {
|
|
25
30
|
const opts = yargs(hideBin(process.argv))
|
|
26
31
|
.option('code-allow-http-gets', {
|
|
@@ -40,7 +45,19 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
40
45
|
description:
|
|
41
46
|
'Methods to explicitly block for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
|
|
42
47
|
})
|
|
48
|
+
.option('code-execution-mode', {
|
|
49
|
+
type: 'string',
|
|
50
|
+
choices: ['stainless-sandbox', 'local'],
|
|
51
|
+
default: 'stainless-sandbox',
|
|
52
|
+
description:
|
|
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.",
|
|
54
|
+
})
|
|
43
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
|
+
})
|
|
44
61
|
.option('no-tools', {
|
|
45
62
|
type: 'string',
|
|
46
63
|
array: true,
|
|
@@ -82,18 +99,26 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
82
99
|
: argv.tools?.includes(toolType) ? true
|
|
83
100
|
: undefined;
|
|
84
101
|
|
|
102
|
+
const includeCodeTool = shouldIncludeToolType('code');
|
|
85
103
|
const includeDocsTools = shouldIncludeToolType('docs');
|
|
86
104
|
|
|
87
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';
|
|
88
110
|
|
|
89
111
|
return {
|
|
112
|
+
...(includeCodeTool !== undefined && { includeCodeTool }),
|
|
90
113
|
...(includeDocsTools !== undefined && { includeDocsTools }),
|
|
91
114
|
debug: !!argv.debug,
|
|
92
115
|
stainlessApiKey: argv.stainlessApiKey,
|
|
93
116
|
codeAllowHttpGets: argv.codeAllowHttpGets,
|
|
94
117
|
codeAllowedMethods: argv.codeAllowedMethods,
|
|
95
118
|
codeBlockedMethods: argv.codeBlockedMethods,
|
|
119
|
+
codeExecutionMode: argv.codeExecutionMode as McpCodeExecutionMode,
|
|
96
120
|
transport,
|
|
121
|
+
logFormat,
|
|
97
122
|
port: argv.port,
|
|
98
123
|
socket: argv.socket,
|
|
99
124
|
};
|
|
@@ -118,12 +143,19 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M
|
|
|
118
143
|
const queryObject = typeof query === 'string' ? qs.parse(query) : query;
|
|
119
144
|
const queryOptions = QueryOptions.parse(queryObject);
|
|
120
145
|
|
|
146
|
+
let codeTool: boolean | undefined =
|
|
147
|
+
queryOptions.no_tools && queryOptions.no_tools?.includes('code') ? false
|
|
148
|
+
: queryOptions.tools?.includes('code') ? true
|
|
149
|
+
: defaultOptions.includeCodeTool;
|
|
150
|
+
|
|
121
151
|
let docsTools: boolean | undefined =
|
|
122
152
|
queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
|
|
123
153
|
: queryOptions.tools?.includes('docs') ? true
|
|
124
154
|
: defaultOptions.includeDocsTools;
|
|
125
155
|
|
|
126
156
|
return {
|
|
157
|
+
...(codeTool !== undefined && { includeCodeTool: codeTool }),
|
|
127
158
|
...(docsTools !== undefined && { includeDocsTools: docsTools }),
|
|
159
|
+
codeExecutionMode: defaultOptions.codeExecutionMode,
|
|
128
160
|
};
|
|
129
161
|
}
|
package/src/server.ts
CHANGED
|
@@ -11,52 +11,16 @@ import { ClientOptions } from '@llamaindex/llama-cloud';
|
|
|
11
11
|
import LlamaCloud from '@llamaindex/llama-cloud';
|
|
12
12
|
import { codeTool } from './code-tool';
|
|
13
13
|
import docsSearchTool from './docs-search-tool';
|
|
14
|
+
import { getInstructions } from './instructions';
|
|
14
15
|
import { McpOptions } from './options';
|
|
15
16
|
import { blockedMethodsForCodeTool } from './methods';
|
|
16
17
|
import { HandlerFunction, McpRequestContext, ToolCallResult, McpTool } from './types';
|
|
17
|
-
import { readEnv } from './util';
|
|
18
|
-
|
|
19
|
-
async function getInstructions(stainlessApiKey: string | undefined): Promise<string> {
|
|
20
|
-
// Setting the stainless API key is optional, but may be required
|
|
21
|
-
// to authenticate requests to the Stainless API.
|
|
22
|
-
const response = await fetch(
|
|
23
|
-
readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/llamacloud-prod',
|
|
24
|
-
{
|
|
25
|
-
method: 'GET',
|
|
26
|
-
headers: { ...(stainlessApiKey && { Authorization: stainlessApiKey }) },
|
|
27
|
-
},
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
let instructions: string | undefined;
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
console.warn(
|
|
33
|
-
'Warning: failed to retrieve MCP server instructions. Proceeding with default instructions...',
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
instructions = `
|
|
37
|
-
This is the llamacloud-prod MCP server. You will use Code Mode to help the user perform
|
|
38
|
-
actions. You can use search_docs tool to learn about how to take action with this server. Then,
|
|
39
|
-
you will write TypeScript code using the execute tool take action. It is CRITICAL that you be
|
|
40
|
-
thoughtful and deliberate when executing code. Always try to entirely solve the problem in code
|
|
41
|
-
block: it can be as long as you need to get the job done!
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
instructions ??= ((await response.json()) as { instructions: string }).instructions;
|
|
46
|
-
instructions = `
|
|
47
|
-
The current time in Unix timestamps is ${Date.now()}.
|
|
48
|
-
|
|
49
|
-
${instructions}
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
|
-
return instructions;
|
|
53
|
-
}
|
|
54
18
|
|
|
55
19
|
export const newMcpServer = async (stainlessApiKey: string | undefined) =>
|
|
56
20
|
new McpServer(
|
|
57
21
|
{
|
|
58
22
|
name: 'llamaindex_llama_cloud_api',
|
|
59
|
-
version: '1.
|
|
23
|
+
version: '1.7.0',
|
|
60
24
|
},
|
|
61
25
|
{
|
|
62
26
|
instructions: await getInstructions(stainlessApiKey),
|
|
@@ -91,14 +55,32 @@ export async function initMcpServer(params: {
|
|
|
91
55
|
error: logAtLevel('error'),
|
|
92
56
|
};
|
|
93
57
|
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
58
|
+
let _client: LlamaCloud | undefined;
|
|
59
|
+
let _clientError: Error | undefined;
|
|
60
|
+
let _logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off' | undefined;
|
|
61
|
+
|
|
62
|
+
const getClient = (): LlamaCloud => {
|
|
63
|
+
if (_clientError) throw _clientError;
|
|
64
|
+
if (!_client) {
|
|
65
|
+
try {
|
|
66
|
+
_client = new LlamaCloud({
|
|
67
|
+
logger,
|
|
68
|
+
...params.clientOptions,
|
|
69
|
+
defaultHeaders: {
|
|
70
|
+
...params.clientOptions?.defaultHeaders,
|
|
71
|
+
'X-Stainless-MCP': 'true',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
if (_logLevel) {
|
|
75
|
+
_client = _client.withOptions({ logLevel: _logLevel });
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
_clientError = e instanceof Error ? e : new Error(String(e));
|
|
79
|
+
throw _clientError;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return _client;
|
|
83
|
+
};
|
|
102
84
|
|
|
103
85
|
const providedTools = selectTools(params.mcpOptions);
|
|
104
86
|
const toolMap = Object.fromEntries(providedTools.map((mcpTool) => [mcpTool.tool.name, mcpTool]));
|
|
@@ -116,6 +98,21 @@ export async function initMcpServer(params: {
|
|
|
116
98
|
throw new Error(`Unknown tool: ${name}`);
|
|
117
99
|
}
|
|
118
100
|
|
|
101
|
+
let client: LlamaCloud;
|
|
102
|
+
try {
|
|
103
|
+
client = getClient();
|
|
104
|
+
} catch (error) {
|
|
105
|
+
return {
|
|
106
|
+
content: [
|
|
107
|
+
{
|
|
108
|
+
type: 'text' as const,
|
|
109
|
+
text: `Failed to initialize client: ${error instanceof Error ? error.message : String(error)}`,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
isError: true,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
119
116
|
return executeHandler({
|
|
120
117
|
handler: mcpTool.handler,
|
|
121
118
|
reqContext: {
|
|
@@ -128,24 +125,29 @@ export async function initMcpServer(params: {
|
|
|
128
125
|
|
|
129
126
|
server.setRequestHandler(SetLevelRequestSchema, async (request) => {
|
|
130
127
|
const { level } = request.params;
|
|
128
|
+
let logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off';
|
|
131
129
|
switch (level) {
|
|
132
130
|
case 'debug':
|
|
133
|
-
|
|
131
|
+
logLevel = 'debug';
|
|
134
132
|
break;
|
|
135
133
|
case 'info':
|
|
136
|
-
|
|
134
|
+
logLevel = 'info';
|
|
137
135
|
break;
|
|
138
136
|
case 'notice':
|
|
139
137
|
case 'warning':
|
|
140
|
-
|
|
138
|
+
logLevel = 'warn';
|
|
141
139
|
break;
|
|
142
140
|
case 'error':
|
|
143
|
-
|
|
141
|
+
logLevel = 'error';
|
|
144
142
|
break;
|
|
145
143
|
default:
|
|
146
|
-
|
|
144
|
+
logLevel = 'off';
|
|
147
145
|
break;
|
|
148
146
|
}
|
|
147
|
+
_logLevel = logLevel;
|
|
148
|
+
if (_client) {
|
|
149
|
+
_client = _client.withOptions({ logLevel });
|
|
150
|
+
}
|
|
149
151
|
return {};
|
|
150
152
|
});
|
|
151
153
|
}
|
|
@@ -154,11 +156,16 @@ export async function initMcpServer(params: {
|
|
|
154
156
|
* Selects the tools to include in the MCP Server based on the provided options.
|
|
155
157
|
*/
|
|
156
158
|
export function selectTools(options?: McpOptions): McpTool[] {
|
|
157
|
-
const includedTools = [
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
const includedTools = [];
|
|
160
|
+
|
|
161
|
+
if (options?.includeCodeTool ?? true) {
|
|
162
|
+
includedTools.push(
|
|
163
|
+
codeTool({
|
|
164
|
+
blockedMethods: blockedMethodsForCodeTool(options),
|
|
165
|
+
codeExecutionMode: options?.codeExecutionMode ?? 'stainless-sandbox',
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
162
169
|
if (options?.includeDocsTools ?? true) {
|
|
163
170
|
includedTools.push(docsSearchTool);
|
|
164
171
|
}
|
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"}
|