@llamaindex/llama-cloud-mcp 1.4.0 → 1.5.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 (56) hide show
  1. package/code-tool.d.mts +4 -1
  2. package/code-tool.d.mts.map +1 -1
  3. package/code-tool.d.ts +4 -1
  4. package/code-tool.d.ts.map +1 -1
  5. package/code-tool.js +14 -1
  6. package/code-tool.js.map +1 -1
  7. package/code-tool.mjs +14 -1
  8. package/code-tool.mjs.map +1 -1
  9. package/http.d.mts.map +1 -1
  10. package/http.d.ts.map +1 -1
  11. package/http.js +5 -1
  12. package/http.js.map +1 -1
  13. package/http.mjs +5 -1
  14. package/http.mjs.map +1 -1
  15. package/index.js +1 -1
  16. package/index.js.map +1 -1
  17. package/index.mjs +1 -1
  18. package/index.mjs.map +1 -1
  19. package/methods.d.mts +10 -0
  20. package/methods.d.mts.map +1 -0
  21. package/methods.d.ts +10 -0
  22. package/methods.d.ts.map +1 -0
  23. package/methods.js +790 -0
  24. package/methods.js.map +1 -0
  25. package/methods.mjs +786 -0
  26. package/methods.mjs.map +1 -0
  27. package/options.d.mts +3 -0
  28. package/options.d.mts.map +1 -1
  29. package/options.d.ts +3 -0
  30. package/options.d.ts.map +1 -1
  31. package/options.js +17 -0
  32. package/options.js.map +1 -1
  33. package/options.mjs +17 -0
  34. package/options.mjs.map +1 -1
  35. package/package.json +12 -2
  36. package/server.d.mts.map +1 -1
  37. package/server.d.ts.map +1 -1
  38. package/server.js +11 -6
  39. package/server.js.map +1 -1
  40. package/server.mjs +11 -6
  41. package/server.mjs.map +1 -1
  42. package/src/code-tool.ts +20 -1
  43. package/src/http.ts +6 -0
  44. package/src/index.ts +1 -1
  45. package/src/methods.ts +810 -0
  46. package/src/options.ts +23 -0
  47. package/src/server.ts +11 -6
  48. package/src/stdio.ts +3 -2
  49. package/stdio.d.mts +2 -1
  50. package/stdio.d.mts.map +1 -1
  51. package/stdio.d.ts +2 -1
  52. package/stdio.d.ts.map +1 -1
  53. package/stdio.js +2 -2
  54. package/stdio.js.map +1 -1
  55. package/stdio.mjs +2 -2
  56. package/stdio.mjs.map +1 -1
