@szc-ft/mcp-szcd-client 0.39.1 → 0.39.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/mcp-proxy.js CHANGED
@@ -134,6 +134,7 @@ const TRANSPORT_MODE = {
134
134
 
135
135
  let currentMode = null;
136
136
  let httpSessionId = null;
137
+ let initializeResult = null;
137
138
 
138
139
  // ==================== Streamable HTTP 转发 ====================
139
140
 
@@ -468,6 +469,10 @@ async function detectTransportMode() {
468
469
  if (result.result || (result.id === "detect" && !result.error?.message?.includes("Not Acceptable"))) {
469
470
  currentMode = TRANSPORT_MODE.STREAMABLE_HTTP;
470
471
  log(`Transport mode: Streamable HTTP (POST /mcp)`);
472
+ // 缓存 initialize 结果,用于后续本地回复 OpenCode 的 initialize
473
+ if (result.result) {
474
+ initializeResult = result.result;
475
+ }
471
476
  // 保留 sessionId,用于后续请求
472
477
  return;
473
478
  }
@@ -520,11 +525,24 @@ async function main() {
520
525
 
521
526
  switch (currentMode) {
522
527
  case TRANSPORT_MODE.STREAMABLE_HTTP:
523
- response = await forwardToStreamableHttp(msg);
528
+ if (msg.method === "initialize") {
529
+ // initialize 已经在检测时完成,使用缓存结果本地回复
530
+ response = {
531
+ jsonrpc: "2.0",
532
+ id: msgId,
533
+ result: initializeResult || {
534
+ protocolVersion: "2024-11-05",
535
+ serverInfo: { name: "mcp-szcd-component-helper", version: "0.10.0" },
536
+ capabilities: { tools: {} },
537
+ },
538
+ };
539
+ } else {
540
+ response = await forwardToStreamableHttp(msg);
541
+ }
524
542
  break;
525
543
  case TRANSPORT_MODE.SSE:
526
544
  if (msg.method === "initialize") {
527
- // SSE 模式下 initialize 已经在检测时完成
545
+ // initialize 已经在检测时完成
528
546
  response = {
529
547
  jsonrpc: "2.0",
530
548
  id: msgId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@szc-ft/mcp-szcd-client",
3
- "version": "0.39.1",
3
+ "version": "0.39.2",
4
4
  "description": "MCP client for szcd component library - auto-configures AI coding tools with MCP server, skills, agents and commands",
5
5
  "keywords": [
6
6
  "mcp",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "szcd-component-helper",
3
- "version": "0.39.1",
3
+ "version": "0.39.2",
4
4
  "description": "szcd 组件库 MCP 助手 — 查询组件信息、匹配需求、生成代码",
5
5
  "mcpServers": {
6
6
  "szcd-component-helper": {