@llamaindex/llama-cloud-mcp 1.5.0 → 1.6.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 (89) hide show
  1. package/auth.d.mts +6 -0
  2. package/auth.d.mts.map +1 -0
  3. package/auth.d.ts +6 -0
  4. package/auth.d.ts.map +1 -0
  5. package/{headers.mjs → auth.js} +18 -2
  6. package/auth.js.map +1 -0
  7. package/{headers.js → auth.mjs} +13 -6
  8. package/auth.mjs.map +1 -0
  9. package/code-tool.d.mts +1 -1
  10. package/code-tool.d.mts.map +1 -1
  11. package/code-tool.d.ts +1 -1
  12. package/code-tool.d.ts.map +1 -1
  13. package/code-tool.js +11 -12
  14. package/code-tool.js.map +1 -1
  15. package/code-tool.mjs +9 -10
  16. package/code-tool.mjs.map +1 -1
  17. package/docs-search-tool.d.mts +9 -3
  18. package/docs-search-tool.d.mts.map +1 -1
  19. package/docs-search-tool.d.ts +9 -3
  20. package/docs-search-tool.d.ts.map +1 -1
  21. package/docs-search-tool.js +6 -2
  22. package/docs-search-tool.js.map +1 -1
  23. package/docs-search-tool.mjs +6 -2
  24. package/docs-search-tool.mjs.map +1 -1
  25. package/http.d.mts +2 -2
  26. package/http.d.mts.map +1 -1
  27. package/http.d.ts +2 -2
  28. package/http.d.ts.map +1 -1
  29. package/http.js +9 -7
  30. package/http.js.map +1 -1
  31. package/http.mjs +9 -7
  32. package/http.mjs.map +1 -1
  33. package/methods.d.mts.map +1 -1
  34. package/methods.d.ts.map +1 -1
  35. package/methods.js +1 -0
  36. package/methods.js.map +1 -1
  37. package/methods.mjs +1 -0
  38. package/methods.mjs.map +1 -1
  39. package/options.d.mts +1 -0
  40. package/options.d.mts.map +1 -1
  41. package/options.d.ts +1 -0
  42. package/options.d.ts.map +1 -1
  43. package/options.js +8 -0
  44. package/options.js.map +1 -1
  45. package/options.mjs +8 -0
  46. package/options.mjs.map +1 -1
  47. package/package.json +22 -12
  48. package/server.d.mts +8 -9
  49. package/server.d.mts.map +1 -1
  50. package/server.d.ts +8 -9
  51. package/server.d.ts.map +1 -1
  52. package/server.js +20 -37
  53. package/server.js.map +1 -1
  54. package/server.mjs +18 -32
  55. package/server.mjs.map +1 -1
  56. package/src/{headers.ts → auth.ts} +16 -1
  57. package/src/code-tool.ts +22 -13
  58. package/src/docs-search-tool.ts +13 -4
  59. package/src/http.ts +16 -8
  60. package/src/methods.ts +2 -0
  61. package/src/options.ts +11 -0
  62. package/src/server.ts +28 -42
  63. package/src/stdio.ts +2 -2
  64. package/src/types.ts +12 -4
  65. package/src/util.ts +25 -0
  66. package/stdio.js +2 -2
  67. package/stdio.js.map +1 -1
  68. package/stdio.mjs +2 -2
  69. package/stdio.mjs.map +1 -1
  70. package/types.d.mts +8 -1
  71. package/types.d.mts.map +1 -1
  72. package/types.d.ts +8 -1
  73. package/types.d.ts.map +1 -1
  74. package/types.js.map +1 -1
  75. package/types.mjs.map +1 -1
  76. package/util.d.mts +4 -0
  77. package/util.d.mts.map +1 -0
  78. package/util.d.ts +4 -0
  79. package/util.d.ts.map +1 -0
  80. package/util.js +30 -0
  81. package/util.js.map +1 -0
  82. package/util.mjs +24 -0
  83. package/util.mjs.map +1 -0
  84. package/headers.d.mts +0 -4
  85. package/headers.d.mts.map +0 -1
  86. package/headers.d.ts +0 -4
  87. package/headers.d.ts.map +0 -1
  88. package/headers.js.map +0 -1
  89. package/headers.mjs.map +0 -1