package/src/options.ts CHANGED
@@ -12,10 +12,30 @@ export type CLIOptions = McpOptions & {
12
12
 
13
13
  export type McpOptions = {
14
14
  includeDocsTools?: boolean | undefined;
15
+ codeAllowHttpGets?: boolean | undefined;
16
+ codeAllowedMethods?: string[] | undefined;
17
+ codeBlockedMethods?: string[] | undefined;
15
18
  };
16
19
 
17
20
  export function parseCLIOptions(): CLIOptions {
18
21
  const opts = yargs(hideBin(process.argv))
22
+ .option('code-allow-http-gets', {
23
+ type: 'boolean',
24
+ description:
25
+ 'Allow all code tool methods that map to HTTP GET operations. If all code-allow-* flags are unset, then everything is allowed.',
26
+ })
27
+ .option('code-allowed-methods', {
28
+ type: 'string',
29
+ array: true,
30
+ description:
31
+ 'Methods to explicitly allow for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
32
+ })
33
+ .option('code-blocked-methods', {
34
+ type: 'string',
35
+ array: true,
36
+ description:
37
+ '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.',
38
+ })
19
39
  .option('debug', { type: 'boolean', description: 'Enable debug logging' })
20
40
  .option('no-tools', {
21
41
  type: 'string',
@@ -59,6 +79,9 @@ export function parseCLIOptions(): CLIOptions {
59
79
  return {
60
80
  ...(includeDocsTools !== undefined && { includeDocsTools }),
61
81
  debug: !!argv.debug,
82
+ codeAllowHttpGets: argv.codeAllowHttpGets,
83
+ codeAllowedMethods: argv.codeAllowedMethods,
84
+ codeBlockedMethods: argv.codeBlockedMethods,
62
85
  transport,
63
86
  port: argv.port,
64
87
  socket: argv.socket,
package/src/server.ts CHANGED
@@ -12,6 +12,7 @@ import LlamaCloud from '@llamaindex/llama-cloud';
12
12
  import { codeTool } from './code-tool';
13
13
  import docsSearchTool from './docs-search-tool';
14
14
  import { McpOptions } from './options';
15
+ import { blockedMethodsForCodeTool } from './methods';
15
16
  import { HandlerFunction, McpTool } from './types';
16
17
 
17
18
  export { McpOptions } from './options';
@@ -36,10 +37,10 @@ async function getInstructions() {
36
37
 
37
38
  instructions = `
38
39
  This is the llamacloud-prod MCP server. You will use Code Mode to help the user perform
39
- actions. You can use search_docs tool to learn about how to take action with this server. Then,
40
- you will write TypeScript code using the execute tool take action. It is CRITICAL that you be
41
- thoughtful and deliberate when executing code. Always try to entirely solve the problem in code
42
- block: it can be as long as you need to get the job done!
40
+ actions. You can use search_docs tool to learn about how to take action with this server. Then,
41
+ you will write TypeScript code using the execute tool take action. It is CRITICAL that you be
42
+ thoughtful and deliberate when executing code. Always try to entirely solve the problem in code
43
+ block: it can be as long as you need to get the job done!
43
44
  `;
44
45
  }
45
46
 
@@ -57,7 +58,7 @@ export const newMcpServer = async () =>
57
58
  new McpServer(
58
59
  {
59
60
  name: 'llamaindex_llama_cloud_api',
60
- version: '1.4.0',
61
+ version: '1.5.0',
61
62
  },
62
63
  {
63
64
  instructions: await getInstructions(),
@@ -147,7 +148,11 @@ export async function initMcpServer(params: {
147
148
  * Selects the tools to include in the MCP Server based on the provided options.
148
149
  */
149
150
  export function selectTools(options?: McpOptions): McpTool[] {
150
- const includedTools = [codeTool()];
151
+ const includedTools = [
152
+ codeTool({
153
+ blockedMethods: blockedMethodsForCodeTool(options),
154
+ }),
155
+ ];
151
156
  if (options?.includeDocsTools ?? true) {
152
157
  includedTools.push(docsSearchTool);
153
158
  }
package/src/stdio.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
+ import { McpOptions } from './options';
2
3
  import { initMcpServer, newMcpServer } from './server';
3
4
 
4
- export const launchStdioServer = async () => {
5
+ export const launchStdioServer = async (mcpOptions: McpOptions) => {
5
6
  const server = await newMcpServer();
6
7
 
7
- await initMcpServer({ server });
8
+ await initMcpServer({ server, mcpOptions });
8
9
 
9
10
  const transport = new StdioServerTransport();
10
11
  await server.connect(transport);
package/stdio.d.mts CHANGED
@@ -1,2 +1,3 @@
1
- export declare const launchStdioServer: () => Promise<void>;
1
+ import { McpOptions } from "./options.mjs";
2
+ export declare const launchStdioServer: (mcpOptions: McpOptions) => Promise<void>;
2
3
  //# sourceMappingURL=stdio.d.mts.map
package/stdio.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,qBAQ7B,CAAC"}
1
+ {"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAGrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAQ7D,CAAC"}
package/stdio.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export declare const launchStdioServer: () => Promise<void>;
1
+ import { McpOptions } from "./options.js";
2
+ export declare const launchStdioServer: (mcpOptions: McpOptions) => Promise<void>;
2
3
  //# sourceMappingURL=stdio.d.ts.map
package/stdio.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,qBAQ7B,CAAC"}
1
+ {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAGrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAQ7D,CAAC"}
package/stdio.js CHANGED
@@ -3,9 +3,9 @@ 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 launchStdioServer = async () => {
6
+ const launchStdioServer = async (mcpOptions) => {
7
7
  const server = await (0, server_1.newMcpServer)();
8
- await (0, server_1.initMcpServer)({ server });
8
+ await (0, server_1.initMcpServer)({ server, mcpOptions });
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;AACjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IAC1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,GAAE,CAAC;IAEpC,MAAM,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEhC,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,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"}
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
- export const launchStdioServer = async () => {
3
+ export const launchStdioServer = async (mcpOptions) => {
4
4
  const server = await newMcpServer();
5
- await initMcpServer({ server });
5
+ await initMcpServer({ server, mcpOptions });
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;OACzE,EAAE,aAAa,EAAE,YAAY,EAAE;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IAC1C,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;IAEpC,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEhC,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,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"}