@takch02/server-doctor 1.0.1 → 1.0.3

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 (2) hide show
  1. package/index.js +19 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,14 +4,14 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
4
4
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
6
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
7
- import EventSource from "eventsource";
7
+ import { createRequire } from "module";
8
+
9
+ const require = createRequire(import.meta.url);
10
+ const EventSource = require("eventsource");
11
+ global.EventSource = EventSource;
8
12
 
9
- // ⭐ AWS 서버 주소 (포트 80이니까 포트 생략 OK)
10
- // 만약 로컬 테스트 중이면 http://127.0.0.1:8080/mcp/sse
11
13
  const SERVER_URL = "http://ec2-52-79-247-25.ap-northeast-2.compute.amazonaws.com/mcp/sse";
12
14
 
13
- // SSE 전역 설정 (Node.js 환경용)
14
- global.EventSource = EventSource;
15
15
 
16
16
  async function main() {
17
17
  // 1. AWS 서버와 연결 (Client 역할)
@@ -41,11 +41,20 @@ async function main() {
41
41
  for (const tool of tools.tools) {
42
42
  // AWS 서버의 도구를 그대로 중계(Forwarding) 등록
43
43
  server.tool(tool.name, tool.description, tool.inputSchema, async (args) => {
44
- // Claude가 호출하면 -> AWS 서버로 전달
45
- const result = await client.callTool({
46
- name: tool.name,
47
- arguments: args,
48
- });
44
+
45
+ console.error(`[Bridge Debug] Tool: ${tool.name}`);
46
+ console.error(`[Bridge Debug] RawArgs:`, JSON.stringify(rawArgs));
47
+
48
+ let realArgs = rawArgs;
49
+
50
+ if (rawArgs && (rawArgs.signal || rawArgs.requestId)) {
51
+ console.error("⚠️ 인자 위치 오류 감지! 메타데이터가 args로 들어왔습니다.");
52
+ realArgs = {};
53
+ }
54
+ const result = await client.callTool({
55
+ name: tool.name,
56
+ arguments: realArgs, // 정제된 인자 전송
57
+ });
49
58
  return result;
50
59
  });
51
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takch02/server-doctor",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "index.js",