exploria-ui-mcp-server 2.2.7 → 2.2.8

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
@@ -39,7 +39,7 @@ MCP Server 在项目架构中扮演着核心角色,作为 AI IDE 与 Exploria
39
39
 
40
40
  | 组件名称 | 功能描述 |
41
41
  | ------------------------ | ----------------------------------------------------------------------- |
42
- | **ExploriaUIMCPServer** | 主服务器类,负责协调所有组件,处理服务生命周期管理 |
42
+ | **index.ts** | 入口文件,负责初始化服务、建立与 AI IDE 的连接、注册工具/资源/提示模块 |
43
43
  | **McpServer** | 来自 @modelcontextprotocol/sdk 的核心 MCP 服务器实例,处理 MCP 协议通信 |
44
44
  | **StdioServerTransport** | 标准输入输出传输层,用于与 AI IDE 通信 |
45
45
  | **DocumentParser** | 文档解析器,负责解析和处理 Exploria UI 文档 |
@@ -237,7 +237,7 @@ vector[secondaryIndex] -= weight * 0.5
237
237
  │ │ (标准输入输出管道) │
238
238
  │ ▼ │
239
239
  │ ┌─────────────────────────────────────────────────────┐ │
240
- │ │ ExploriaUIMCPServer │ │
240
+ │ │ index.ts (入口模块) │ │
241
241
  │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
242
242
  │ │ │ Tools │ │ Resources │ │ Prompts │ │ │
243
243
  │ │ │ (工具注册) │ │ (资源注册) │ │ (提示注册) │ │ │
@@ -263,7 +263,7 @@ vector[secondaryIndex] -= weight * 0.5
263
263
 
264
264
  | 组件 | 职责 | 关键方法/属性 |
265
265
  | ------------------------ | ------------------------ | --------------------------------------------- |
266
- | **ExploriaUIMCPServer** | 主服务器类,管理生命周期 | `start()`, `shutdown()`, `initializeServer()` |
266
+ | **index.ts** | 入口模块,启动服务、管理连接 | `startServer()`, `setupEventHandlers()` |
267
267
  | **McpServer** | MCP SDK 核心实例 | 处理协议通信、注册工具/资源/提示 |
268
268
  | **StdioServerTransport** | 标准输入输出传输层 | 建立与 IDE 的管道连接 |
269
269
  | **KnowledgeService** | 向量数据库服务 | `searchKnowledge()`, `getComponentDetails()` |
@@ -461,12 +461,13 @@ MCP Server 与 AI IDE 之间支持三种传输协议:
461
461
 
462
462
  1. AI 相关 IDE 通过 MCP 协议连接并请求启动 MCP Server
463
463
  2. IDE 实际调用的是 NPM 包中 package.json 定义的可执行命令
464
- 3. 可执行命令指向 `dist/index.js` 文件,该文件会实例化并启动 ExploriaUIMCPServer
465
- 4. ExploriaUIMCPServer 类初始化流程:
464
+ 3. 可执行命令指向 `dist/index.js` 文件,该文件直接调用 `startServer()` 函数启动服务
465
+ 4. 服务启动流程:
466
466
  - 加载 package.json 获取配置信息
467
- - 设置事件处理器(错误处理、信号处理等)
468
- - 初始化 McpServer 实例
467
+ - 初始化知识索引(加载预构建向量数据库)
468
+ - 创建 McpServer 实例
469
469
  - 注册所有工具、资源和提示模块
470
+ - 设置事件处理器(错误处理、信号处理等)
470
471
  - 创建并连接 StdioServerTransport
471
472
  5. 连接建立后,服务器通过 MCP 协议与 IDE 进行通信,提供各项功能
472
473
 
package/dist/index.js CHANGED
@@ -14025,66 +14025,49 @@ function dh(e) {
14025
14025
  }
14026
14026
  //#endregion
14027
14027
  //#region src/index.ts
