mcp-stdio-proxy 0.1.15

MCP (Model Context Protocol) proxy server and CLI tool for protocol conversion and remote service access
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
### 测试检查MySQL MCP服务状态
# @name checkMySqlStatus
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "mysql-test-id",
  "mcpJsonConfig": "{\"mcpServers\": {\"mysql\": {\"command\": \"/Users/soddy/go/bin/go-mcp-mysql\", \"args\": [\"--host\", \"192.168.1.12\", \"--user\", \"agent_platform_test\", \"--pass\", \"SRJG7NdiwKGDkmPs\", \"--port\", \"3306\", \"--db\", \"agent_platform_test\"], \"env\": {}}}}",
  "mcpType": "Persistent"
}
### 测试检查MySQL MCP服务状态2
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "mysql-test-id",
  "mcpJsonConfig": "{\"mcpServers\":{\"howtocook-mcp\":{\"command\":\"npx\",\"args\":[\"-y\",\"howtocook-mcp\"]}}}",
  "mcpType": "Persistent"
}


### 测试检查百度OCR MCP服务状态
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "baidu-ocr-test-id2",
  "mcpJsonConfig": "{\"mcpServers\":{\"ocr_edu\":{\"url\":\"https://aip.baidubce.com/mcp/image_recognition/sse?Authorization=Bearer%20bce-v3/ALTAK-zX2w0VFXauTMxEf5BypEl/1835f7e1886946688b132e9187392d9fee8f3c06\"}}}",
  "mcpType": "OneShot"
}


### 测试检查context7
POST http://localhost:8087/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "context7-test-id",
  "mcpJsonConfig": "{\"mcpServers\":{\"fetch\":{\"command\":\"npx\",\"args\":[\"-y\",\"@upstash/context7-mcp\"]}}}",
  "mcpType": "Persistent"
}

### 测试检查MySQL MCP服务状态2
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "fetch-test-id",
  "mcpJsonConfig": "{\"mcpServers\":{\"fetch\":{\"command\":\"uvx\",\"args\":[\"mcp-server-fetch\"]}}}",
  "mcpType": "Persistent"
}

### 测试mcp的参考地址: http://localhost:8086/mcp/mysql-test-id/sse

### 提取返回的状态信息
@ready = {{checkMySqlStatus.response.body.data.ready}}
@status = {{checkMySqlStatus.response.body.data.status}}
@message = {{checkMySqlStatus.response.body.data.message}}

### 测试检查一次性任务MCP服务状态
# @name checkOneShotStatus
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "mysql-query-oneshot",
  "mcpJsonConfig": "{\"mcpServers\": {\"mysql\": {\"command\": \"/Users/soddy/go/bin/go-mcp-mysql\", \"args\": [\"--host\", \"192.168.1.12\", \"--user\", \"agent_platform_test\", \"--pass\", \"SRJG7NdiwKGDkmPs\", \"--port\", \"3306\", \"--db\", \"agent_platform_test\"], \"env\": {}}}}",
  "mcpType": "OneShot"
}

### 测试检查Python脚本服务状态
# @name checkPythonStatus
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "python-service-test",
  "mcpJsonConfig": "{\"mcpServers\": {\"python\": {\"command\": \"python3\", \"args\": [\"-c\", \"import time, datetime; print('Python MCP服务启动'); count=0; while True: count+=1; print(f'当前时间: {datetime.datetime.now()} - 计数: {count}'); time.sleep(3);\"], \"env\": {\"PYTHONUNBUFFERED\": \"1\"}}}}",
  "mcpType": "OneShot"
}

### 测试检查本地命令服务状态
# @name checkLocalCommandStatus
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "local-echo-test",
  "mcpJsonConfig": "{\"mcpServers\": {\"echo\": {\"command\": \"bash\", \"args\": [\"-c\", \"while true; do echo \\\"Hello from MCP $(date)\\\"; sleep 5; done\"], \"env\": {\"TEST_VAR\": \"test_value\"}}}}",
  "mcpType": "Persistent"
}

