yike-ui-mcp 0.0.0-stage → 1.0.0

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.
Files changed (3) hide show
  1. package/README.md +31 -2
  2. package/package.json +21 -4
  3. package/src/index.js +26 -0
package/README.md CHANGED
@@ -1,3 +1,32 @@
1
- # Temporary Holding Version
1
+ # yike-ui-mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 基于 `@modelcontextprotocol/sdk` 的 stdio MCP 服务,提供 `greet` 工具。需要 Node.js 18 或更新版本。
4
+
5
+ ## 使用 npm 包
6
+
7
+ 在支持 stdio MCP 的客户端中配置:
8
+
9
+ ```json
10
+ {
11
+ "mcpServers": {
12
+ "yike-ui-mcp": {
13
+ "command": "npx",
14
+ "args": ["-y", "yike-ui-mcp@1.0.0"]
15
+ }
16
+ }
17
+ }
18
+ ```
19
+
20
+ 连接后调用 `greet`,参数为 `{"name":"世界"}`,返回 `你好,世界!`。首次运行 `npx` 需要联网下载包。此配置需在包发布后使用。
21
+
22
+ ## 本地开发
23
+
24
+ ```bash
25
+ npm ci
26
+ npm test
27
+ npm start
28
+ ```
29
+
30
+ `npm start` 启动 stdio MCP 服务,等待客户端连接。不要向标准输出写日志,以免干扰协议通信。
31
+
32
+ 当前版本不提供 HTTP 端点;发布 npm 包仅使客户端能够下载并运行本地 stdio 服务,不等于将服务部署到服务器。
package/package.json CHANGED
@@ -1,6 +1,23 @@
1
1
  {
2
2
  "name": "yike-ui-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "益客lanhu mcp",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "files": ["src/index.js"],
8
+ "bin": {
9
+ "yike-ui-mcp": "src/index.js"
10
+ },
11
+ "scripts": {
12
+ "start": "node src/index.js",
13
+ "test": "node --test"
14
+ },
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "@modelcontextprotocol/sdk": "^1.32.2",
21
+ "zod": "^4.6.7"
22
+ }
23
+ }
package/src/index.js ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { z } from 'zod';
5
+
6
+ const server = new McpServer({ name: 'simple-mcp-server', version: '1.0.0' });
7
+
8
+ server.registerTool(
9
+ 'greet',
10
+ {
11
+ description: '用中文向指定的人打招呼',
12
+ inputSchema: { name: z.string().min(1).describe('要问候的名字') },
13
+ },
14
+ async ({ name }) => ({
15
+ content: [
16
+ { type: 'text', text: `你好,${name}!` }
17
+ ]
18
+ }),
19
+ );
20
+
21
+ try {
22
+ await server.connect(new StdioServerTransport());
23
+ } catch (error) {
24
+ console.error('MCP 服务启动失败:', error);
25
+ process.exitCode = 1;
26
+ }