|
1 | 1 | # lcode MCP Integration for Kiro CLI |
2 | 2 |
|
| 3 | +lcode provides native Model Context Protocol (MCP) support, allowing AI assistants like Kiro to discover and interact with your repositories through structured tools. |
| 4 | + |
3 | 5 | ## Quick Setup |
4 | 6 |
|
5 | | -Add lcode as an MCP tool to Kiro CLI: |
| 7 | +### Global Installation (Recommended) |
| 8 | + |
| 9 | +Install lcode globally and configure the MCP server: |
6 | 10 |
|
7 | 11 | ```bash |
8 | | -kiro-cli mcp add \ |
9 | | - --name "lcode" \ |
10 | | - --scope global \ |
11 | | - --command "npx" \ |
12 | | - --args "@rkristelijn/lcode" |
| 12 | +# Install lcode globally |
| 13 | +npm install -g @rkristelijn/lcode |
| 14 | + |
| 15 | +# Add to Kiro CLI MCP configuration |
| 16 | +# Create or edit ~/.kiro/settings/mcp.json |
| 17 | +{ |
| 18 | + "mcpServers": { |
| 19 | + "lcode": { |
| 20 | + "command": "lcode-mcp", |
| 21 | + "args": [], |
| 22 | + "env": {} |
| 23 | + } |
| 24 | + } |
| 25 | +} |
13 | 26 | ``` |
14 | 27 |
|
15 | | -Or manually add to `~/.kiro/settings/mcp.json`: |
| 28 | +### Local Development Setup |
16 | 29 |
|
17 | | -```json |
| 30 | +For local development or testing: |
| 31 | + |
| 32 | +```bash |
| 33 | +# Clone and install |
| 34 | +git clone https://github.com/rkristelijn/lcode.git |
| 35 | +cd lcode |
| 36 | +npm install |
| 37 | + |
| 38 | +# Configure MCP to use local server |
| 39 | +# Edit .kiro/settings/mcp.json in your project |
18 | 40 | { |
19 | 41 | "mcpServers": { |
20 | 42 | "lcode": { |
21 | | - "command": "npx", |
22 | | - "args": ["@rkristelijn/lcode"], |
23 | | - "disabled": false |
| 43 | + "command": "node", |
| 44 | + "args": ["/path/to/lcode/mcp-server.mjs"], |
| 45 | + "env": {} |
24 | 46 | } |
25 | 47 | } |
26 | 48 | } |
27 | 49 | ``` |
28 | 50 |
|
29 | | -## Usage with Kiro |
| 51 | +## MCP Tools |
30 | 52 |
|
31 | | -Once configured, you can use lcode directly in Kiro chat: |
| 53 | +The lcode MCP server exposes two tools: |
32 | 54 |
|
33 | | -``` |
34 | | -"List all TypeScript repositories in ~/git/hub" |
35 | | -→ Uses: npx @rkristelijn/lcode ~/git/hub 2 --list --lang ts |
| 55 | +### `list_repos` |
| 56 | +Lists all git repositories with language detection and filtering. |
36 | 57 |
|
37 | | -"Show me all Python projects" |
38 | | -→ Uses: npx @rkristelijn/lcode ~ 3 --list --lang python |
| 58 | +**Parameters:** |
| 59 | +- `path` (optional) - Directory to search (default: from config) |
| 60 | +- `maxDepth` (optional) - Search depth 1-10 (default: from config) |
| 61 | +- `language` (optional) - Filter by language(s), comma-separated (e.g., "ts,js") |
39 | 62 |
|
40 | | -"Find Java or Kotlin projects" |
41 | | -→ Uses: npx @rkristelijn/lcode ~ 3 --list --lang java,kotlin |
| 63 | +**Returns:** Array of repositories with index, name, path, languages, and description. |
42 | 64 |
|
43 | | -"Open the first TypeScript project in VS Code" |
44 | | -→ Uses: npx @rkristelijn/lcode ~ 3 --lang ts --select 0 "code ." |
45 | | -``` |
| 65 | +### `select_repo` |
| 66 | +Gets detailed information about a specific repository. |
46 | 67 |
|
47 | | -## Available Commands |
| 68 | +**Parameters:** |
| 69 | +- `index` (optional) - Repository index from list_repos |
| 70 | +- `name` (optional) - Repository name |
| 71 | +- `path` (optional) - Search path (default: from config) |
| 72 | +- `maxDepth` (optional) - Search depth (default: from config) |
48 | 73 |
|
49 | | -All lcode commands work through npx: |
| 74 | +**Returns:** Repository details including full path and metadata. |
50 | 75 |
|
51 | | -```bash |
52 | | -# List repositories |
53 | | -npx @rkristelijn/lcode ~/git/hub 2 --list |
| 76 | +## Usage with Kiro |
54 | 77 |
|
55 | | -# Filter by language |
56 | | -npx @rkristelijn/lcode ~/git/hub 2 --list --lang ts |
| 78 | +Once configured, Kiro can use lcode tools naturally: |
57 | 79 |
|
58 | | -# Multiple languages |
59 | | -npx @rkristelijn/lcode ~/git/hub 2 --list --lang ts,js |
| 80 | +``` |
| 81 | +User: "Find me 4 TypeScript repos" |
| 82 | +Kiro: [Uses list_repos with language="ts"] |
60 | 83 |
|
61 | | -# Select and open |
62 | | -npx @rkristelijn/lcode ~/git/hub 2 --select 0 "code ." |
| 84 | +User: "Show all Python projects" |
| 85 | +Kiro: [Uses list_repos with language="python"] |
63 | 86 |
|
64 | | -# Help |
65 | | -npx @rkristelijn/lcode --help |
| 87 | +User: "List Java or Kotlin projects" |
| 88 | +Kiro: [Uses list_repos with language="java,kotlin"] |
| 89 | +
|
| 90 | +User: "Get details about the first repo" |
| 91 | +Kiro: [Uses select_repo with index=0] |
66 | 92 | ``` |
67 | 93 |
|
68 | 94 | ## Benefits |
69 | 95 |
|
70 | | -- ✅ No installation required (uses npx) |
71 | | -- ✅ Always uses latest version |
72 | | -- ✅ Works with all lcode features |
| 96 | +- ✅ Native MCP protocol support |
| 97 | +- ✅ Structured tool interface for AI assistants |
73 | 98 | - ✅ Language filtering built-in |
74 | | -- ✅ Fast repository discovery |
| 99 | +- ✅ Fast repository discovery with caching |
| 100 | +- ✅ Works with any MCP-compatible AI tool |
| 101 | +- ✅ Type-safe tool definitions |
75 | 102 |
|
76 | 103 | ## Example Workflows |
77 | 104 |
|
78 | | -### Find and open a project |
| 105 | +### Find TypeScript projects |
79 | 106 | ``` |
80 | | -User: "Show me all my TypeScript projects" |
81 | | -Kiro: [Lists TypeScript repos with indices] |
82 | | -User: "Open the second one" |
83 | | -Kiro: [Executes: npx @rkristelijn/lcode --select 1 --lang ts] |
| 107 | +User: "Find me TypeScript repositories" |
| 108 | +→ Kiro calls: list_repos({ language: "ts" }) |
| 109 | +→ Returns: Structured list with indices, paths, and descriptions |
84 | 110 | ``` |
85 | 111 |
|
86 | | -### Language-specific search |
| 112 | +### Multi-language search |
87 | 113 | ``` |
88 | | -User: "Find all Python projects in my home directory" |
89 | | -Kiro: [Executes: npx @rkristelijn/lcode ~ 3 --list --lang python] |
| 114 | +User: "Show me Java or Kotlin projects" |
| 115 | +→ Kiro calls: list_repos({ language: "java,kotlin" }) |
| 116 | +→ Returns: Filtered list of matching repositories |
90 | 117 | ``` |
91 | 118 |
|
92 | | -### Multi-language filtering |
| 119 | +### Get repository details |
93 | 120 | ``` |
94 | | -User: "Show me Java or Kotlin projects" |
95 | | -Kiro: [Executes: npx @rkristelijn/lcode ~ 3 --list --lang java,kotlin] |
| 121 | +User: "Tell me about repo #5" |
| 122 | +→ Kiro calls: select_repo({ index: 5 }) |
| 123 | +→ Returns: Full details including path and metadata |
| 124 | +``` |
| 125 | + |
| 126 | +## Configuration |
| 127 | + |
| 128 | +lcode uses `~/.lcodeconfig` for default settings: |
| 129 | + |
| 130 | +```json |
| 131 | +{ |
| 132 | + "path": "~", |
| 133 | + "maxDepth": 5, |
| 134 | + "execute": "code .", |
| 135 | + "execute2": "zsh" |
| 136 | +} |
96 | 137 | ``` |
| 138 | + |
| 139 | +The MCP server respects these defaults when parameters are not provided. |
| 140 | + |
| 141 | +## Troubleshooting |
| 142 | + |
| 143 | +### MCP server not loading |
| 144 | +```bash |
| 145 | +# Test the MCP server directly |
| 146 | +node mcp-server.mjs |
| 147 | + |
| 148 | +# Check Kiro MCP status |
| 149 | +kiro-cli mcp list |
| 150 | +``` |
| 151 | + |
| 152 | +### Tools not appearing |
| 153 | +- Restart Kiro CLI after updating mcp.json |
| 154 | +- Verify lcode-mcp is in your PATH (for global install) |
| 155 | +- Check node version (requires Node.js 16+) |
| 156 | + |
| 157 | +### Language filtering not working |
| 158 | +- Use lowercase language codes: "ts", "python", "java" |
| 159 | +- Multiple languages: "ts,js" (comma-separated, no spaces) |
| 160 | +- Check supported languages in README.md |
0 commit comments