@veloxts/mcp 0.6.51 → 0.6.54

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/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @veloxts/mcp
2
2
 
3
+ ## 0.6.54
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(cli): add velox mcp init command for Claude Desktop setup
8
+ - Updated dependencies
9
+ - @veloxts/cli@0.6.54
10
+ - @veloxts/router@0.6.54
11
+ - @veloxts/validation@0.6.54
12
+
13
+ ## 0.6.53
14
+
15
+ ### Patch Changes
16
+
17
+ - feat(cli): add duplicate file detection to resource generator
18
+ - Updated dependencies
19
+ - @veloxts/cli@0.6.53
20
+ - @veloxts/router@0.6.53
21
+ - @veloxts/validation@0.6.53
22
+
23
+ ## 0.6.52
24
+
25
+ ### Patch Changes
26
+
27
+ - feat(mcp): smart CLI resolution with fallbacks
28
+ - Updated dependencies
29
+ - @veloxts/cli@0.6.52
30
+ - @veloxts/router@0.6.52
31
+ - @veloxts/validation@0.6.52
32
+
3
33
  ## 0.6.51
4
34
 
5
35
  ### Patch Changes
package/README.md CHANGED
@@ -2,7 +2,109 @@
2
2
 
3
3
  > **Early Preview (v0.6.x)** - APIs are stabilizing but may still change.
4
4
 