### 测试检查已存在服务的状态
# @name checkExistingStatus
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "mysql-test-id",
  "mcpJsonConfig": "{\"mcpServers\": {\"mysql\": {\"command\": \"/Users/soddy/go/bin/go-mcp-mysql\", \"args\": [\"--host\", \"192.168.1.12\", \"--user\", \"agent_platform_test\", \"--pass\", \"SRJG7NdiwKGDkmPs\", \"--port\", \"3306\", \"--db\", \"agent_platform_test\"], \"env\": {}}}}",
  "mcpType": "Persistent"
}

### 测试检查不存在的服务状态(错误配置测试)
# @name checkErrorStatus
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "error-test",
  "mcpJsonConfig": "{\"mcpServers\": {\"error\": {\"command\": \"/not/exist/command\", \"args\": [], \"env\": {}}}}",
  "mcpType": "OneShot"
}

### ========== 百度OCR MCP服务测试 ==========

### 1. 首先检查百度OCR MCP服务状态(确保服务已启动)
# @name checkBaiduOcrStatus
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "baidu-ocr-test-id2",
  "mcpJsonConfig": "{\"mcpServers\":{\"ocr_edu\":{\"url\":\"https://aip.baidubce.com/mcp/image_recognition/sse?Authorization=Bearer%20bce-v3/ALTAK-zX2w0VFXauTMxEf5BypEl/1835f7e1886946688b132e9187392d9fee8f3c06\"}}}",
  "mcpType": "OneShot"
}

### 提取百度OCR服务的信息
@baidu_mcp_id = baidu-ocr-test-id2
@baidu_ready = {{checkBaiduOcrStatus.response.body.data.ready}}
@baidu_status = {{checkBaiduOcrStatus.response.body.data.status}}

### 2. 测试获取百度OCR MCP服务的工具列表
# @name getBaiduOcrTools
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "tools_001",
  "method": "tools/list",
  "params": {}
}

### 3. 测试获取百度OCR MCP服务的资源列表
# @name getBaiduOcrResources
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "resources_001",
  "method": "resources/list",
  "params": {}
}

### 4. 测试获取百度OCR MCP服务的提示列表
# @name getBaiduOcrPrompts
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "prompts_001",
  "method": "prompts/list",
  "params": {}
}

### 5. 测试调用百度OCR工具 - 通用文字识别
# @name callBaiduOcrGeneral
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "ocr_general_001",
  "method": "tools/call",
  "params": {
    "name": "general_basic",
    "arguments": {
      "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k="
    }
  }
}

### 6. 测试调用百度OCR工具 - 身份证识别
# @name callBaiduOcrIdCard
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "ocr_idcard_001",
  "method": "tools/call",
  "params": {
    "name": "idcard",
    "arguments": {
      "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k=",
      "id_card_side": "front"
    }
  }
}

### 7. 测试调用百度OCR工具 - 银行卡识别
# @name callBaiduOcrBankCard
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "ocr_bankcard_001",
  "method": "tools/call",
  "params": {
    "name": "bankcard",
    "arguments": {
      "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k="
    }
  }
}

### 8. 测试调用百度OCR工具 - 驾驶证识别
# @name callBaiduOcrDriverLicense
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "ocr_driver_001",
  "method": "tools/call",
  "params": {
    "name": "driving_license",
    "arguments": {
      "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k="
    }
  }
}

### 9. 测试调用百度OCR工具 - 营业执照识别
# @name callBaiduOcrBusinessLicense
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "ocr_business_001",
  "method": "tools/call",
  "params": {
    "name": "business_license",
    "arguments": {
      "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k="
    }
  }
}

### 10. 测试调用百度OCR工具 - 表格识别
# @name callBaiduOcrTable
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "ocr_table_001",
  "method": "tools/call",
  "params": {
    "name": "table",
    "arguments": {
      "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k="
    }
  }
}

### 11. 测试获取百度OCR服务信息
# @name getBaiduOcrServerInfo
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "server_info_001",
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "capabilities": {
      "roots": {
        "listChanged": true
      },
      "sampling": {}
    },
    "clientInfo": {
      "name": "test-client",
      "version": "1.0.0"
    }
  }
}

