lime-ui-x-mcp 1.0.0 → 1.0.1

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 (2) hide show
  1. package/index.js +40 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { resolve } from 'node:path';
4
4
  import { existsSync } from 'node:fs';
5
- import { cwd, exit } from 'node:process';
5
+ import { argv, env, cwd, exit } from 'node:process';
6
6
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
7
7
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
8
8
  import {
@@ -21,13 +21,50 @@ import {
21
21
  getProjectDir,
22
22
  } from './src/loader.js';
23
23
 
24
- const projectDir = cwd();
24
+ let projectDir = cwd();
25
+ const envDir = env.LIMEUI_PROJECT_DIR;
26
+ if (envDir) {
27
+ projectDir = resolve(envDir);
28
+ }
29
+ const args = argv.slice(2);
30
+ if (args.includes('--help') || args.includes('-h')) {
31
+ console.error('Usage: npx lime-ui-x-mcp@latest [options]');
32
+ console.error('');
33
+ console.error('Options:');
34
+ console.error(' --dir <path> Set uni-app project root directory');
35
+ console.error(' -d <path> Shortcut for --dir');
36
+ console.error('');
37
+ console.error('Environment variables:');
38
+ console.error(' LIMEUI_PROJECT_DIR Project root directory (overrides --dir)');
39
+ console.error('');
40
+ console.error('MCP config example:');
41
+ console.error(' {');
42
+ console.error(' "mcpServers": {');
43
+ console.error(' "lime-ui-x": {');
44
+ console.error(' "command": "npx",');
45
+ console.error(' "args": ["-y", "lime-ui-x-mcp@latest"],');
46
+ console.error(' "env": { "LIMEUI_PROJECT_DIR": "/path/to/project" }');
47
+ console.error(' }');
48
+ console.error(' }');
49
+ console.error(' }');
50
+ exit(0);
51
+ }
52
+ for (let i = 0; i < args.length; i++) {
53
+ if ((args[i] === '--dir' || args[i] === '-d') && args[i + 1]) {
54
+ projectDir = resolve(args[i + 1]);
55
+ break;
56
+ }
57
+ if (args[i].startsWith('--dir=')) {
58
+ projectDir = resolve(args[i].slice(6));
59
+ break;
60
+ }
61
+ }
25
62
  setProjectDir(projectDir);
26
63
 
27
64
  const uniModulesPath = resolve(projectDir, 'uni_modules');
28
65
  if (!existsSync(uniModulesPath)) {
29
66
  console.error(`[lime-ui-x-mcp] Warning: uni_modules not found at ${uniModulesPath}`);
30
- console.error(`[lime-ui-x-mcp] Make sure you're running this command inside a uni-app project with lime-ui-x installed.`);
67
+ console.error(`[lime-ui-x-mcp] Set LIMEUI_PROJECT_DIR env var or use --dir <path> in your MCP config.`);
31
68
  }
32
69
 
33
70
  const server = new Server(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lime-ui-x-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "MCP server for LimeUI-X component library - provides component discovery, documentation query, and dependency analysis for AI assistants",
5
5
  "type": "module",
6
6
  "main": "index.js",