-
Notifications
You must be signed in to change notification settings - Fork 316
DOC-6268 infra to map command names to client API calls and display in docs #2799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 53 commits
9b0884b
79605a3
294c2f8
00ff590
267ab51
7c6ec83
5af62c0
3561210
4abe07d
aacb171
3e80a10
b310fe8
aed73ab
96bfffe
0f7c222
037b279
c29a570
9682b37
4875350
ff2f055
c49aaa6
fb18102
c82cd26
5bf445d
09624a7
3ec0183
12a99cf
8a576ac
826f1c4
6caf609
e489842
8b96890
6ef6559
a886ef6
6f67612
b5fa98b
a6d3335
84f869f
8ee045b
1ae0b90
07ab5ac
92c65df
7105361
a039817
4de7c7a
499422e
475704a
dc89b7e
7ac76c2
cb13f34
c64b0b3
10786b9
f5154a2
b35c1b9
e88a93d
36eb23d
c7b0437
629e1d4
08b8be8
68ebb30
47dab15
bb84561
01857f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Command API Mapping | ||
|
|
||
| The `data/command-api-mapping/` directory contains individual JSON files mapping Redis commands to their client library method signatures. | ||
|
|
||
| ## Structure | ||
|
|
||
| Each file is named after a Redis command (e.g., `GET.json`, `SET.json`, `BF.ADD.json`) and contains the API mappings for that command: | ||
|
|
||
| ```json | ||
| { | ||
| "api_calls": { | ||
| "redis_py": [...], | ||
| "jedis": [...], | ||
| "lettuce_sync": [...], | ||
| "lettuce_async": [...], | ||
| "lettuce_reactive": [...], | ||
| "go-redis": [...], | ||
| "node_redis": [...], | ||
| "ioredis": [...], | ||
| "redis_rs_sync": [...], | ||
| "redis_rs_async": [...], | ||
| "nredisstack_sync": [...], | ||
| "nredisstack_async": [...], | ||
| "php": [...] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Adding a New Command | ||
|
|
||
| 1. Create a new file named `data/command-api-mapping/COMMAND_NAME.json` (e.g., `MGET.json`) | ||
| 2. Add the `api_calls` structure with method signatures for each client | ||
| 3. Run the merge script to generate the combined output | ||
|
|
||
| ## Merging Files | ||
|
|
||
| To combine all individual files into a single `command-api-mapping.json`: | ||
|
|
||
| ```bash | ||
| ./build/merge-command-api-mapping.sh # Output to data/command-api-mapping.json | ||
| ./build/merge-command-api-mapping.sh /path/to/output.json # Output to custom location | ||
| ``` | ||
|
|
||
| ## Files | ||
|
|
||
| - `data/command-api-mapping/*.json` - Individual command mapping files (273 commands) | ||
| - `build/merge-command-api-mapping.sh` - Script to combine all files into a single JSON | ||
| - `build/command-api-mapping-README.md` - This file | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Architecture Decision: MCP Server vs Direct Integration\n\n## The Problem\n\nWe need to extract method signatures and doc comments from 14 client libraries, then match them to Redis commands using AI. Multiple team members need to use this tool.\n\n## Key Constraint: API Key Management\n\n**Direct Integration (Node.js + Claude API):**\n- Requires Claude/OpenAI API key\n- Can't store in source repo (security risk)\n- Each team member needs their own key\n- Each run requires prompting for key or using environment variable\n- Friction for team members without API access\n\n**MCP Server Approach:**\n- Rust WASM parsing tools exposed via MCP\n- Claude (via Augment) handles AI matching\n- Team members use Augment (which they already have)\n- No API key management needed\n- Augment handles authentication\n\n## Why MCP Server is Better Here\n\n### 1. **Team Access**\n- All team members have Augment\n- Not all team members have Claude/OpenAI API keys\n- MCP server removes the API key bottleneck\n\n### 2. **Separation of Concerns**\n- **MCP Server (Rust WASM)**: Pure parsing/extraction logic\n - Extract method signatures\n - Extract doc comments\n - Validate extracted data\n - No AI, no API keys needed\n - Reusable in other contexts\n\n- **Claude (via Augment)**: AI matching logic\n - Analyze signatures and docs\n - Match methods to Redis commands\n - Validate matches\n - Handle edge cases\n\n### 3. **Maintainability**\n- Parsing logic is stable and language-specific\n- AI logic can evolve without touching parsing code\n- MCP server can be versioned independently\n- Easy to test parsing in isolation\n\n### 4. **Reusability**\n- MCP server could be used for other documentation extraction tasks\n- Could be shared with other teams\n- Could be open-sourced\n\n## Proposed Architecture\n\n```\n┌─────────────────────────────────────────────────────────┐\n│ Augment Agent (Claude) │\n│ - Orchestrates extraction workflow │\n│ - Calls MCP server tools for parsing │\n│ - Calls Claude API for method-to-command matching │\n│ - Aggregates results into final JSON │\n└─────────────────────────────────────────────────────────┘\n ↓\n┌─────────────────────────────────────────────────────────┐\n│ MCP Server (Rust + WASM) │\n│ Tools: │\n│ - extract_python_signatures(file_path) │\n│ - extract_java_signatures(file_path) │\n│ - extract_go_signatures(file_path) │\n│ - extract_doc_comments(file_path, language) │\n│ - validate_signature(signature, language) │\n└─────────────────────────────────────────────────────────┘\n ↓\n┌─────────────────────────────────────────────────────────┐\n│ Client Library Source Code │\n│ (redis-py, node-redis, go-redis, etc.) │\n└─────────────────────────────────────────────────────────┘\n```\n\n## Implementation Plan\n\n### Phase 1: Build MCP Server (Rust + WASM)\n\n1. **Setup**\n - Create Rust project with `tree-sitter` dependency\n - Add tree-sitter grammars for: Python, Java, Go, TypeScript, Rust, C#, PHP\n - Create WASM bindings with `wasm-bindgen`\n\n2. **Parsing Tools**\n - `extract_signatures(file_path, language)` → JSON array of signatures\n - `extract_doc_comments(file_path, language)` → JSON map of method → doc comment\n - `validate_signature(signature, language)` → boolean\n\n3. **Output Format**\n ```json\n {\n \"method_name\": \"set\",\n \"signature\": \"set(name: str, value: str, ...) -> bool | None\",\n \"doc_comment\": \"Set the string value as value of the key...\",\n \"parameters\": [\n {\"name\": \"name\", \"type\": \"str\"},\n {\"name\": \"value\", \"type\": \"str\"}\n ],\n \"return_type\": \"bool | None\"\n }\n ```\n\n### Phase 2: MCP Server Wrapper\n\n1. Create MCP server that exposes parsing tools\n2. Package as Node.js module (can call WASM from Node)\n3. Define MCP tool schemas\n\n### Phase 3: Augment Integration\n\n1. Configure MCP server in Augment\n2. Create Augment agent that:\n - Calls MCP tools to extract from each client library\n - Calls Claude API to match methods to commands\n - Aggregates into final JSON\n - Validates against schema\n\n## Why This Works Better\n\n| Aspect | Direct Integration | MCP Server |\n|--------|-------------------|------------|\n| API Key Management | Each user needs key | Augment handles it |\n| Team Access | Limited to API key holders | All Augment users |\n| Reusability | Tied to this project | Can be reused |\n| Maintenance | Mixed concerns | Clean separation |\n| Testing | Harder to test parsing | Easy to test tools |\n| Extensibility | Hard to add new languages | Easy to add parsers |\n\n## About API Keys (The Lighter Side)\n\nYou're right that API key management isn't as hard as it seems:\n- Environment variables work fine\n- `.env` files (with `.gitignore`) work\n- CI/CD secrets work\n\nBUT:\n- MCP server approach is still better because:\n - Team members don't need to manage keys\n - Augment already handles authentication\n - Cleaner separation of concerns\n - More reusable\n\n## Recommendation\n\n**Go with MCP Server approach:**\n1. Build Rust WASM parsing tools\n2. Wrap in MCP server\n3. Use Augment to orchestrate extraction and matching\n4. Team members use Augment (which they already have)\n5. No API key friction\n6. Reusable for future documentation extraction tasks\n\n## Next Steps\n\n1. Confirm MCP server approach\n2. Design MCP tool schemas\n3. Start building Rust WASM parsing library\n4. Create MCP server wrapper\n5. Prototype with one client library (redis-py)\n" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Augment MCP Server Integration Guide\n\n## Current Status\n\n✅ **Server is fully functional and tested**\n- All 6 tools are discoverable\n- All tools respond correctly to invocations\n- Server builds without errors\n- Server starts without errors\n\n⏳ **Augment Integration Issue**\n- Augment shows red pip: \"No tools are available for this MCP server\"\n- This indicates Augment IS connecting but server isn't responding to ListTools\n\n## Configuration Options\n\nTry these configurations in order:\n\n### Option 1: Simple (Recommended)\n```json\n{\n \"mcpServers\": {\n \"redis-parser-mcp\": {\n \"command\": \"node\",\n \"args\": [\"/Users/andrew.stark/Documents/Repos/docs/build/command_api_mapping/mcp-server/node/dist/index.js\"]\n }\n }\n}\n```\n\n### Option 2: With CWD\n```json\n{\n \"mcpServers\": {\n \"redis-parser-mcp\": {\n \"command\": \"node\",\n \"args\": [\"dist/index.js\"],\n \"cwd\": \"/Users/andrew.stark/Documents/Repos/docs/build/command_api_mapping/mcp-server\"\n }\n }\n}\n```\n\n### Option 3: Full Path to Node\n```json\n{\n \"mcpServers\": {\n \"redis-parser-mcp\": {\n \"command\": \"/usr/local/bin/node\",\n \"args\": [\"dist/index.js\"],\n \"cwd\": \"/Users/andrew.stark/Documents/Repos/docs/build/command_api_mapping/mcp-server\"\n }\n }\n}\n```\n\n## Troubleshooting Steps\n\n1. **Remove and re-add the server**\n - Go to Augment Settings\n - Remove the redis-parser-mcp server\n - Close VSCode completely\n - Reopen VSCode\n - Re-add the server with one of the configs above\n\n2. **Check if Augment daemon needs restart**\n - Run: `ps aux | grep -i augment | grep -v grep`\n - If there's an Augment process, try killing it\n - Restart VSCode\n\n3. **Verify server works manually**\n ```bash\n cd /Users/andrew.stark/Documents/Repos/docs/build/command_api_mapping/mcp-server\n node node/dist/index.js\n ```\n Should start without errors and wait for connections.\n\n4. **Test tool discovery**\n ```bash\n cd /Users/andrew.stark/Documents/Repos/docs/build/command_api_mapping/mcp-server/node\n npm run test-augment-discovery\n ```\n Should show all 6 tools are discoverable.\n\n## Available Tools\n\nOnce Augment connects, these tools will be available:\n\n1. **list_redis_commands** - List all Redis commands\n2. **list_clients** - List all supported Redis clients \n3. **get_client_info** - Get information about a specific client\n4. **extract_signatures** - Extract method signatures from source files\n5. **extract_doc_comments** - Extract documentation from code\n6. **validate_signature** - Validate method signatures\n\n## Files Modified\n\n- `node/package.json` - Added `\"type\": \"module\"`\n- `node/src/index.ts` - Fixed imports and removed startup messages\n- `node/src/data/data-access.ts` - Fixed imports\n- `node/src/data/components-access.ts` - Fixed imports\n- `node/src/test-wasm.ts` - Fixed imports\n- `node/src/integration-test.ts` - Fixed imports\n\n## Next Steps\n\n1. Try one of the configuration options above\n2. Remove and re-add the server in Augment Settings\n3. Close and reopen VSCode\n4. Check if tools now appear\n5. If still not working, try the other configuration options\n" | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # ✅ Augment MCP Server Integration - SUCCESS!\n\n## Status: COMPLETE\n\nThe MCP server is now fully integrated with Augment and all 6 tools are available.\n\n## Final Configuration\n\n```json\n{\n \"mcpServers\": {\n \"redis-parser-mcp\": {\n \"command\": \"node\",\n \"args\": [\"/Users/andrew.stark/Documents/Repos/docs/build/command_api_mapping/mcp-server/node/dist/index.js\"]\n }\n }\n}\n```\n\n**Key Point:** The path must include the `node/dist/index.js` subdirectory, not just `dist/index.js`.\n\n## Available Tools\n\nAll 6 tools are now accessible through Augment:\n\n1. **list_redis_commands** - List all Redis commands from command definition files\n2. **list_clients** - List all supported Redis clients across 7 languages\n3. **get_client_info** - Get detailed information about a specific client\n4. **extract_signatures** - Extract method signatures from client source files\n5. **extract_doc_comments** - Extract documentation from code\n6. **validate_signature** - Validate method signatures across languages\n\n## Test Results\n\n### ✅ Tool Discovery (5/5 tests passed)\n- Server instance created\n- Tool discovery handler registered\n- All 6 tools discoverable\n- All tool schemas valid\n- All tools have required fields\n\n### ✅ Tool Invocation (6/6 tests passed)\n- list_redis_commands invocation\n- list_clients invocation\n- get_client_info invocation with valid client\n- Error handling for invalid client\n- Response format validation\n- Tool invocation with optional parameters\n\n### ✅ Data Loaded\n- 410 core Redis commands\n- 30 RedisSearch commands\n- 26 JSON commands\n- 49 Bloom commands\n- 17 TimeSeries commands\n- 14 client libraries across 7 languages\n\n## Issues Fixed\n\n1. **ES Module Configuration** - Added `\"type\": \"module\"` to package.json\n2. **Import Paths** - Added `.js` extensions to all local imports\n3. **Startup Messages** - Removed console output interfering with MCP protocol\n4. **Configuration Path** - Corrected path to include `node/dist/index.js`\n\n## What You Can Do Now\n\nWith the MCP server integrated, you can use Augment to:\n\n1. **Extract signatures from all 14 client libraries** across 7 languages\n2. **Build comprehensive command-to-API mappings** automatically\n3. **Validate signatures** across different languages\n4. **Generate mapping files** for your documentation\n5. **Analyze client implementations** of Redis commands\n\n## Next Steps\n\nYou can now use Augment to:\n- Generate complete mapping files for all Redis commands\n- Extract signatures from specific client libraries\n- Validate method signatures\n- Create comprehensive documentation\n\nThe MCP server is production-ready! 🚀\n" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Augment MCP Server - Quick Start Guide\n\n## ✅ Status: READY TO USE\n\nYour MCP server is fully integrated with Augment and all 6 tools are available.\n\n## Configuration\n\nYour Augment Settings should have this configuration:\n\n```json\n{\n \"mcpServers\": {\n \"redis-parser-mcp\": {\n \"command\": \"node\",\n \"args\": [\"/Users/andrew.stark/Documents/Repos/docs/build/command_api_mapping/mcp-server/node/dist/index.js\"]\n }\n }\n}\n```\n\n## Available Tools\n\n### 1. list_redis_commands\nList all Redis commands from command definition files.\n\n**Parameters:**\n- `include_modules` (boolean, optional) - Include module commands (default: true)\n- `include_deprecated` (boolean, optional) - Include deprecated commands (default: true)\n- `module_filter` (array, optional) - Filter to specific modules\n\n### 2. list_clients\nList all supported Redis clients across 7 languages.\n\n**Parameters:**\n- `language_filter` (array, optional) - Filter by programming language\n\n### 3. get_client_info\nGet detailed information about a specific client.\n\n**Parameters:**\n- `client_id` (string, required) - Client ID\n\n### 4. extract_signatures\nExtract method signatures from client source files.\n\n**Parameters:**\n- `file_path` (string, required) - Path to source file\n- `language` (string, required) - Programming language (python, java, go, typescript, rust, csharp, php)\n- `method_name_filter` (array, optional) - Filter to specific method names\n\n### 5. extract_doc_comments\nExtract documentation from code.\n\n**Parameters:**\n- `file_path` (string, required) - Path to source file\n- `language` (string, required) - Programming language\n- `method_names` (array, optional) - Specific methods to extract docs for\n\n### 6. validate_signature\nValidate method signatures across languages.\n\n**Parameters:**\n- `signature` (string, required) - Method signature to validate\n- `language` (string, required) - Programming language\n\n## What's Loaded\n\n- **410** core Redis commands\n- **30** RedisSearch commands\n- **26** JSON commands\n- **49** Bloom commands\n- **17** TimeSeries commands\n- **14** client libraries across **7** languages:\n - Python (redis-py, redis-vl)\n - Node.js (node-redis, ioredis)\n - Java (Jedis, Lettuce)\n - Go (go-redis)\n - Rust (redis-rs)\n - C# (NRedisStack)\n - PHP (redis-php)\n\n## Example Usage\n\nYou can now ask Augment to:\n\n1. \"Extract all method signatures from the Python redis-py client\"\n2. \"List all Redis commands in the JSON module\"\n3. \"Get information about the Node.js ioredis client\"\n4. \"Validate this Java method signature: public String get(String key)\"\n5. \"Extract documentation from the Go redis client\"\n\n## Files\n\n- **Server code:** `build/command_api_mapping/mcp-server/node/src/index.ts`\n- **Configuration:** `build/command_api_mapping/mcp-server/AUGMENT_CONFIG_FINAL.json`\n- **Tests:** `build/command_api_mapping/mcp-server/node/src/test-augment-*.ts`\n\n## Troubleshooting\n\nIf tools don't appear:\n1. Check that the path includes `node/dist/index.js`\n2. Verify the path is absolute (starts with `/`)\n3. Close VSCode completely and reopen it\n4. Remove and re-add the server in Augment Settings\n\n## Next Steps\n\nYou can now use Augment to:\n- Generate complete command-to-API mappings\n- Extract signatures from all client libraries\n- Build comprehensive documentation\n- Validate implementations across languages\n\nEnjoy! 🚀\n" |


Uh oh!
There was an error while loading. Please reload this page.