@getmikk/mcp-server 1.5.1 → 1.7.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/README.md ADDED
@@ -0,0 +1,208 @@
1
+ # @getmikk/mcp-server
2
+
3
+ > Give your AI assistant real architectural intelligence — not guesses.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@getmikk/mcp-server)](https://www.npmjs.com/package/@getmikk/mcp-server)
6
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](../../LICENSE)
7
+
8
+ MCP (Model Context Protocol) server for [Mikk](../../README.md) — connects your project's full architectural graph directly to AI assistants like Claude Desktop, Cursor, and any MCP-compatible client.
9
+
10
+ Once connected, your AI assistant can answer questions like *"what breaks if I change this file?"*, *"who calls `parseToken`?"*, and *"what are the architectural constraints for this project?"* — all grounded in the actual call graph, real export surfaces, and real constraint definitions. Not hallucinated. Not guessed.
11
+
12
+ Every tool reads from `mikk.lock.json` — no re-parsing, millisecond response times.
13
+
14
+ > Part of [Mikk](../../README.md) — the codebase nervous system for AI-assisted development.
15
+
16
+ ---
17
+
18
+ ## Requirements
19
+
20
+ - [Mikk](https://github.com/Ansh-dhanani/mikk) installed and initialized in your project (`mikk.json` + `mikk.lock.json` present)
21
+ - Node.js 18+ or Bun 1.x
22
+
23
+ ---
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install -g @getmikk/mcp-server
29
+ # or
30
+ bunx @getmikk/mcp-server /path/to/your/project
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Connecting to an MCP client
36
+
37
+ ### Claude Desktop
38
+
39
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
40
+
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "mikk": {
45
+ "command": "npx",
46
+ "args": ["-y", "@getmikk/mcp-server", "/absolute/path/to/your/project"]
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### Cursor / VS Code (via settings.json)
53
+
54
+ ```json
55
+ {
56
+ "mcp.servers": {
57
+ "mikk": {
58
+ "command": "npx",
59
+ "args": ["-y", "@getmikk/mcp-server", "/absolute/path/to/your/project"]
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ### Direct invocation
66
+
67
+ ```bash
68
+ mikk-mcp /path/to/project
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Tools (12)
74
+
75
+ All tools read from the lock file (`mikk.lock.json`) — fast, no re-parsing.
76
+
77
+ | Tool | Purpose |
78
+ |---|---|
79
+ | `mikk_get_project_overview` | Modules, function counts, tech stack, constraints |
80
+ | `mikk_query_context` | Ask an architecture question — returns graph-traced context with call chains |
81
+ | `mikk_impact_analysis` | Blast radius of changing a specific file |
82
+ | `mikk_before_edit` | **Call before editing any file** — exported functions at risk, constraints that apply, full blast radius |
83
+ | `mikk_find_usages` | Every function that calls a specific function — essential before renaming |
84
+ | `mikk_list_modules` | All declared modules with file/function counts |
85
+ | `mikk_get_module_detail` | Functions, files, exported API, and internal call graph for a module |
86
+ | `mikk_get_function_detail` | Params, return type, call graph, source body, error handling for a function |
87
+ | `mikk_search_functions` | Substring search across all function names |
88
+ | `mikk_semantic_search` | **Natural-language semantic search** using local vector embeddings (Xenova/all-MiniLM-L6-v2). Query: *"validate a JWT token"* returns functions ranked by semantic similarity (e.g. `verifyToken`, `validateJwt`). Requires optional `@xenova/transformers` package. |
89
+ | `mikk_get_constraints` | All architectural constraints and design decisions |
90
+ | `mikk_get_file` | Read raw source of any project file (with path traversal guard) |
91
+ | `mikk_get_routes` | Detected HTTP routes (Express / Koa / Hono style) |
92
+
93
+ ### Staleness warning
94
+
95
+ If `mikk.lock.json` is in a `drifted` or `conflict` state (i.e., out of sync with the source), every impact-sensitive tool will include a `"warning"` field in its response:
96
+
97
+ ```json
98
+ {
99
+ "warning": "⚠️ Lock file is drifted. Run `mikk analyze` for accurate results."
100
+ }
101
+ ```
102
+
103
+ Run `mikk analyze` in your project to refresh the lock.
104
+
105
+ ---
106
+
107
+ ## Resources (3)
108
+
109
+ | URI | Content |
110
+ |---|---|
111
+ | `mikk://contract` | The full `mikk.json` contract as JSON |
112
+ | `mikk://lock` | The full `mikk.lock.json` as JSON |
113
+ | `mikk://context` | The `claude.md` AI context document (if present) |
114
+
115
+ ---
116
+
117
+ ## Tool reference
118
+
119
+ ### `mikk_before_edit`
120
+
121
+ The most important tool. Call it **before** editing any file.
122
+
123
+ ```
124
+ files: string[] # relative paths, e.g. ["src/auth/verify.ts"]
125
+ ```
126
+
127
+ Returns for each file:
128
+ - Functions defined in the file
129
+ - Exported functions at risk (with their callers)
130
+ - Blast radius (how many nodes depend on this file)
131
+ - All project-level architectural constraints
132
+
133
+ ---
134
+
135
+ ### `mikk_query_context`
136
+
137
+ Ask an architecture question and get back a formatted context block ready to feed into your prompt.
138
+
139
+ ```
140
+ question: string # e.g. "How does token refresh work?"
141
+ maxHops: number (default 4)
142
+ tokenBudget: number (default 6000)
143
+ focusFile: string (optional) # anchor traversal from a specific file
144
+ focusModule: string (optional) # anchor traversal from a specific module
145
+ provider: 'generic' | 'claude' | 'compact' (default 'generic')
146
+ ```
147
+
148
+ Returns `isError: true` with a helpful message if no context was found (e.g. file doesn't exist in the lock).
149
+
150
+ ---
151
+
152
+ ### `mikk_find_usages`
153
+
154
+ Find everything that calls a function — complete with file, module, and line number.
155
+
156
+ ```
157
+ name: string # function name (e.g. "parseToken")
158
+ ```
159
+
160
+ ---
161
+
162
+ ### `mikk_semantic_search`
163
+
164
+ Find functions by **natural-language meaning**, not just name matching. Uses local vector embeddings (Xenova/all-MiniLM-L6-v2) to rank functions by semantic similarity.
165
+
166
+ ```
167
+ query: string # natural-language description (e.g. "validate JWT token", "send email notification")
168
+ topK: number # max results to return (default 10)
169
+ ```
170
+
171
+ **Example queries**:
172
+ - `"validate JWT token"` → ranks `verifyToken`, `validateJwt`, `checkToken` highest
173
+ - `"send an email notification"` → ranks `sendWelcomeEmail`, `notifyUser`, `emailAlert` highest
174
+ - `"database persistence"` → ranks `saveUser`, `storeRecord`, `commitTransaction` highest
175
+
176
+ **Advantages over `mikk_search_functions`**:
177
+ - Keyword search: exact substring match (very fast, narrow results)
178
+ - Semantic search: meaning match (slower, broader understanding, finds related functions)
179
+
180
+ **Requirements**: `@xenova/transformers` must be installed in your project (`npm install @xenova/transformers`). The first query will download the model (~22 MB) to `~/.cache/huggingface/` and cache it locally.
181
+
182
+ **Availability check**: If `@xenova/transformers` is not installed, the tool returns a helpful error message with installation instructions.
183
+
184
+ ---
185
+
186
+ ### `mikk_impact_analysis`
187
+
188
+ ```
189
+ file: string # relative path to the file being changed
190
+ ```
191
+
192
+ Returns `changedNodes`, `impactedNodes`, depth, confidence, `classified` risk breakdown, and the top 30 impacted functions.
193
+
194
+ ---
195
+
196
+ ## Recommended AI assistant workflow
197
+
198
+ 1. **Before editing** → call `mikk_before_edit` with the files you plan to touch
199
+ 2. **Understanding a flow** → call `mikk_query_context` with your question
200
+ 3. **Searching by meaning** → call `mikk_semantic_search` for natural-language queries
201
+ 4. **Renaming a function** → call `mikk_find_usages` first
202
+ 5. **Exploring the project** → `mikk_get_project_overview` → `mikk_get_module_detail`
203
+
204
+ ---
205
+
206
+ ## License
207
+
208
+ Apache-2.0