package/server.mjs CHANGED
@@ -5,12 +5,13 @@ import LlamaCloud from '@llamaindex/llama-cloud';
5
5
  import { codeTool } from "./code-tool.mjs";
6
6
  import docsSearchTool from "./docs-search-tool.mjs";
7
7
  import { blockedMethodsForCodeTool } from "./methods.mjs";
8
- async function getInstructions() {
9
- // This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
10
- const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
8
+ import { readEnv } from "./util.mjs";
9
+ async function getInstructions(stainlessApiKey) {
10
+ // Setting the stainless API key is optional, but may be required
11
+ // to authenticate requests to the Stainless API.
11
12
  const response = await fetch(readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/llamacloud-prod', {
12
13
  method: 'GET',
13
- headers: { ...(stainlessAPIKey && { Authorization: stainlessAPIKey }) },
14
+ headers: { ...(stainlessApiKey && { Authorization: stainlessApiKey }) },
14
15
  });
15
16
  let instructions;
16
17
  if (!response.ok) {
@@ -31,11 +32,11 @@ async function getInstructions() {
31
32
  `;
32
33
  return instructions;
33
34
  }
34
- export const newMcpServer = async () => new McpServer({
35
+ export const newMcpServer = async (stainlessApiKey) => new McpServer({
35
36
  name: 'llamaindex_llama_cloud_api',
36
- version: '1.5.0',
37
+ version: '1.6.0',
37
38
  }, {
38
- instructions: await getInstructions(),
39
+ instructions: await getInstructions(stainlessApiKey),
39
40
  capabilities: { tools: {}, logging: {} },
40
41
  });
41
42
  /**
@@ -77,7 +78,14 @@ export async function initMcpServer(params) {
77
78
  if (!mcpTool) {
78
79
  throw new Error(`Unknown tool: ${name}`);
79
80
  }
80
- return executeHandler(mcpTool.handler, client, args);
81
+ return executeHandler({
82
+ handler: mcpTool.handler,
83
+ reqContext: {
84
+ client,
85
+ stainlessApiKey: params.stainlessApiKey ?? params.mcpOptions?.stainlessApiKey,
86
+ },
87
+ args,
88
+ });
81
89
  });
82
90
  server.setRequestHandler(SetLevelRequestSchema, async (request) => {
83
91
  const { level } = request.params;
@@ -119,29 +127,7 @@ export function selectTools(options) {
119
127
  /**
120
128
  * Runs the provided handler with the given client and arguments.
121
129
  */
122
- export async function executeHandler(handler, client, args) {
123
- return await handler(client, args || {});
130
+ export async function executeHandler({ handler, reqContext, args, }) {
131
+ return await handler({ reqContext, args: args || {} });
124
132
  }
125
- export const readEnv = (env) => {
126
- if (typeof globalThis.process !== 'undefined') {
127
- return globalThis.process.env?.[env]?.trim();
128
- }
129
- else if (typeof globalThis.Deno !== 'undefined') {
130
- return globalThis.Deno.env?.get?.(env)?.trim();
131
- }
132
- return;
133
- };
134
- export const readEnvOrError = (env) => {
135
- let envValue = readEnv(env);
136
- if (envValue === undefined) {
137
- throw new Error(`Environment variable ${env} is not set`);
138
- }
139
- return envValue;
140
- };
141
- export const requireValue = (value, description) => {
142
- if (value === undefined) {
143
- throw new Error(`Missing required value: ${description}`);
144
- }
145
- return value;
146
- };
147
133
  //# sourceMappingURL=server.mjs.map
package/server.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"server.mjs","sourceRoot":"","sources":["src/server.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,SAAS,EAAE,MAAM,yCAAyC;OAC5D,EACL,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC;OAEpC,UAAU,MAAM,yBAAyB;OACzC,EAAE,QAAQ,EAAE;OACZ,cAAc;OAEd,EAAE,yBAAyB,EAAE;AAMpC,KAAK,UAAU,eAAe;IAC5B,0GAA0G;IAC1G,MAAM,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,OAAO,CAAC,4BAA4B,CAAC,IAAI,+DAA+D,EACxG;QACE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,EAAE,GAAG,CAAC,eAAe,IAAI,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC,EAAE;KACxE,CACF,CAAC;IAEF,IAAI,YAAgC,CAAC;IACrC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,8FAA8F,CAC/F,CAAC;QAEF,YAAY,GAAG;;;;;;KAMd,CAAC;IACJ,CAAC;IAED,YAAY,KAAM,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAA8B,CAAC,YAAY,CAAC;IACpF,YAAY,GAAG;6CAC4B,IAAI,CAAC,GAAG,EAAE;;MAEjD,YAAY;GACf,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,C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,EAAE,CAAC,CAAC;AACzD,CAAC"}
@@ -2,8 +2,9 @@
2
2
 
3
3
  import { IncomingMessage } from 'node:http';
4
4
  import { ClientOptions } from '@llamaindex/llama-cloud';
5
+ import { McpOptions } from './options';
5
6
 
6
- export const parseAuthHeaders = (req: IncomingMessage, required?: boolean): Partial<ClientOptions> => {
7
+ export const parseClientAuthHeaders = (req: IncomingMessage, required?: boolean): Partial<ClientOptions> => {
7
8
  if (req.headers.authorization) {
8
9
  const scheme = req.headers.authorization.split(' ')[0]!;
9
10
  const value = req.headers.authorization.slice(scheme.length + 1);
@@ -25,3 +26,17 @@ export const parseAuthHeaders = (req: IncomingMessage, required?: boolean): Part
25
26
  : req.headers['x-llama-cloud-api-key'];
26
27
  return { apiKey };
27
28
  };
29
+
30
+ export const getStainlessApiKey = (req: IncomingMessage, mcpOptions: McpOptions): string | undefined => {
31
+ // Try to get the key from the x-stainless-api-key header
32
+ const headerKey =
33
+ Array.isArray(req.headers['x-stainless-api-key']) ?
34
+ req.headers['x-stainless-api-key'][0]
35
+ : req.headers['x-stainless-api-key'];
36
+ if (headerKey && typeof headerKey === 'string') {
37
+ return headerKey;
38
+ }
39
+
40
+ // Fall back to value set in the mcpOptions (e.g. from environment variable), if provided
41
+ return mcpOptions.stainlessApiKey;
42
+ };
package/src/code-tool.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { McpTool, Metadata, ToolCallResult, asErrorResult, asTextContentResult } from './types';
3
+ import {
4
+ McpRequestContext,
5
+ McpTool,
6
+ Metadata,
7
+ ToolCallResult,
8
+ asErrorResult,
9
+ asTextContentResult,
10
+ } from './types';
4
11
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
5
- import { readEnv, requireValue } from './server';
12
+ import { readEnv, requireValue } from './util';
6
13
  import { WorkerInput, WorkerOutput } from './code-tool-types';
7
14
  import { SdkMethod } from './methods';
8
- import { LlamaCloud } from '@llamaindex/llama-cloud';
9
15
 
10
16
  const prompt = `Runs JavaScript code to interact with the Llama Cloud API.
11
17
 
@@ -40,7 +46,7 @@ Variables will not persist between calls, so make sure to return or log any data
40
46
  *
41
47
  * @param endpoints - The endpoints to include in the list.
42
48
  */
43
- export function codeTool(params: { blockedMethods: SdkMethod[] | undefined }): McpTool {
49
+ export function codeTool({ blockedMethods }: { blockedMethods: SdkMethod[] | undefined }): McpTool {
44
50
  const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] };
45
51
  const tool: Tool = {
46
52
  name: 'execute',
@@ -60,19 +66,24 @@ export function codeTool(params: { blockedMethods: SdkMethod[] | undefined }): M
60
66
  required: ['code'],
61
67
  },
62
68
  };
63
- const handler = async (client: LlamaCloud, args: any): Promise<ToolCallResult> => {
69
+ const handler = async ({
70
+ reqContext,
71
+ args,
72
+ }: {
73
+ reqContext: McpRequestContext;
74
+ args: any;
75
+ }): Promise<ToolCallResult> => {
64
76
  const code = args.code as string;
65
77
  const intent = args.intent as string | undefined;
78
+ const client = reqContext.client;
66
79
 
67
80
  // Do very basic blocking of code that includes forbidden method names.
68
81
  //
69
82
  // WARNING: This is not secure against obfuscation and other evasion methods. If
70
83
  // stronger security blocks are required, then these should be enforced in the downstream
71
84
  // API (e.g., by having users call the MCP server with API keys with limited permissions).
72
- if (params.blockedMethods) {
73
- const blockedMatches = params.blockedMethods.filter((method) =>
74
- code.includes(method.fullyQualifiedName),
75
- );
85
+ if (blockedMethods) {
86
+ const blockedMatches = blockedMethods.filter((method) => code.includes(method.fullyQualifiedName));
76
87
  if (blockedMatches.length > 0) {
77
88
  return asErrorResult(
78
89
  `The following methods have been blocked by the MCP server and cannot be used in code execution: ${blockedMatches
@@ -82,16 +93,14 @@ export function codeTool(params: { blockedMethods: SdkMethod[] | undefined }): M
82
93
  }
83
94
  }
84
95
 
85
- // this is not required, but passing a Stainless API key for the matching project_name
86
- // will allow you to run code-mode queries against non-published versions of your SDK.
87
- const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
88
96
  const codeModeEndpoint =
89
97
  readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
90
98
 
99
+ // Setting a Stainless API key authenticates requests to the code tool endpoint.
91
100
  const res = await fetch(codeModeEndpoint, {
92
101
  method: 'POST',
93
102
  headers: {
94
- ...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
103
+ ...(reqContext.stainlessApiKey && { Authorization: reqContext.stainlessApiKey }),
95
104
  'Content-Type': 'application/json',
96
105
  client_envs: JSON.stringify({
97
106
  LLAMA_CLOUD_API_KEY: requireValue(
@@ -1,7 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { Metadata, asTextContentResult } from './types';
4
-
3
+ import { Metadata, McpRequestContext, asTextContentResult } from './types';
5
4
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
6
5
 
7
6
  export const metadata: Metadata = {
@@ -42,10 +41,20 @@ export const tool: Tool = {
42
41
  const docsSearchURL =
43
42
  process.env['DOCS_SEARCH_URL'] || 'https://api.stainless.com/api/projects/llamacloud-prod/docs/search';
44
43
 
45
- export const handler = async (_: unknown, args: Record<string, unknown> | undefined) => {
44
+ export const handler = async ({
45
+ reqContext,
46
+ args,
47
+ }: {
48
+ reqContext: McpRequestContext;
49
+ args: Record<string, unknown> | undefined;
50
+ }) => {
46
51
  const body = args as any;
47
52
  const query = new URLSearchParams(body).toString();
48
- const result = await fetch(`${docsSearchURL}?${query}`);
53
+ const result = await fetch(`${docsSearchURL}?${query}`, {
54
+ headers: {
55
+ ...(reqContext.stainlessApiKey && { Authorization: reqContext.stainlessApiKey }),
56
+ },
57
+ });
49
58
 
50
59
  if (!result.ok) {
51
60
  throw new Error(
package/src/http.ts CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
4
4
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
5
+ import { ClientOptions } from '@llamaindex/llama-cloud';
5
6
  import express from 'express';
6
7
  import morgan from 'morgan';
7
8
  import morganBody from 'morgan-body';
9
+ import { getStainlessApiKey, parseClientAuthHeaders } from './auth';
8
10
  import { McpOptions } from './options';
9
- import { ClientOptions, initMcpServer, newMcpServer } from './server';
10
- import { parseAuthHeaders } from './headers';
11
+ import { initMcpServer, newMcpServer } from './server';
11
12
 
12
13
  const newServer = async ({
13
14
  clientOptions,
@@ -20,10 +21,12 @@ const newServer = async ({
20
21
  req: express.Request;
21
22
  res: express.Response;
22
23
  }): Promise<McpServer | null> => {
23
- const server = await newMcpServer();
24
+ const stainlessApiKey = getStainlessApiKey(req, mcpOptions);
25
+ const server = await newMcpServer(stainlessApiKey);
24
26
 
25
27
  try {
26
- const authOptions = parseAuthHeaders(req, false);
28
+ const authOptions = parseClientAuthHeaders(req, false);
29
+
27
30
  await initMcpServer({
28
31
  server: server,
29
32
  mcpOptions: mcpOptions,
@@ -31,6 +34,7 @@ const newServer = async ({
31
34
  ...clientOptions,
32
35
  ...authOptions,
33
36
  },
37
+ stainlessApiKey: stainlessApiKey,
34
38
  });
35
39
  } catch (error) {
36
40
  res.status(401).json({
@@ -111,13 +115,17 @@ export const streamableHTTPApp = ({
111
115
  return app;
112
116
  };
113
117
 
114
- export const launchStreamableHTTPServer = async (params: {
118
+ export const launchStreamableHTTPServer = async ({
119
+ mcpOptions,
120
+ debug,
121
+ port,
122
+ }: {
115
123
  mcpOptions: McpOptions;
116
124
  debug: boolean;
117
125
  port: number | string | undefined;
118
126
  }) => {
119
- const app = streamableHTTPApp({ mcpOptions: params.mcpOptions, debug: params.debug });
120
- const server = app.listen(params.port);
127
+ const app = streamableHTTPApp({ mcpOptions, debug });
128
+ const server = app.listen(port);
121
129
  const address = server.address();
122
130
 
123
131
  if (typeof address === 'string') {
@@ -125,6 +133,6 @@ export const launchStreamableHTTPServer = async (params: {
125
133
  } else if (address !== null) {
126
134
  console.error(`MCP Server running on streamable HTTP on port ${address.port}`);
127
135
  } else {
128
- console.error(`MCP Server running on streamable HTTP on port ${params.port}`);
136
+ console.error(`MCP Server running on streamable HTTP on port ${port}`);
129
137
  }
130
138
  };
package/src/methods.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
1
3
  import { McpOptions } from './options';
2
4
 
3
5
  export type SdkMethod = {
package/src/options.ts CHANGED
@@ -1,7 +1,10 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
1
3
  import qs from 'qs';
2
4
  import yargs from 'yargs';
3
5
  import { hideBin } from 'yargs/helpers';
4
6
  import z from 'zod';
7
+ import { readEnv } from './util';
5
8
 
6
9
  export type CLIOptions = McpOptions & {
7
10
  debug: boolean;
@@ -12,6 +15,7 @@ export type CLIOptions = McpOptions & {
12
15
 
13
16
  export type McpOptions = {
14
17
  includeDocsTools?: boolean | undefined;
18
+ stainlessApiKey?: string | undefined;
15
19
  codeAllowHttpGets?: boolean | undefined;
16
20
  codeAllowedMethods?: string[] | undefined;
17
21
  codeBlockedMethods?: string[] | undefined;
@@ -49,6 +53,12 @@ export function parseCLIOptions(): CLIOptions {
49
53
  description: 'Port to serve on if using http transport',
50
54
  })
51
55
  .option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
56
+ .option('stainless-api-key', {
57
+ type: 'string',
58
+ default: readEnv('STAINLESS_API_KEY'),
59
+ description:
60
+ 'API key for Stainless. Used to authenticate requests to Stainless-hosted tools endpoints.',
61
+ })
52
62
  .option('tools', {
53
63
  type: 'string',
54
64
  array: true,
@@ -79,6 +89,7 @@ export function parseCLIOptions(): CLIOptions {
79
89
  return {
80
90
  ...(includeDocsTools !== undefined && { includeDocsTools }),
81
91
  debug: !!argv.debug,
92
+ stainlessApiKey: argv.stainlessApiKey,
82
93
  codeAllowHttpGets: argv.codeAllowHttpGets,
83
94
  codeAllowedMethods: argv.codeAllowedMethods,
84
95
  codeBlockedMethods: argv.codeBlockedMethods,
package/src/server.ts CHANGED
@@ -13,19 +13,17 @@ import { codeTool } from './code-tool';
13
13
  import docsSearchTool from './docs-search-tool';
14
14
  import { McpOptions } from './options';
15
15
  import { blockedMethodsForCodeTool } from './methods';
16
- import { HandlerFunction, McpTool } from './types';
16
+ import { HandlerFunction, McpRequestContext, ToolCallResult, McpTool } from './types';
17
+ import { readEnv } from './util';
17
18
 
18
- export { McpOptions } from './options';
19
- export { ClientOptions } from '@llamaindex/llama-cloud';
20
-
21
- async function getInstructions() {
22
- // This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
23
- const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
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.
24
22
  const response = await fetch(
25
23
  readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/llamacloud-prod',
26
24
  {
27
25
  method: 'GET',
28
- headers: { ...(stainlessAPIKey && { Authorization: stainlessAPIKey }) },
26
+ headers: { ...(stainlessApiKey && { Authorization: stainlessApiKey }) },
29
27
  },
30
28
  );
31
29
 
@@ -54,14 +52,14 @@ async function getInstructions() {
54
52
  return instructions;
55
53
  }
56
54
 
57
- export const newMcpServer = async () =>
55
+ export const newMcpServer = async (stainlessApiKey: string | undefined) =>
58
56
  new McpServer(
59
57
  {
60
58
  name: 'llamaindex_llama_cloud_api',
61
- version: '1.5.0',
59
+ version: '1.6.0',
62
60
  },
63
61
  {
64
- instructions: await getInstructions(),
62
+ instructions: await getInstructions(stainlessApiKey),
65
63
  capabilities: { tools: {}, logging: {} },
66
64
  },
67
65
  );
@@ -74,6 +72,7 @@ export async function initMcpServer(params: {
74
72
  server: Server | McpServer;
75
73
  clientOptions?: ClientOptions;
76
74
  mcpOptions?: McpOptions;
75
+ stainlessApiKey?: string | undefined;
77
76
  }) {
78
77
  const server = params.server instanceof McpServer ? params.server.server : params.server;
79
78
 
@@ -117,7 +116,14 @@ export async function initMcpServer(params: {
117
116
  throw new Error(`Unknown tool: ${name}`);
118
117
  }
119
118
 
120
- return executeHandler(mcpTool.handler, client, args);
119
+ return executeHandler({
120
+ handler: mcpTool.handler,
121
+ reqContext: {
122
+ client,
123
+ stainlessApiKey: params.stainlessApiKey ?? params.mcpOptions?.stainlessApiKey,
124
+ },
125
+ args,
126
+ });
121
127
  });
122
128
 
123
129
  server.setRequestHandler(SetLevelRequestSchema, async (request) => {
@@ -162,34 +168,14 @@ export function selectTools(options?: McpOptions): McpTool[] {
162
168
  /**
163
169
  * Runs the provided handler with the given client and arguments.
164
170
  */
165
- export async function executeHandler(
166
- handler: HandlerFunction,
167
- client: LlamaCloud,
168
- args: Record<string, unknown> | undefined,
169
- ) {
170
- return await handler(client, args || {});
171
+ export async function executeHandler({
172
+ handler,
173
+ reqContext,
174
+ args,
175
+ }: {
176
+ handler: HandlerFunction;
177
+ reqContext: McpRequestContext;
178
+ args: Record<string, unknown> | undefined;
179
+ }): Promise<ToolCallResult> {
180
+ return await handler({ reqContext, args: args || {} });
171
181
  }
172
-
173
- export const readEnv = (env: string): string | undefined => {
174
- if (typeof (globalThis as any).process !== 'undefined') {
175
- return (globalThis as any).process.env?.[env]?.trim();
176
- } else if (typeof (globalThis as any).Deno !== 'undefined') {
177
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
178
- }
179
- return;
180
- };
181
-
182
- export const readEnvOrError = (env: string): string => {
183
- let envValue = readEnv(env);
184
- if (envValue === undefined) {
185
- throw new Error(`Environment variable ${env} is not set`);
186
- }
187
- return envValue;
188
- };
189
-
190
- export const requireValue = <T>(value: T | undefined, description: string): T => {
191
- if (value === undefined) {
192
- throw new Error(`Missing required value: ${description}`);
193
- }
194
- return value;
195
- };
package/src/stdio.ts CHANGED
@@ -3,9 +3,9 @@ import { McpOptions } from './options';
3
3
  import { initMcpServer, newMcpServer } from './server';
4
4
 
5
5
  export const launchStdioServer = async (mcpOptions: McpOptions) => {
6
- const server = await newMcpServer();
6
+ const server = await newMcpServer(mcpOptions.stainlessApiKey);
7
7
 
8
- await initMcpServer({ server, mcpOptions });
8
+ await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
9
9
 
10
10
  const transport = new StdioServerTransport();
11
11
  await server.connect(transport);
package/src/types.ts CHANGED
@@ -42,10 +42,18 @@ export type ToolCallResult = {
42
42
  isError?: boolean;
43
43
  };
44
44
 
45
- export type HandlerFunction = (
46
- client: LlamaCloud,
47
- args: Record<string, unknown> | undefined,
48
- ) => Promise<ToolCallResult>;
45
+ export type McpRequestContext = {
46
+ client: LlamaCloud;
47
+ stainlessApiKey?: string | undefined;
48
+ };
49
+
50
+ export type HandlerFunction = ({
51
+ reqContext,
52
+ args,
53
+ }: {
54
+ reqContext: McpRequestContext;
55
+ args: Record<string, unknown> | undefined;
56
+ }) => Promise<ToolCallResult>;
49
57
 
50
58
  export function asTextContentResult(result: unknown): ToolCallResult {
51
59
  return {
package/src/util.ts ADDED
@@ -0,0 +1,25 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export const readEnv = (env: string): string | undefined => {
4
+ if (typeof (globalThis as any).process !== 'undefined') {
5
+ return (globalThis as any).process.env?.[env]?.trim();
6
+ } else if (typeof (globalThis as any).Deno !== 'undefined') {
7
+ return (globalThis as any).Deno.env?.get?.(env)?.trim();
8
+ }
9
+ return;
10
+ };
11
+
12
+ export const readEnvOrError = (env: string): string => {
13
+ let envValue = readEnv(env);
14
+ if (envValue === undefined) {
15
+ throw new Error(`Environment variable ${env} is not set`);
16
+ }
17
+ return envValue;
18
+ };
19
+
20
+ export const requireValue = <T>(value: T | undefined, description: string): T => {
21
+ if (value === undefined) {
22
+ throw new Error(`Missing required value: ${description}`);
23
+ }
24
+ return value;
25
+ };
package/stdio.js CHANGED
@@ -4,8 +4,8 @@ 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
6
  const launchStdioServer = async (mcpOptions) => {
7
- const server = await (0, server_1.newMcpServer)();
8
- await (0, server_1.initMcpServer)({ server, mcpOptions });
7
+ const server = await (0, server_1.newMcpServer)(mcpOptions.stainlessApiKey);
8
+ await (0, server_1.initMcpServer)({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
9
9
  const transport = new stdio_js_1.StdioServerTransport();
10
10
  await server.connect(transport);
11
11
  console.error('MCP Server running on stdio');
package/stdio.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,GAAE,CAAC;IAEpC,MAAM,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
1
+ {"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AAEhD,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,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
package/stdio.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
2
  import { initMcpServer, newMcpServer } from "./server.mjs";
3
3
  export const launchStdioServer = async (mcpOptions) => {
4
- const server = await newMcpServer();
5
- await initMcpServer({ server, mcpOptions });
4
+ const server = await newMcpServer(mcpOptions.stainlessApiKey);
5
+ await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
6
6
  const transport = new StdioServerTransport();
7
7
  await server.connect(transport);
8
8
  console.error('MCP Server running on stdio');
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;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;IAEpC,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC"}
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;AAEtC,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,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC"}
package/types.d.mts CHANGED
@@ -31,7 +31,14 @@ export type ToolCallResult = {
31
31
  content: ContentBlock[];
32
32
  isError?: boolean;
33
33
  };
34
- export type HandlerFunction = (client: LlamaCloud, args: Record<string, unknown> | undefined) => Promise<ToolCallResult>;
34
+ export type McpRequestContext = {
35
+ client: LlamaCloud;
36
+ stainlessApiKey?: string | undefined;
37
+ };
38
+ export type HandlerFunction = ({ reqContext, args, }: {
39
+ reqContext: McpRequestContext;
40
+ args: Record<string, unknown> | undefined;
41
+ }) => Promise<ToolCallResult>;
35
42
  export declare function asTextContentResult(result: unknown): ToolCallResult;
36
43
  export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
37
44
  export declare function asErrorResult(message: string): ToolCallResult;
package/types.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO,UAAU,MAAM,yBAAyB;OACzC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EA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MAAM,EAAE,UAAU,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,EAC7B,UAAU,EACV,IAAI,GACL,EAAE;IACD,UAAU,EAAE,iBAAiB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC3C,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAE9B,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CASnE;AAED,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CA2BvF;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAU7D;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC"}
package/types.d.ts CHANGED
@@ -31,7 +31,14 @@ export type ToolCallResult = {
31
31
  content: ContentBlock[];
32
32
  isError?: boolean;
33
33
  };
34
- export type HandlerFunction = (client: LlamaCloud, args: Record<string, unknown> | undefined) => Promise<ToolCallResult>;
34
+ export type McpRequestContext = {
35
+ client: LlamaCloud;
36
+ stainlessApiKey?: string | undefined;
37
+ };
38
+ export type HandlerFunction = ({ reqContext, args, }: {
39
+ reqContext: McpRequestContext;
40
+ args: Record<string, unknown> | undefined;
41
+ }) => Promise<ToolCallResult>;
35
42
  export declare function asTextContentResult(result: unknown): ToolCallResult;
36
43
  export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
37
44
  export declare function asErrorResult(message: string): ToolCallResult;
package/types.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO,UAAU,MAAM,yBAAyB;OACzC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EACJ;QACE,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,GACD;QACE,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACP,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAE3G,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAC5B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,CAAC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L,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7C,CAAC;IACJ,CAAC;SAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7C,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,UAAU;oBAChB,QAAQ,EAAE;wBACR,uEAAuE;wBACvE,GAAG,EAAE,0BAA0B;wBAC/B,QAAQ;wBACR,IAAI,EAAE,IAAI;qBACX;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO;aACd;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
package/util.d.mts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const readEnv: (env: string) => string | undefined;
2
+ export declare const readEnvOrError: (env: string) => string;
3
+ export declare const requireValue: <T>(value: T | undefined, description: string) => T;
4
+ //# sourceMappingURL=util.d.mts.map