14028
- var fh = class {
14029
- server = null;
14030
- packageJson;
14031
- transport = null;
14032
- constructor() {
14033
- this.loadPackageJson(), this.setupEventHandlers();
14034
- }
14035
- loadPackageJson() {
14036
- try {
14037
- this.packageJson = Hm();
14038
- } catch (e) {
14039
- console.error("🔴 加载 package.json 失败:", e), process.exit(1);
14040
- }
14041
- }
14042
- setupEventHandlers() {
14043
- process.stdin.on("error", (e) => {
14044
- console.error("🔴 标准输入错误:", e.message), this.shutdown(1);
14045
- }), process.stdout.on("error", (e) => {
14046
- console.error("🔴 标准输出错误:", e.message), this.shutdown(1);
14047
- }), process.on("SIGINT", () => {
14048
- console.error("\n🟠 收到 SIGINT 信号,正在关闭服务器..."), this.shutdown(0);
14049
- }), process.on("SIGTERM", () => {
14050
- console.error("\n🟠 收到 SIGTERM 信号,正在关闭服务器..."), this.shutdown(0);
14051
- }), process.on("uncaughtException", (e) => {
14052
- console.error("🔴 未捕获异常:", e.message), console.error("🔴 异常堆栈:", e.stack), this.shutdown(1);
14053
- }), process.on("unhandledRejection", (e) => {
14054
- console.error("🔴 未处理的 Promise 拒绝:", e), this.shutdown(1);
14055
- });
14056
- }
14057
- initializeServer() {
14058
- try {
14059
- console.error("\n🔄 正在初始化知识索引...");
14060
- let e = nh.initialize();
14061
- nh.getStatus(), console.error("📚 知识索引初始化完成"), console.error(` ├─ 文档数: ${e.metrics.documentCount}`), console.error(` ├─ 切片数: ${e.metrics.chunkCount}`), console.error(` └─ 构建耗时: ${e.metrics.buildTimeMs}ms`), this.server = new Sm({
14062
- name: this.packageJson.name,
14063
- version: this.packageJson.version,
14064
- description: this.packageJson.description
14065
- }), console.error("\n🔧 正在注册工具、资源和提示..."), dh(this.server), ah(this.server), Rm(this.server), console.error("✅ 成功注册所有工具、资源和提示");
14066
- } catch (e) {
14067
- console.error("🔴 初始化 MCP Server 失败:", e), console.error("🔴 错误详情:", e instanceof Error ? e.stack : ""), process.exit(1);
14068
- }
14069
- }
14070
- async start() {
14071
- try {
14072
- if (this.initializeServer(), this.transport = new Fm(), !this.server || !this.transport) throw Error("服务器或传输层未初始化");
14073
- await this.server.connect(this.transport), console.error("\n✅ Exploria UI MCP Server 已成功启动"), console.error(`📦 服务器名称: ${this.packageJson.name}`), console.error(`📌 服务器版本: ${this.packageJson.version}`), console.error("🔗 等待 AI IDE 连接...\n");
14074
- } catch (e) {
14075
- console.error("🔴 启动 MCP Server 失败:", e), this.shutdown(1);
14076
- }
14077
- }
14078
- async shutdown(e) {
14028
+ function fh(e, t) {
14029
+ let n = async (t) => {
14079
14030
  try {
14080
- this.server && (await this.server.close(), console.error("✅ MCP Server 已成功关闭"));
14031
+ await e.close(), console.error("✅ MCP Server 已成功关闭");
14081
14032
  } catch (e) {
14082
14033
  console.error("🔴 关闭服务器时发生错误:", e);
14083
14034
  } finally {
14084
- process.exit(e);
14035
+ process.exit(t);
14036
+ }
14037
+ };
14038
+ process.stdin.on("error", (e) => {
14039
+ console.error("🔴 标准输入错误:", e.message), n(1);
14040
+ }), process.stdout.on("error", (e) => {
14041
+ console.error("🔴 标准输出错误:", e.message), n(1);
14042
+ }), process.on("SIGINT", () => {
14043
+ console.error("\n🟠 收到 SIGINT 信号,正在关闭服务器..."), n(0);
14044
+ }), process.on("SIGTERM", () => {
14045
+ console.error("\n🟠 收到 SIGTERM 信号,正在关闭服务器..."), n(0);
14046
+ }), process.on("uncaughtException", (e) => {
14047
+ console.error("🔴 未捕获异常:", e.message), console.error("🔴 异常堆栈:", e.stack), n(1);
14048
+ }), process.on("unhandledRejection", (e) => {
14049
+ console.error("🔴 未处理的 Promise 拒绝:", e), n(1);
14050
+ });
14051
+ }
14052
+ async function ph() {
14053
+ let e, t;
14054
+ try {
14055
+ let n = Hm();
14056
+ console.error("\n🔄 正在初始化知识索引...");
14057
+ let r = nh.initialize();
14058
+ nh.getStatus(), console.error("📚 知识索引初始化完成"), console.error(` ├─ 文档数: ${r.metrics.documentCount}`), console.error(` ├─ 切片数: ${r.metrics.chunkCount}`), console.error(` └─ 构建耗时: ${r.metrics.buildTimeMs}ms`), e = new Sm({
14059
+ name: n.name,
14060
+ version: n.version,
14061
+ description: n.description
14062
+ }), console.error("\n🔧 正在注册工具、资源和提示..."), dh(e), ah(e), Rm(e), console.error("✅ 成功注册所有工具、资源和提示"), t = new Fm(), fh(e, t), await e.connect(t), console.error("\n✅ Exploria UI MCP Server 已成功启动"), console.error(`📦 服务器名称: ${n.name}`), console.error(`📌 服务器版本: ${n.version}`), console.error("🔗 等待 AI IDE 连接...\n");
14063
+ } catch (t) {
14064
+ if (console.error("🔴 启动 MCP Server 失败:", t), console.error("🔴 错误详情:", t instanceof Error ? t.stack : ""), e) try {
14065
+ await e.close();
14066
+ } catch (e) {
14067
+ console.error("🔴 关闭服务器时发生错误:", e);
14085
14068
  }
14069
+ process.exit(1);
14086
14070
  }
14087
- };
14088
- new fh().start();
14071
+ }
14072
+ ph();
14089
14073
  //#endregion
14090
- export { fh as ExploriaUIMCPServer };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 1,
3
- "generatedAt": "2026-04-13T09:22:20.404Z",
3
+ "generatedAt": "2026-04-13T09:27:20.599Z",
4
4
  "docsRoot": "C:\\Users\\YYWD4\\Desktop\\exploria-ui-document\\src\\views\\document\\pages",
5
5
  "buildMode": "prebuild",
6
6
  "idfMap": {
@@ -120719,7 +120719,7 @@
120719
120719
  }
120720
120720
  ],
120721
120721
  "metrics": {
120722
- "buildTimeMs": 165.85,
120722
+ "buildTimeMs": 154.75,
120723
120723
  "documentCount": 74,
120724
120724
  "chunkCount": 415,
120725
120725
  "averageChunkLength": 383.75,
@@ -1,12 +1,12 @@
1
1
  {
2
- "timestamp": "2026-04-13T09:22:20.400Z",
2
+ "timestamp": "2026-04-13T09:27:20.596Z",
3
3
  "buildMode": "prebuild",
4
4
  "docsRoot": "C:\\Users\\YYWD4\\Desktop\\exploria-ui-document\\src\\views\\document\\pages",
5
5
  "statistics": {
6
6
  "documentRootCount": 74,
7
7
  "documentCount": 74,
8
8
  "chunkCount": 415,
9
- "buildTimeMs": 165.85,
9
+ "buildTimeMs": 154.75,
10
10
  "vectorDimension": 256
11
11
  },
12
12
  "documentRoots": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exploria-ui-mcp-server",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "description": "MCP Server for Exploria UI Component Library",
5
5
  "bin": {
6
6
  "exploria-ui-mcp-server": "./dist/index.js"