@reinteractive/rails-insight 1.0.6 → 1.0.8
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 +6 -5
- package/package.json +2 -2
- package/src/server.js +33 -11
- package/src/tools/index.js +2 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# RailsInsight
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@reinteractive/rails-insight)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
|
|
6
6
|
A Rails-aware codebase indexer that runs as an MCP (Model Context Protocol) server, giving AI coding agents deep structural understanding of your Rails application — models, associations, routes, schema, authentication, jobs, components, and 56 total file categories — without reading every file.
|
|
@@ -57,7 +57,7 @@ Add to your Claude Code MCP configuration:
|
|
|
57
57
|
"mcpServers": {
|
|
58
58
|
"railsinsight": {
|
|
59
59
|
"command": "npx",
|
|
60
|
-
"args": ["@reinteractive/rails-insight"]
|
|
60
|
+
"args": ["-y", "@reinteractive/rails-insight"]
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -72,7 +72,7 @@ In your `.cursor/mcp.json`:
|
|
|
72
72
|
"mcpServers": {
|
|
73
73
|
"railsinsight": {
|
|
74
74
|
"command": "npx",
|
|
75
|
-
"args": ["@reinteractive/rails-insight"]
|
|
75
|
+
"args": ["-y", "@reinteractive/rails-insight"]
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -88,14 +88,15 @@ In your VS Code `.mcp.json` file:
|
|
|
88
88
|
{
|
|
89
89
|
"servers": {
|
|
90
90
|
"railsinsight": {
|
|
91
|
+
"type": "stdio",
|
|
91
92
|
"command": "npx",
|
|
92
|
-
"args": ["@reinteractive/
|
|
93
|
+
"args": ["-y", "@reinteractive/rails-insight"]
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
```
|
|
97
98
|
|
|
98
|
-
|
|
99
|
+
Note: VS Code MCP configuration uses the `servers` block (not `mcpServers` as used by Claude Desktop/Cursor). The `"type": "stdio"` field is required.
|
|
99
100
|
|
|
100
101
|
## Available Tools
|
|
101
102
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reinteractive/rails-insight",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Rails-aware codebase indexer — MCP server for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=18.0.0"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
}
|
package/src/server.js
CHANGED
|
@@ -38,6 +38,36 @@ export async function startLocal(projectRoot, options = {}) {
|
|
|
38
38
|
const provider = new LocalFSProvider(projectRoot)
|
|
39
39
|
const verbose = options.verbose || false
|
|
40
40
|
|
|
41
|
+
// Connect the transport immediately so VS Code's MCP handshake completes
|
|
42
|
+
// without waiting for the index to be built. Tools return a "not ready"
|
|
43
|
+
// response until state.index is populated below.
|
|
44
|
+
const server = new McpServer({
|
|
45
|
+
name: 'railsinsight',
|
|
46
|
+
version: PKG_VERSION,
|
|
47
|
+
capabilities: { tools: {} },
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const state = registerTools(server, {
|
|
51
|
+
index: null,
|
|
52
|
+
provider,
|
|
53
|
+
tier: options.tier || 'pro',
|
|
54
|
+
verbose,
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const transport = new StdioServerTransport()
|
|
58
|
+
await server.connect(transport)
|
|
59
|
+
|
|
60
|
+
// Keep the event loop alive so Node.js doesn't exit when startLocal returns.
|
|
61
|
+
// StdioServerTransport adds a 'data' listener to stdin but does not call
|
|
62
|
+
// resume(), so without this the process exits immediately on idle stdin.
|
|
63
|
+
process.stdin.resume()
|
|
64
|
+
|
|
65
|
+
// Yield to the event loop before running the synchronous buildIndex pipeline.
|
|
66
|
+
// This lets the MCP SDK process the VS Code initialize handshake that arrived
|
|
67
|
+
// on stdin while we were awaiting connect(), preventing a timeout on the
|
|
68
|
+
// client side before any tools have been registered.
|
|
69
|
+
await new Promise((resolve) => setImmediate(resolve))
|
|
70
|
+
|
|
41
71
|
if (verbose) {
|
|
42
72
|
process.stderr.write(`[railsinsight] Indexing ${projectRoot}...\n`)
|
|
43
73
|
}
|
|
@@ -47,19 +77,11 @@ export async function startLocal(projectRoot, options = {}) {
|
|
|
47
77
|
verbose,
|
|
48
78
|
})
|
|
49
79
|
|
|
80
|
+
state.index = index
|
|
81
|
+
|
|
50
82
|
if (verbose) {
|
|
51
|
-
process.stderr.write(`[railsinsight] Index built
|
|
83
|
+
process.stderr.write(`[railsinsight] Index built.\n`)
|
|
52
84
|
}
|
|
53
|
-
|
|
54
|
-
const server = createServer({
|
|
55
|
-
index,
|
|
56
|
-
provider,
|
|
57
|
-
tier: options.tier || 'pro',
|
|
58
|
-
verbose,
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
const transport = new StdioServerTransport()
|
|
62
|
-
await server.connect(transport)
|
|
63
85
|
}
|
|
64
86
|
|
|
65
87
|
/**
|