5
- Model Context Protocol server for VeloxTS - exposes project context (procedures, schemas, routes, errors) to AI assistants like Claude for intelligent code assistance. Learn more at [@veloxts/velox](https://www.npmjs.com/package/@veloxts/velox).
5
+ Model Context Protocol server for VeloxTS - exposes project context (procedures, schemas, routes, errors) to AI assistants like Claude Desktop and other tools that support the Model Context Protocol.
6
+
7
+ ## Quick Start
8
+
9
+ ### Automatic Setup (Recommended)
10
+
11
+ The easiest way to set up the MCP server is using the VeloxTS CLI:
12
+
13
+ ```bash
14
+ velox mcp init
15
+ ```
16
+
17
+ This command will:
18
+ - Detect your operating system
19
+ - Locate your Claude Desktop configuration
20
+ - Add the VeloxTS MCP server configuration
21
+ - Guide you through the setup process
22
+
23
+ After running the command, **restart Claude Desktop** to activate the integration.
24
+
25
+ ### Manual Setup
26
+
27
+ If you prefer to configure manually, add this to your Claude Desktop configuration:
28
+
29
+ **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
30
+
31
+ **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
32
+
33
+ **Linux:** `~/.config/Claude/claude_desktop_config.json`
34
+
35
+ ```json
36
+ {
37
+ "mcpServers": {
38
+ "veloxts": {
39
+ "command": "npx",
40
+ "args": ["@veloxts/mcp"]
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## What It Does
47
+
48
+ The MCP server provides Claude Desktop with deep context about your VeloxTS project:
49
+
50
+ - **Procedures**: All API procedures with their inputs, outputs, and business logic
51
+ - **Schemas**: Zod validation schemas and type definitions
52
+ - **Routes**: REST endpoints and tRPC procedure mappings
53
+ - **Errors**: Custom error types and error handling patterns
54
+ - **Project Structure**: File organization and module boundaries
55
+
56
+ This enables Claude to:
57
+ - Suggest code that matches your existing patterns
58
+ - Understand your API surface and data models
59
+ - Generate procedures that fit seamlessly with your codebase
60
+ - Help debug issues with full context of your project
61
+
62
+ ## CLI Commands
63
+
64
+ ### velox mcp init
65
+
66
+ Set up Claude Desktop configuration automatically:
67
+
68
+ ```bash
69
+ velox mcp init # Interactive setup
70
+ velox mcp init --dry-run # Preview changes without writing
71
+ velox mcp init --force # Overwrite existing configuration
72
+ velox mcp init --json # Output as JSON for scripting
73
+ ```
74
+
75
+ Options:
76
+ - `--dry-run, -d`: Preview configuration changes without writing files
77
+ - `--force, -f`: Overwrite existing VeloxTS MCP configuration
78
+ - `--json`: Output results as JSON for automated workflows
79
+
80
+ ## Troubleshooting
81
+
82
+ ### Claude Desktop doesn't show VeloxTS context
83
+
84
+ 1. Ensure you've restarted Claude Desktop after running `velox mcp init`
85
+ 2. Check that the configuration file exists and is valid JSON
86
+ 3. Verify `@veloxts/mcp` is installed in your project or globally accessible
87
+ 4. Try running `npx @veloxts/mcp` manually to test the server
88
+
89
+ ### Configuration file not found
90
+
91
+ Run `velox mcp init --dry-run` to see the expected configuration path for your platform. If Claude Desktop is not installed, the command will warn you.
92
+
93
+ ### Permission errors
94
+
95
+ On macOS/Linux, ensure you have write access to the configuration directory:
96
+
97
+ ```bash
98
+ # Check permissions
99
+ ls -la ~/Library/Application\ Support/Claude # macOS
100
+ ls -la ~/.config/Claude # Linux
101
+ ```
102
+
103
+ ## Learn More
104
+
105
+ - [Model Context Protocol](https://modelcontextprotocol.io) - Official MCP specification
106
+ - [@veloxts/cli](https://www.npmjs.com/package/@veloxts/cli) - VeloxTS CLI tools
107
+ - [@veloxts/velox](https://www.npmjs.com/package/@veloxts/velox) - Complete VeloxTS framework
6
108
 
7
109
  ## License
8
110
 
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { spawn } from 'node:child_process';
7
7
  import { z } from 'zod';
8
+ import { resolveVeloxCLI } from '../utils/cli.js';
8
9
  import { findProjectRoot } from '../utils/project.js';
9
10
  // ============================================================================
10
11
  // Output Validation Schemas
@@ -55,10 +56,11 @@ export async function generate(options) {
55
56
  };
56
57
  }
57
58
  const args = buildArgs(options);
59
+ const resolved = resolveVeloxCLI(projectRoot, args);
58
60
  return new Promise((resolve) => {
59
- const child = spawn('npx', ['velox', ...args], {
61
+ const child = spawn(resolved.command, resolved.args, {
60
62
  cwd: projectRoot,
61
- shell: true,
63
+ shell: resolved.isNpx, // Only use shell for npx fallback
62
64
  stdio: ['pipe', 'pipe', 'pipe'],
63
65
  });
64
66
  let stdout = '';
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { spawn } from 'node:child_process';
7
7
  import { z } from 'zod';
8
+ import { resolveVeloxCLI } from '../utils/cli.js';
8
9
  import { findProjectRoot } from '../utils/project.js';
9
10
  // ============================================================================
10
11
  // Output Validation Schemas
@@ -54,10 +55,11 @@ export async function migrate(options) {
54
55
  };
55
56
  }
56
57
  const args = buildArgs(options);
58
+ const resolved = resolveVeloxCLI(projectRoot, args);
57
59
  return new Promise((resolve) => {
58
- const child = spawn('npx', ['velox', ...args], {
60
+ const child = spawn(resolved.command, resolved.args, {
59
61
  cwd: projectRoot,
60
- shell: true,
62
+ shell: resolved.isNpx, // Only use shell for npx fallback
61
63
  stdio: ['pipe', 'pipe', 'pipe'],
62
64
  });
63
65
  let stdout = '';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * CLI Resolution Utilities
3
+ *
4
+ * Utilities for finding and executing the VeloxTS CLI binary.
5
+ */
6
+ /**
7
+ * Resolved CLI command information
8
+ */
9
+ export interface ResolvedCLI {
10
+ /** Command to execute (binary path, 'node', or 'npx') */
11
+ command: string;
12
+ /** Arguments to pass (includes binary path if using node, or '@veloxts/cli' if using npx) */
13
+ args: string[];
14
+ /** Whether we're using npx fallback */
15
+ isNpx: boolean;
16
+ }
17
+ /**
18
+ * Resolve the VeloxTS CLI binary path with smart fallbacks
19
+ *
20
+ * Resolution order:
21
+ * 1. Local node_modules/.bin/velox (fastest, respects local version)
22
+ * 2. Windows .cmd wrapper (node_modules/.bin/velox.cmd)
23
+ * 3. Resolve @veloxts/cli package and find bin entry
24
+ * 4. Fallback to npx @veloxts/cli (slowest, downloads if needed)
25
+ */
26
+ export declare function resolveVeloxCLI(projectRoot: string, args: string[]): ResolvedCLI;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * CLI Resolution Utilities
3
+ *
4
+ * Utilities for finding and executing the VeloxTS CLI binary.
5
+ */
6
+ import { existsSync, readFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ /**
9
+ * Resolve the VeloxTS CLI binary path with smart fallbacks
10
+ *
11
+ * Resolution order:
12
+ * 1. Local node_modules/.bin/velox (fastest, respects local version)
13
+ * 2. Windows .cmd wrapper (node_modules/.bin/velox.cmd)
14
+ * 3. Resolve @veloxts/cli package and find bin entry
15
+ * 4. Fallback to npx @veloxts/cli (slowest, downloads if needed)
16
+ */
17
+ export function resolveVeloxCLI(projectRoot, args) {
18
+ const isWindows = process.platform === 'win32';
19
+ // 1. Try local .bin/velox (Unix)
20
+ if (!isWindows) {
21
+ const localBin = join(projectRoot, 'node_modules', '.bin', 'velox');
22
+ if (existsSync(localBin)) {
23
+ return {
24
+ command: localBin,
25
+ args,
26
+ isNpx: false,
27
+ };
28
+ }
29
+ }
30
+ // 2. Try Windows .cmd wrapper
31
+ if (isWindows) {
32
+ const localBinCmd = join(projectRoot, 'node_modules', '.bin', 'velox.cmd');
33
+ if (existsSync(localBinCmd)) {
34
+ return {
35
+ command: localBinCmd,
36
+ args,
37
+ isNpx: false,
38
+ };
39
+ }
40
+ }
41
+ // 3. Try resolving @veloxts/cli package directly
42
+ try {
43
+ const cliPackageJson = join(projectRoot, 'node_modules', '@veloxts', 'cli', 'package.json');
44
+ if (existsSync(cliPackageJson)) {
45
+ const pkg = JSON.parse(readFileSync(cliPackageJson, 'utf-8'));
46
+ const binRelative = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.velox;
47
+ if (binRelative) {
48
+ const binPath = join(projectRoot, 'node_modules', '@veloxts', 'cli', binRelative);
49
+ if (existsSync(binPath)) {
50
+ return {
51
+ command: 'node',
52
+ args: [binPath, ...args],
53
+ isNpx: false,
54
+ };
55
+ }
56
+ }
57
+ }
58
+ }
59
+ catch {
60
+ // Ignore resolution errors, fall through to npx
61
+ }
62
+ // 4. Fallback to npx (works even if not installed locally)
63
+ return {
64
+ command: 'npx',
65
+ args: ['@veloxts/cli', ...args],
66
+ isNpx: true,
67
+ };
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/mcp",
3
- "version": "0.6.51",
3
+ "version": "0.6.54",
4
4
  "description": "Model Context Protocol server for VeloxTS - expose project context to AI tools",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,9 +23,9 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@modelcontextprotocol/sdk": "1.25.1",
26
- "@veloxts/router": "0.6.51",
27
- "@veloxts/validation": "0.6.51",
28
- "@veloxts/cli": "0.6.51"
26
+ "@veloxts/cli": "0.6.54",
27
+ "@veloxts/router": "0.6.54",
28
+ "@veloxts/validation": "0.6.54"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "zod": ">=3.25.0"