@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.
- package/code-tool.d.mts +4 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +4 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +14 -1
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +14 -1
- package/code-tool.mjs.map +1 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts.map +1 -1
- package/http.js +5 -1
- package/http.js.map +1 -1
- package/http.mjs +5 -1
- package/http.mjs.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +790 -0
- package/methods.js.map +1 -0
- package/methods.mjs +786 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +3 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +3 -0
- package/options.d.ts.map +1 -1
- package/options.js +17 -0
- package/options.js.map +1 -1
- package/options.mjs +17 -0
- package/options.mjs.map +1 -1
- package/package.json +12 -2
- package/server.d.mts.map +1 -1
- package/server.d.ts.map +1 -1
- package/server.js +11 -6
- package/server.js.map +1 -1
- package/server.mjs +11 -6
- package/server.mjs.map +1 -1
- package/src/code-tool.ts +20 -1
- package/src/http.ts +6 -0
- package/src/index.ts +1 -1
- package/src/methods.ts +810 -0
- package/src/options.ts +23 -0
- package/src/server.ts +11 -6
- package/src/stdio.ts +3 -2
- package/stdio.d.mts +2 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +2 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +2 -2
- package/stdio.js.map +1 -1
- package/stdio.mjs +2 -2
- 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.
|
|
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 = [
|
|
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
package/stdio.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"
|
|
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
package/stdio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"
|
|
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;
|
|
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;
|
|
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"}
|