nuwax-mcp-stdio-proxy 1.4.1 → 1.4.2

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.js CHANGED
@@ -23761,7 +23761,7 @@ var StdioServerTransport = class {
23761
23761
 
23762
23762
  // src/constants.ts
23763
23763
  var PKG_NAME = "nuwax-mcp-stdio-proxy";
23764
- var PKG_VERSION = "1.4.1";
23764
+ var PKG_VERSION = "1.4.2";
23765
23765
 
23766
23766
  // src/shared.ts
23767
23767
  async function discoverTools(client) {
@@ -23865,11 +23865,21 @@ async function runStdio(config2, allowTools, denyTools) {
23865
23865
  const { client, cleanup } = connected;
23866
23866
  clients.set(id, client);
23867
23867
  cleanups.set(id, cleanup);
23868
- const allServerTools = await discoverTools(client);
23868
+ let serverTools = await discoverTools(client);
23869
+ if (entry.allowTools || entry.denyTools) {
23870
+ const perFilter = {};
23871
+ if (entry.allowTools) perFilter.allowTools = new Set(entry.allowTools);
23872
+ if (entry.denyTools) perFilter.denyTools = new Set(entry.denyTools);
23873
+ const before = serverTools.length;
23874
+ serverTools = filterTools(serverTools, perFilter);
23875
+ if (serverTools.length !== before) {
23876
+ logInfo(`Server "${id}": filtered ${before} \u2192 ${serverTools.length} tool(s)`);
23877
+ }
23878
+ }
23869
23879
  logInfo(
23870
- `Server "${id}": ${allServerTools.length} tool(s)${allServerTools.length > 0 ? " \u2014 " + allServerTools.map((t) => t.name).join(", ") : ""}`
23880
+ `Server "${id}": ${serverTools.length} tool(s)${serverTools.length > 0 ? " \u2014 " + serverTools.map((t) => t.name).join(", ") : ""}`
23871
23881
  );
23872
- for (const tool of allServerTools) {
23882
+ for (const tool of serverTools) {
23873
23883
  if (toolToClient.has(tool.name)) {
23874
23884
  logWarn(
23875
23885
  `Tool "${tool.name}" from "${id}" shadows existing tool from "${toolToServer.get(tool.name)}"`
@@ -38,9 +38,22 @@ export async function runStdio(config, allowTools, denyTools) {
38
38
  const { client, cleanup } = connected;
39
39
  clients.set(id, client);
40
40
  cleanups.set(id, cleanup);
41
- const allServerTools = await discoverTools(client);
42
- logInfo(`Server "${id}": ${allServerTools.length} tool(s)${allServerTools.length > 0 ? ' — ' + allServerTools.map((t) => t.name).join(', ') : ''}`);
43
- for (const tool of allServerTools) {
41
+ let serverTools = await discoverTools(client);
42
+ // Per-server tool filtering (allowTools/denyTools in config entry)
43
+ if (entry.allowTools || entry.denyTools) {
44
+ const perFilter = {};
45
+ if (entry.allowTools)
46
+ perFilter.allowTools = new Set(entry.allowTools);
47
+ if (entry.denyTools)
48
+ perFilter.denyTools = new Set(entry.denyTools);
49
+ const before = serverTools.length;
50
+ serverTools = filterTools(serverTools, perFilter);
51
+ if (serverTools.length !== before) {
52
+ logInfo(`Server "${id}": filtered ${before} → ${serverTools.length} tool(s)`);
53
+ }
54
+ }
55
+ logInfo(`Server "${id}": ${serverTools.length} tool(s)${serverTools.length > 0 ? ' — ' + serverTools.map((t) => t.name).join(', ') : ''}`);
56
+ for (const tool of serverTools) {
44
57
  if (toolToClient.has(tool.name)) {
45
58
  logWarn(`Tool "${tool.name}" from "${id}" shadows existing tool from "${toolToServer.get(tool.name)}"`);
46
59
  }
package/dist/types.d.ts CHANGED
@@ -6,6 +6,10 @@ export interface StdioServerEntry {
6
6
  command: string;
7
7
  args?: string[];
8
8
  env?: Record<string, string>;
9
+ /** 工具白名单(只暴露指定工具) */
10
+ allowTools?: string[];
11
+ /** 工具黑名单(排除指定工具) */
12
+ denyTools?: string[];
9
13
  }
10
14
  /**
11
15
  * Streamable HTTP 类型: 连接远程 MCP server (Streamable HTTP)
@@ -18,6 +22,10 @@ export interface StreamableServerEntry {
18
22
  transport?: 'streamable-http';
19
23
  headers?: Record<string, string>;
20
24
  authToken?: string;
25
+ /** 工具白名单(只暴露指定工具) */
26
+ allowTools?: string[];
27
+ /** 工具黑名单(排除指定工具) */
28
+ denyTools?: string[];
21
29
  }
22
30
  /**
23
31
  * SSE 类型: 连接远程 MCP server (Server-Sent Events)
@@ -29,6 +37,10 @@ export interface SseServerEntry {
29
37
  transport: 'sse';
30
38
  headers?: Record<string, string>;
31
39
  authToken?: string;
40
+ /** 工具白名单(只暴露指定工具) */
41
+ allowTools?: string[];
42
+ /** 工具黑名单(排除指定工具) */
43
+ denyTools?: string[];
32
44
  }
33
45
  export type McpServerEntry = StdioServerEntry | StreamableServerEntry | SseServerEntry;
34
46
  export declare function isSseEntry(entry: McpServerEntry): entry is SseServerEntry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuwax-mcp-stdio-proxy",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "TypeScript MCP proxy — aggregates multiple MCP servers (stdio + streamable-http + SSE) with convert & proxy modes",
5
5
  "type": "module",
6
6
  "bin": {