@douyinfe/semi-mcp 1.0.21 → 1.0.22

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/README.md CHANGED
@@ -59,6 +59,14 @@ Or if installed globally:
59
59
  }
60
60
  ```
61
61
 
62
+ ### Configuration in Claude CLI (Claude Code)
63
+
64
+ Run the following command in terminal to add MCP:
65
+
66
+ ```bash
67
+ claude mcp add semi-mcp -- npx -y @douyinfe/semi-mcp
68
+ ```
69
+
62
70
  ## Features
63
71
 
64
72
  ### Tools
@@ -70,7 +78,6 @@ Get Semi Design component documentation or component list.
70
78
  **Parameters:**
71
79
  - `componentName` (optional): Component name, e.g., `Button`, `Input`, etc. If not provided, returns the component list
72
80
  - `version` (optional): Version number, e.g., `2.89.2-alpha.3`. If not provided, defaults to `latest`
73
- - `get_path` (optional): If `true`, saves documents to the system temporary directory and returns the path instead of returning document content in the response. Defaults to `false`
74
81
 
75
82
  **Examples:**
76
83
 
package/dist/http.js CHANGED
@@ -840,18 +840,18 @@ async function handleGetComponentFileList(args) {
840
840
  `版本: ${version}`,
841
841
  `总文件数: ${allFiles.length}`,
842
842
  "",
843
- `文件类型统计:`,
843
+ "文件类型统计:",
844
844
  ` .ts: ${stats.ts}`,
845
845
  ` .tsx: ${stats.tsx}`,
846
846
  ` .d.ts: ${stats.dts}`,
847
847
  ` .scss: ${stats.scss}`,
848
848
  ` 其他: ${stats.other}`,
849
849
  "",
850
- `===== 文件列表 =====`,
850
+ "===== 文件列表 =====",
851
851
  "",
852
852
  ...allFiles,
853
853
  "",
854
- `提示: 使用 get_file_code 工具传入上述路径获取文件代码`
854
+ "提示: 使用 get_file_code 工具传入上述路径获取文件代码"
855
855
  ];
856
856
  return {
857
857
  content: [
@@ -1528,7 +1528,6 @@ async function main() {
1528
1528
  if (0 === processedHosts.length) processedHosts = [
1529
1529
  '::'
1530
1530
  ];
1531
- const server = createMCPServer();
1532
1531
  console.log(`[${new Date().toISOString()}] MCP 服务器已启动`);
1533
1532
  console.log(`[${new Date().toISOString()}] 模式: ${stateless ? '无状态 (Stateless)' : '有状态 (Stateful)'}`);
1534
1533
  const httpServer = createServer(async (req, res)=>{
@@ -1567,21 +1566,27 @@ async function main() {
1567
1566
  req.on('end', async ()=>{
1568
1567
  try {
1569
1568
  let transport;
1569
+ let mcpServer;
1570
1570
  if (stateless) {
1571
+ mcpServer = createMCPServer();
1571
1572
  transport = new StreamableHTTPServerTransport({
1572
1573
  sessionIdGenerator: void 0
1573
1574
  });
1574
- await server.connect(transport);
1575
+ await mcpServer.connect(transport);
1575
1576
  } else if (sessionId && sessions.has(sessionId)) {
1576
- transport = sessions.get(sessionId).transport;
1577
- sessions.get(sessionId).lastActivity = Date.now();
1577
+ const session = sessions.get(sessionId);
1578
+ transport = session.transport;
1579
+ mcpServer = session.server;
1580
+ session.lastActivity = Date.now();
1578
1581
  } else {
1579
1582
  const newSessionId = sessionId || crypto.randomUUID();
1583
+ mcpServer = createMCPServer();
1580
1584
  transport = new StreamableHTTPServerTransport({
1581
1585
  sessionIdGenerator: ()=>newSessionId
1582
1586
  });
1583
- await server.connect(transport);
1587
+ await mcpServer.connect(transport);
1584
1588
  sessions.set(newSessionId, {
1589
+ server: mcpServer,
1585
1590
  transport,
1586
1591
  lastActivity: Date.now(),
1587
1592
  requestQueue: [],
@@ -1696,6 +1701,7 @@ async function main() {
1696
1701
  console.log('\n正在关闭服务器...');
1697
1702
  for (const [sessionId, info] of sessions)try {
1698
1703
  await info.transport.close();
1704
+ await info.server.close();
1699
1705
  } catch {}
1700
1706
  sessions.clear();
1701
1707
  let closedCount = 0;
package/dist/index.js CHANGED
@@ -837,18 +837,18 @@ async function handleGetComponentFileList(args) {
837
837
  `版本: ${version}`,
838
838
  `总文件数: ${allFiles.length}`,
839
839
  "",
840
- `文件类型统计:`,
840
+ "文件类型统计:",
841
841
  ` .ts: ${stats.ts}`,
842
842
  ` .tsx: ${stats.tsx}`,
843
843
  ` .d.ts: ${stats.dts}`,
844
844
  ` .scss: ${stats.scss}`,
845
845
  ` 其他: ${stats.other}`,
846
846
  "",
847
- `===== 文件列表 =====`,
847
+ "===== 文件列表 =====",
848
848
  "",
849
849
  ...allFiles,
850
850
  "",
851
- `提示: 使用 get_file_code 工具传入上述路径获取文件代码`
851
+ "提示: 使用 get_file_code 工具传入上述路径获取文件代码"
852
852
  ];
853
853
  return {
854
854
  content: [
package/dist/stdio.js CHANGED
@@ -840,18 +840,18 @@ async function handleGetComponentFileList(args) {
840
840
  `版本: ${version}`,
841
841
  `总文件数: ${allFiles.length}`,
842
842
  "",
843
- `文件类型统计:`,
843
+ "文件类型统计:",
844
844
  ` .ts: ${stats.ts}`,
845
845
  ` .tsx: ${stats.tsx}`,
846
846
  ` .d.ts: ${stats.dts}`,
847
847
  ` .scss: ${stats.scss}`,
848
848
  ` 其他: ${stats.other}`,
849
849
  "",
850
- `===== 文件列表 =====`,
850
+ "===== 文件列表 =====",
851
851
  "",
852
852
  ...allFiles,
853
853
  "",
854
- `提示: 使用 get_file_code 工具传入上述路径获取文件代码`
854
+ "提示: 使用 get_file_code 工具传入上述路径获取文件代码"
855
855
  ];
856
856
  return {
857
857
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-mcp",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Semi Design MCP Server - Model Context Protocol server for Semi Design components and documentation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",