### 12. 测试ping百度OCR服务
# @name pingBaiduOcrService
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "ping_001",
  "method": "ping",
  "params": {}
}

### ========== 百度OCR SSE连接测试 ==========

### 13. SSE连接测试(在浏览器中打开以下URL来测试实时连接)
# 打开浏览器访问: http://localhost:8086/mcp/sse/proxy/baidu-ocr-test-id2/sse
# 这将建立SSE连接,你可以看到实时的消息流

### ========== 使用真实图片的测试示例 ==========

### 14. 使用真实图片进行通用文字识别测试
# 注意:请将下面的base64字符串替换为你的真实图片的base64编码
# @name callBaiduOcrRealImage
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "ocr_real_001",
  "method": "tools/call",
  "params": {
    "name": "general_basic",
    "arguments": {
      "image": "请将此处替换为真实图片的base64编码",
      "language_type": "CHN_ENG",
      "detect_direction": "true",
      "detect_language": "true",
      "probability": "true"
    }
  }
}

### 15. 测试错误处理 - 无效的工具名称
# @name testInvalidTool
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "error_test_001",
  "method": "tools/call",
  "params": {
    "name": "invalid_tool_name",
    "arguments": {}
  }
}

### 16. 测试错误处理 - 无效的图片数据
# @name testInvalidImage
POST http://localhost:8086/mcp/sse/proxy/{{baidu_mcp_id}}/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "error_test_002",
  "method": "tools/call",
  "params": {
    "name": "general_basic",
    "arguments": {
      "image": "invalid_base64_data"
    }
  }
}
### ===
======= 调试百度OCR服务问题 ==========

### 调试1: 重新检查百度OCR服务状态并获取正确路径
# @name debugBaiduOcrStatus
POST http://localhost:8086/mcp/sse/check_status
Content-Type: application/json

{
  "mcpId": "baidu-ocr-test-id2",
  "mcpJsonConfig": "{\"mcpServers\":{\"ocr_edu\":{\"url\":\"https://aip.baidubce.com/mcp/image_recognition/sse?Authorization=Bearer%20bce-v3/ALTAK-zX2w0VFXauTMxEf5BypEl/1835f7e1886946688b132e9187392d9fee8f3c06\"}}}",
  "mcpType": "OneShot"
}

### 提取调试信息
@debug_ready = {{debugBaiduOcrStatus.response.body.data.ready}}
@debug_status = {{debugBaiduOcrStatus.response.body.data.status}}
@debug_message = {{debugBaiduOcrStatus.response.body.data.message}}

### 调试2: 测试简单的初始化请求(不需要sessionId)
# @name debugInitialize
POST http://localhost:8086/mcp/sse/proxy/baidu-ocr-test-id2/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "init_001",
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "capabilities": {
      "roots": {
        "listChanged": true
      },
      "sampling": {}
    },
    "clientInfo": {
      "name": "test-client",
      "version": "1.0.0"
    }
  }
}

### 调试3: 测试带sessionId的请求
# @name debugWithSessionId
POST http://localhost:8086/mcp/sse/proxy/baidu-ocr-test-id2/message?sessionId=test-session-001
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "tools_with_session_001",
  "method": "tools/list",
  "params": {}
}

### 调试4: 测试不同的路径格式
# @name debugAlternatePath
POST http://localhost:8086/mcp/sse/proxy/baidu-ocr-test-id2/message
Content-Type: application/json
x-session-id: test-session-001

{
  "jsonrpc": "2.0",
  "id": "tools_header_session_001",
  "method": "tools/list",
  "params": {
    "sessionId": "test-session-001"
  }
}

### 调试5: 检查服务器是否正确处理URL配置
# @name debugUrlConfig
POST http://localhost:8086/mcp/sse/proxy/baidu-ocr-test-id2/message
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "ping_debug_001",
  "method": "ping",
  "params": {}
}