@razroo/code-validation-mcp-client 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.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013-present Pagar.me Pagamentos S/A
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,271 @@
1
+ # Razroo Code Validation MCP Client
2
+
3
+ **Local bridge between Claude Code and Razroo HTTP API**
4
+
5
+ ## What This Does
6
+
7
+ This is a small MCP client that:
8
+ 1. Runs locally on your machine
9
+ 2. Connects to Claude Code via stdio (MCP protocol)
10
+ 3. Forwards requests to Razroo's hosted HTTP API
11
+ 4. Returns results back to Claude Code
12
+
13
+ ```
14
+ Claude Code (your machine)
15
+ ↕ stdio (MCP protocol)
16
+ MCP Client Bridge (this tool)
17
+ ↕ HTTPS (REST API)
18
+ Razroo API Server (AWS Lambda)
19
+
20
+ Razroo's data (Qdrant, DynamoDB, S3)
21
+ ```
22
+
23
+ ## Installation
24
+
25
+ ### NPM Package (Recommended)
26
+
27
+ ```bash
28
+ npm install -g @razroo/code-validation-mcp-client
29
+ ```
30
+
31
+ ### From Source
32
+
33
+ ```bash
34
+ git clone https://github.com/razroo/code-validation-client
35
+ cd code-validation-client
36
+ npm install
37
+ npm run build
38
+ npm link
39
+ ```
40
+
41
+ ## Configuration
42
+
43
+ ### 1. Get Your API Key & URL
44
+
45
+ You need these from Razroo:
46
+ - **API Key**: `rzr_abc123...` (Razroo generates this for you)
47
+ - **API URL**: `https://xyz.execute-api.us-east-1.amazonaws.com/prod`
48
+
49
+ ### 2. Configure Claude Code
50
+
51
+ Add to `~/.claude/claude_desktop_config.json`:
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "razroo-code-validation": {
57
+ "command": "razroo-mcp-client",
58
+ "env": {
59
+ "RAZROO_API_KEY": "rzr_your_api_key_here",
60
+ "RAZROO_API_URL": "https://your-api-url.amazonaws.com/prod"
61
+ }
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ **Or if installed from source:**
68
+
69
+ ```json
70
+ {
71
+ "mcpServers": {
72
+ "razroo-code-validation": {
73
+ "command": "node",
74
+ "args": ["/absolute/path/to/code-validation-client/dist/index.js"],
75
+ "env": {
76
+ "RAZROO_API_KEY": "rzr_your_api_key_here",
77
+ "RAZROO_API_URL": "https://your-api-url.amazonaws.com/prod"
78
+ }
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ ### 3. Restart Claude Code
85
+
86
+ Close and reopen Claude Code completely.
87
+
88
+ ## Usage
89
+
90
+ Once configured, Claude Code will automatically use the tools:
91
+
92
+ ### Example 1: Search for Similar Code
93
+
94
+ ```
95
+ You: I'm adding authentication to my Angular app. Can you search for similar patterns?
96
+
97
+ Claude: [Automatically calls search_similar_code]
98
+ I found several matching patterns! The top match is "Add Authentication" with 92% similarity.
99
+ This recipe has 4 steps:
100
+ 1. Create Auth Service
101
+ 2. Add Auth Guard
102
+ 3. Update Routing
103
+ 4. Create Login Component
104
+
105
+ Let me help you implement each step...
106
+ ```
107
+
108
+ ### Example 2: Get Recipe Steps
109
+
110
+ ```
111
+ You: Show me all the steps for the authentication recipe
112
+
113
+ Claude: [Calls get_recipe_steps]
114
+ Here are all 4 steps in the "Add Authentication" recipe:
115
+
116
+ Step 1: Create Auth Service
117
+ - Files: auth.service.ts, auth.service.spec.ts
118
+ [Shows code]
119
+
120
+ Step 2: Add Auth Guard
121
+ - Files: auth.guard.ts, auth.guard.spec.ts
122
+ [Shows code]
123
+
124
+ ...
125
+ ```
126
+
127
+ ### Example 3: Validate Generated Code
128
+
129
+ ```
130
+ You: I just generated an auth service. Can you validate it against known patterns?
131
+
132
+ [You paste your code]
133
+
134
+ Claude: [Calls search_similar_code with your code]
135
+ Your code has 88% similarity to the "Add Authentication" pattern.
136
+ It looks good! Here are a few suggestions based on the pattern:
137
+ 1. Add error handling for login failures
138
+ 2. Include token refresh logic
139
+ 3. Add logout method
140
+ ...
141
+ ```
142
+
143
+ ## Available Tools
144
+
145
+ ### 1. `search_similar_code`
146
+
147
+ Search for similar code patterns.
148
+
149
+ **Input:**
150
+ - `code` (required): Code snippet to search
151
+ - `framework` (optional): Filter by framework
152
+ - `language` (optional): Filter by language
153
+ - `operationType` (optional): Filter by operation type
154
+ - `limit` (optional): Number of results (default: 10)
155
+
156
+ **Output:** Array of matching patterns with scores
157
+
158
+ ### 2. `get_recipe_steps`
159
+
160
+ Get all steps for a recipe.
161
+
162
+ **Input:**
163
+ - `orgId` (required): Organization ID (usually "community")
164
+ - `pathId` (required): Path/workspace ID
165
+ - `recipeId` (required): Recipe ID
166
+
167
+ **Output:** Array of steps with code files
168
+
169
+ ### 3. `get_step_code_files`
170
+
171
+ Get code files for a specific step.
172
+
173
+ **Input:**
174
+ - `orgId` (required): Organization ID
175
+ - `pathId` (required): Path/workspace ID
176
+ - `recipeId` (required): Recipe ID
177
+ - `stepId` (required): Step ID
178
+
179
+ **Output:** Array of code files with content
180
+
181
+ ## Troubleshooting
182
+
183
+ ### "RAZROO_API_KEY is required"
184
+
185
+ **Problem:** API key not set
186
+
187
+ **Fix:** Add `RAZROO_API_KEY` to your Claude Code config (see Configuration above)
188
+
189
+ ### "401 Unauthorized"
190
+
191
+ **Problem:** Invalid API key
192
+
193
+ **Fix:**
194
+ 1. Check your API key is correct
195
+ 2. Verify key is active (not revoked)
196
+ 3. Contact Razroo support if needed
197
+
198
+ ### "429 Too Many Requests"
199
+
200
+ **Problem:** Rate limit exceeded
201
+
202
+ **Fix:**
203
+ 1. Wait 1 minute for rate limit to reset
204
+ 2. Upgrade to higher tier if needed
205
+ 3. Reduce frequency of requests
206
+
207
+ ### Tools Not Appearing in Claude Code
208
+
209
+ **Problem:** Claude Code doesn't see the tools
210
+
211
+ **Fix:**
212
+ 1. Verify config file location: `~/.claude/claude_desktop_config.json`
213
+ 2. Check for JSON syntax errors
214
+ 3. Ensure absolute paths (not relative)
215
+ 4. Restart Claude Code completely
216
+
217
+ ### "Command not found: razroo-mcp-client"
218
+
219
+ **Problem:** NPM package not installed globally
220
+
221
+ **Fix:**
222
+ ```bash
223
+ # If installed from source
224
+ cd code-validation-client
225
+ npm link
226
+
227
+ # Or use absolute path in config instead
228
+ ```
229
+
230
+ ## Development
231
+
232
+ ### Run Locally
233
+
234
+ ```bash
235
+ npm run build
236
+ RAZROO_API_KEY=rzr_your_key RAZROO_API_URL=https://your-api npm start
237
+ ```
238
+
239
+ ### Test with MCP Inspector
240
+
241
+ ```bash
242
+ npx @modelcontextprotocol/inspector \
243
+ node dist/index.js \
244
+ --env RAZROO_API_KEY=rzr_your_key \
245
+ --env RAZROO_API_URL=https://your-api
246
+ ```
247
+
248
+ ## What Users Need
249
+
250
+ ✅ **API Key** - Get from Razroo
251
+ ✅ **API URL** - Get from Razroo
252
+ ✅ **This client** - Install via NPM
253
+ ✅ **Claude Code** - Already installed
254
+
255
+ That's it! No AWS credentials, no Qdrant setup, no infrastructure.
256
+
257
+ ## Cost
258
+
259
+ **For users:** FREE (client runs locally)
260
+
261
+ **For Razroo:** Usage charged based on API calls (your pricing model)
262
+
263
+ ## Support
264
+
265
+ - Installation help: See README
266
+ - API issues: Contact Razroo support
267
+ - Feature requests: [GitHub Issues](https://github.com/razroo/code-validation-client/issues)
268
+
269
+ ## License
270
+
271
+ MIT
package/dist/index.js ADDED
@@ -0,0 +1,207 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Razroo Code Validation MCP Client
4
+ *
5
+ * Bridges Claude Code (stdio) to Razroo HTTP API
6
+ */
7
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
8
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
9
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
10
+ // Get config from environment
11
+ const API_KEY = process.env.RAZROO_API_KEY;
12
+ const API_URL = process.env.RAZROO_API_URL;
13
+ if (!API_KEY) {
14
+ console.error('Error: RAZROO_API_KEY environment variable is required');
15
+ process.exit(1);
16
+ }
17
+ if (!API_URL) {
18
+ console.error('Error: RAZROO_API_URL environment variable is required');
19
+ process.exit(1);
20
+ }
21
+ // Tool definitions
22
+ const TOOLS = [
23
+ {
24
+ name: 'search_similar_code',
25
+ description: 'Search for similar code patterns from Razroo recipe library. Returns top matches with similarity scores.',
26
+ inputSchema: {
27
+ type: 'object',
28
+ properties: {
29
+ code: {
30
+ type: 'string',
31
+ description: 'The code snippet to search for similar patterns',
32
+ },
33
+ framework: {
34
+ type: 'string',
35
+ description: 'Optional: Filter by framework (e.g., "angular", "react", "vue")',
36
+ },
37
+ language: {
38
+ type: 'string',
39
+ description: 'Optional: Filter by language (e.g., "typescript", "javascript", "python")',
40
+ },
41
+ operationType: {
42
+ type: 'string',
43
+ enum: ['add', 'modify', 'delete'],
44
+ description: 'Optional: Filter by operation type',
45
+ },
46
+ limit: {
47
+ type: 'number',
48
+ description: 'Number of results to return (default: 10, max: 50)',
49
+ default: 10,
50
+ },
51
+ },
52
+ required: ['code'],
53
+ },
54
+ },
55
+ {
56
+ name: 'get_recipe_steps',
57
+ description: 'Get all steps for a specific recipe. Use this after finding a match to see the complete implementation pattern.',
58
+ inputSchema: {
59
+ type: 'object',
60
+ properties: {
61
+ orgId: {
62
+ type: 'string',
63
+ description: 'Organization ID (typically "community" for public recipes)',
64
+ },
65
+ pathId: {
66
+ type: 'string',
67
+ description: 'Path/workspace ID (e.g., "angular-17.0.0")',
68
+ },
69
+ recipeId: {
70
+ type: 'string',
71
+ description: 'Recipe ID (e.g., "add-authentication")',
72
+ },
73
+ },
74
+ required: ['orgId', 'pathId', 'recipeId'],
75
+ },
76
+ },
77
+ {
78
+ name: 'get_step_code_files',
79
+ description: 'Get code files for a specific step in a recipe. Use this to see the actual code for a particular step.',
80
+ inputSchema: {
81
+ type: 'object',
82
+ properties: {
83
+ orgId: {
84
+ type: 'string',
85
+ description: 'Organization ID',
86
+ },
87
+ pathId: {
88
+ type: 'string',
89
+ description: 'Path/workspace ID',
90
+ },
91
+ recipeId: {
92
+ type: 'string',
93
+ description: 'Recipe ID',
94
+ },
95
+ stepId: {
96
+ type: 'string',
97
+ description: 'Step ID (e.g., "step-1")',
98
+ },
99
+ },
100
+ required: ['orgId', 'pathId', 'recipeId', 'stepId'],
101
+ },
102
+ },
103
+ ];
104
+ // HTTP client helper
105
+ async function callAPI(endpoint, body) {
106
+ const url = `${API_URL}${endpoint}`;
107
+ const response = await fetch(url, {
108
+ method: 'POST',
109
+ headers: {
110
+ 'Authorization': API_KEY,
111
+ 'Content-Type': 'application/json',
112
+ },
113
+ body: JSON.stringify(body),
114
+ });
115
+ if (!response.ok) {
116
+ const error = await response.text();
117
+ throw new Error(`API error (${response.status}): ${error}`);
118
+ }
119
+ const data = await response.json();
120
+ if (!data.success) {
121
+ throw new Error(`API returned error: ${JSON.stringify(data)}`);
122
+ }
123
+ return data.data;
124
+ }
125
+ // Create MCP server
126
+ const server = new Server({
127
+ name: 'razroo-code-validation',
128
+ version: '1.0.0',
129
+ }, {
130
+ capabilities: {
131
+ tools: {},
132
+ },
133
+ });
134
+ // Handle tool list requests
135
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
136
+ return {
137
+ tools: TOOLS,
138
+ };
139
+ });
140
+ // Handle tool execution
141
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
142
+ const { name, arguments: args } = request.params;
143
+ try {
144
+ switch (name) {
145
+ case 'search_similar_code': {
146
+ const data = await callAPI('/api/v1/mcp/search-similar-code', args);
147
+ return {
148
+ content: [
149
+ {
150
+ type: 'text',
151
+ text: JSON.stringify(data, null, 2),
152
+ },
153
+ ],
154
+ };
155
+ }
156
+ case 'get_recipe_steps': {
157
+ const data = await callAPI('/api/v1/mcp/get-recipe-steps', args);
158
+ return {
159
+ content: [
160
+ {
161
+ type: 'text',
162
+ text: JSON.stringify(data, null, 2),
163
+ },
164
+ ],
165
+ };
166
+ }
167
+ case 'get_step_code_files': {
168
+ const data = await callAPI('/api/v1/mcp/get-step-code-files', args);
169
+ return {
170
+ content: [
171
+ {
172
+ type: 'text',
173
+ text: JSON.stringify(data, null, 2),
174
+ },
175
+ ],
176
+ };
177
+ }
178
+ default:
179
+ throw new Error(`Unknown tool: ${name}`);
180
+ }
181
+ }
182
+ catch (error) {
183
+ const errorMessage = error instanceof Error ? error.message : String(error);
184
+ return {
185
+ content: [
186
+ {
187
+ type: 'text',
188
+ text: `Error: ${errorMessage}`,
189
+ },
190
+ ],
191
+ isError: true,
192
+ };
193
+ }
194
+ });
195
+ // Start server
196
+ async function main() {
197
+ console.error('Razroo Code Validation MCP Client starting...');
198
+ console.error(`API URL: ${API_URL}`);
199
+ console.error(`API Key: ${API_KEY?.substring(0, 8)}...`);
200
+ const transport = new StdioServerTransport();
201
+ await server.connect(transport);
202
+ console.error('MCP Client ready');
203
+ }
204
+ main().catch((error) => {
205
+ console.error('Fatal error:', error);
206
+ process.exit(1);
207
+ });
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@razroo/code-validation-mcp-client",
3
+ "version": "1.0.0",
4
+ "description": "MCP client bridge for Razroo Code Validation API",
5
+ "type": "module",
6
+ "bin": {
7
+ "razroo-mcp-client": "./dist/index.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "watch": "tsc --watch",
12
+ "start": "node dist/index.js",
13
+ "clean": "rm -rf ./dist",
14
+ "prepublishOnly": "npm run clean && npm run build"
15
+ },
16
+ "dependencies": {
17
+ "@modelcontextprotocol/sdk": "^1.0.4"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^22.10.2",
21
+ "typescript": "^5.7.2"
22
+ },
23
+ "keywords": [
24
+ "mcp",
25
+ "claude-code",
26
+ "razroo",
27
+ "code-validation",
28
+ "ai-code-generation",
29
+ "model-context-protocol"
30
+ ],
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/razroo/code-validation-client.git"
35
+ },
36
+ "homepage": "https://github.com/razroo/code-validation-client#readme",
37
+ "bugs": {
38
+ "url": "https://github.com/razroo/code-validation-client/issues"
39
+ },
40
+ "author": "Razroo",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "README.md"
47
+ ]
48
+ }