@douyinfe/semi-mcp 1.0.8 → 1.0.10
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 +96 -24
- package/dist/http.d.ts +13 -0
- package/dist/http.js +1673 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +965 -93
- package/dist/server.d.ts +13 -0
- package/dist/tools/get-component-file-list.d.ts +7 -0
- package/dist/tools/get-file-code.d.ts +8 -0
- package/dist/tools/get-function-code.d.ts +7 -0
- package/dist/tools/get-semi-code-block.d.ts +10 -0
- package/dist/tools/get-semi-document.d.ts +13 -0
- package/dist/utils/fetch-directory-list.d.ts +12 -0
- package/dist/utils/fetch-file-content.d.ts +12 -0
- package/dist/utils/file-cache.d.ts +64 -0
- package/dist/utils/get-component-documents.d.ts +17 -0
- package/dist/utils/remove-function-body.d.ts +47 -0
- package/dist/utils/resolve-version.d.ts +30 -0
- package/package.json +12 -3
package/README.md
CHANGED
|
@@ -92,51 +92,123 @@ Get specific component documentation:
|
|
|
92
92
|
}
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
---
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
#### `get_component_file_list`
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
Semi Design 组件列表 (版本 2.89.2-alpha.3),共 70 个组件:
|
|
99
|
+
Get all file paths for a Semi Design component.
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
**Parameters:**
|
|
102
|
+
- `componentName` (required): Component name, e.g., `Table`, `DatePicker`, etc. (case-insensitive)
|
|
103
|
+
- `version` (optional): Version number, defaults to `2.89.2-alpha.3`
|
|
104
|
+
|
|
105
|
+
**Example:**
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"name": "get_component_file_list",
|
|
109
|
+
"arguments": {
|
|
110
|
+
"componentName": "Table"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
104
113
|
```
|
|
105
114
|
|
|
106
|
-
|
|
115
|
+
**Response Format:**
|
|
107
116
|
```
|
|
108
|
-
|
|
117
|
+
Component: table
|
|
118
|
+
Version: 2.89.2-alpha.3
|
|
119
|
+
Total files: 38
|
|
109
120
|
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
File type statistics:
|
|
122
|
+
.ts: 11
|
|
123
|
+
.tsx: 21
|
|
124
|
+
.scss: 6
|
|
125
|
+
|
|
126
|
+
===== File List =====
|
|
127
|
+
|
|
128
|
+
@douyinfe/semi-foundation/table/foundation.ts
|
|
129
|
+
@douyinfe/semi-foundation/table/constants.ts
|
|
130
|
+
@douyinfe/semi-ui/table/Table.tsx
|
|
131
|
+
@douyinfe/semi-ui/table/index.tsx
|
|
112
132
|
...
|
|
133
|
+
```
|
|
134
|
+
|
|
113
135
|
---
|
|
114
136
|
|
|
115
|
-
|
|
116
|
-
...
|
|
137
|
+
#### `get_file_code`
|
|
117
138
|
|
|
118
|
-
|
|
139
|
+
Get the code content of a specific file.
|
|
140
|
+
|
|
141
|
+
**Parameters:**
|
|
142
|
+
- `filePath` (required): Full file path, e.g., `@douyinfe/semi-ui/table/Table.tsx`
|
|
143
|
+
- `version` (optional): Version number, defaults to `2.89.2-alpha.3`
|
|
144
|
+
- `fullCode` (optional): Whether to get full code (including function bodies), defaults to `false`
|
|
145
|
+
|
|
146
|
+
**Behavior:**
|
|
147
|
+
- `.ts/.tsx` files with >= 500 lines: Function bodies replaced with `{ ... }`, showing only code structure
|
|
148
|
+
- `.ts/.tsx` files with < 500 lines: Full code displayed
|
|
149
|
+
- Other files (`.scss`, etc.): Full content displayed
|
|
150
|
+
- `fullCode: true`: Force display full code
|
|
151
|
+
|
|
152
|
+
**Example:**
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"name": "get_file_code",
|
|
156
|
+
"arguments": {
|
|
157
|
+
"filePath": "@douyinfe/semi-ui/table/Table.tsx"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
119
161
|
|
|
120
|
-
---
|
|
121
|
-
title: Button
|
|
122
|
-
...
|
|
123
162
|
---
|
|
124
163
|
|
|
125
|
-
|
|
126
|
-
|
|
164
|
+
#### `get_function_code`
|
|
165
|
+
|
|
166
|
+
Get the full implementation of a specific function from a file.
|
|
167
|
+
|
|
168
|
+
**Parameters:**
|
|
169
|
+
- `filePath` (required): Full file path
|
|
170
|
+
- `functionName` (required): Function name, e.g., `render`, `handleClick`, etc.
|
|
171
|
+
- `version` (optional): Version number, defaults to `2.89.2-alpha.3`
|
|
172
|
+
|
|
173
|
+
**Supported function types:**
|
|
174
|
+
- Function declarations: `function foo() {}`
|
|
175
|
+
- Arrow functions: `const foo = () => {}`
|
|
176
|
+
- Class methods: `class Foo { bar() {} }`
|
|
177
|
+
- Getters/Setters: `get foo() {}` / `set foo() {}`
|
|
178
|
+
|
|
179
|
+
**Example:**
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"name": "get_function_code",
|
|
183
|
+
"arguments": {
|
|
184
|
+
"filePath": "@douyinfe/semi-foundation/table/foundation.ts",
|
|
185
|
+
"functionName": "init"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
127
188
|
```
|
|
128
189
|
|
|
129
|
-
|
|
190
|
+
**Response Format:**
|
|
130
191
|
```
|
|
131
|
-
|
|
192
|
+
File: @douyinfe/semi-foundation/table/foundation.ts
|
|
193
|
+
Function: init
|
|
194
|
+
Version: 2.89.2-alpha.3
|
|
132
195
|
|
|
133
|
-
|
|
134
|
-
- /tmp/semi-docs-table-2.89.2-alpha.3-1234567890/index.md (6,055 行)
|
|
135
|
-
- /tmp/semi-docs-table-2.89.2-alpha.3-1234567890/index-en-US.md (5,660 行)
|
|
196
|
+
============================================================
|
|
136
197
|
|
|
137
|
-
|
|
198
|
+
init() {
|
|
199
|
+
const dataSource = [...this.getProp('dataSource')];
|
|
200
|
+
// ... full function implementation
|
|
201
|
+
}
|
|
138
202
|
```
|
|
139
203
|
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### Recommended Workflow
|
|
207
|
+
|
|
208
|
+
1. **Get file list**: Use `get_component_file_list` to get all component files
|
|
209
|
+
2. **View code structure**: Use `get_file_code` to view files of interest (large files auto-filter function bodies)
|
|
210
|
+
3. **Get function implementation**: Use `get_function_code` to get specific function's full code
|
|
211
|
+
|
|
140
212
|
### Resources
|
|
141
213
|
|
|
142
214
|
#### `semi://components`
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Semi MCP Server - HTTP (Streamable) 入口
|
|
4
|
+
*
|
|
5
|
+
* 使用 Streamable HTTP 作为传输层的 MCP 服务器
|
|
6
|
+
* 这是 MCP 推荐的新传输方案,支持无状态通信和连接恢复
|
|
7
|
+
*
|
|
8
|
+
* 启动方式: node dist/http.js [--port PORT] [--host HOST] [--stateless] [--timeout MINUTES]
|
|
9
|
+
* 默认端口: 3000
|
|
10
|
+
* 默认主机: 0.0.0.0 (监听所有网络接口)
|
|
11
|
+
* 默认超时: 30 分钟
|
|
12
|
+
*/
|
|
13
|
+
export {};
|