@nextclaw/ncp-mcp 0.1.67 → 0.1.69
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/dist/index.d.ts +19 -17
- package/dist/index.js +29 -38
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { NcpTool } from
|
|
2
|
-
import {
|
|
1
|
+
import { NcpTool } from "@nextclaw/ncp";
|
|
2
|
+
import { McpRegistryService, McpToolCatalogEntry } from "@nextclaw/mcp";
|
|
3
3
|
|
|
4
|
+
//#region src/mcp-ncp-tool.d.ts
|
|
4
5
|
declare class McpNcpTool implements NcpTool {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
private readonly entry;
|
|
7
|
+
private readonly executeImpl;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly description?: string;
|
|
10
|
+
readonly parameters?: Record<string, unknown>;
|
|
11
|
+
constructor(entry: McpToolCatalogEntry, executeImpl: (entry: McpToolCatalogEntry, args: Record<string, unknown>) => Promise<unknown>);
|
|
12
|
+
execute(args: unknown): Promise<unknown>;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/mcp-ncp-tool-registry-adapter.d.ts
|
|
14
16
|
declare class McpNcpToolRegistryAdapter {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
private readonly registryService;
|
|
18
|
+
constructor(registryService: McpRegistryService);
|
|
19
|
+
listToolsForRun(context: {
|
|
20
|
+
agentId: string;
|
|
21
|
+
}): McpNcpTool[];
|
|
20
22
|
}
|
|
21
|
-
|
|
22
|
-
export { McpNcpTool, McpNcpToolRegistryAdapter };
|
|
23
|
+
//#endregion
|
|
24
|
+
export { McpNcpTool, McpNcpToolRegistryAdapter };
|
package/dist/index.js
CHANGED
|
@@ -1,44 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/mcp-ncp-tool.ts
|
|
2
2
|
var McpNcpTool = class {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
name;
|
|
4
|
+
description;
|
|
5
|
+
parameters;
|
|
6
|
+
constructor(entry, executeImpl) {
|
|
7
|
+
this.entry = entry;
|
|
8
|
+
this.executeImpl = executeImpl;
|
|
9
|
+
this.name = entry.qualifiedName;
|
|
10
|
+
this.description = entry.description;
|
|
11
|
+
this.parameters = entry.parameters;
|
|
12
|
+
}
|
|
13
|
+
async execute(args) {
|
|
14
|
+
return this.executeImpl(this.entry, isRecord(args) ? args : {});
|
|
15
|
+
}
|
|
16
16
|
};
|
|
17
17
|
function isRecord(value) {
|
|
18
|
-
|
|
18
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/mcp-ncp-tool-registry-adapter.ts
|
|
22
22
|
var McpNcpToolRegistryAdapter = class {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
serverName: toolEntry.serverName,
|
|
34
|
-
toolName: toolEntry.toolName,
|
|
35
|
-
args
|
|
36
|
-
})
|
|
37
|
-
)
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
export {
|
|
42
|
-
McpNcpTool,
|
|
43
|
-
McpNcpToolRegistryAdapter
|
|
23
|
+
constructor(registryService) {
|
|
24
|
+
this.registryService = registryService;
|
|
25
|
+
}
|
|
26
|
+
listToolsForRun(context) {
|
|
27
|
+
return this.registryService.listAccessibleTools({ agentId: context.agentId }).map((entry) => new McpNcpTool(entry, async (toolEntry, args) => this.registryService.callTool({
|
|
28
|
+
serverName: toolEntry.serverName,
|
|
29
|
+
toolName: toolEntry.toolName,
|
|
30
|
+
args
|
|
31
|
+
})));
|
|
32
|
+
}
|
|
44
33
|
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { McpNcpTool, McpNcpToolRegistryAdapter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/ncp-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.69",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Thin NCP adapter for exposing platform MCP tools inside NextClaw NCP runtimes.",
|
|
6
6
|
"type": "module",
|
|
@@ -15,18 +15,17 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@nextclaw/mcp": "0.1.
|
|
18
|
+
"@nextclaw/mcp": "0.1.67",
|
|
19
19
|
"@nextclaw/ncp": "0.5.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^20.17.6",
|
|
23
23
|
"prettier": "^3.3.3",
|
|
24
|
-
"tsup": "^8.3.5",
|
|
25
24
|
"typescript": "^5.6.3",
|
|
26
25
|
"vitest": "^4.1.2"
|
|
27
26
|
},
|
|
28
27
|
"scripts": {
|
|
29
|
-
"build": "
|
|
28
|
+
"build": "tsdown src/index.ts --dts --clean --target es2022 --no-fixedExtension",
|
|
30
29
|
"lint": "cd ../../.. && pnpm exec eslint packages/ncp-packages/nextclaw-ncp-mcp --config packages/ncp-packages/nextclaw-ncp-mcp/eslint.config.mjs",
|
|
31
30
|
"tsc": "tsc -p tsconfig.json",
|
|
32
31
|
"test": "vitest run"
|