smart-context-mcp 1.0.1 → 1.0.2
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 +22 -0
- package/package.json +1 -1
- package/scripts/init-clients.js +33 -7
- package/src/mcp-server.js +5 -0
package/README.md
CHANGED
|
@@ -219,6 +219,28 @@ The `intent` parameter in `smart_search` and `smart_context` adjusts ranking and
|
|
|
219
219
|
|
|
220
220
|
The rules are idempotent — running `smart-context-init` again updates the section without duplicating it. Existing content in `AGENTS.md` and `CLAUDE.md` is preserved.
|
|
221
221
|
|
|
222
|
+
## Use against another repo
|
|
223
|
+
|
|
224
|
+
By default, `devctx` works against the repo where it is installed. You can point it at another repo without modifying that target project:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
node ./src/mcp-server.js --project-root /path/to/target-repo
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
or:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
DEVCTX_PROJECT_ROOT=/path/to/target-repo node ./src/mcp-server.js
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
or (recommended for MCP clients):
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
MCP_PROJECT_ROOT=/path/to/target-repo node ./src/mcp-server.js
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
`smart-context-init` automatically sets `MCP_PROJECT_ROOT` in the generated client configs (`.cursor/mcp.json`, `.codex/config.toml`, `.mcp.json`, `.qwen/settings.json`), so the MCP server always launches from the correct project context, even in monorepos or when installed globally.
|
|
243
|
+
|
|
222
244
|
## What it is good at
|
|
223
245
|
|
|
224
246
|
| Level | Languages / Stack | Use cases |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-context-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "MCP server that reduces agent token usage and improves response quality with compact file summaries, ranked code search, and curated context.",
|
|
5
5
|
"author": "Francisco Caballero Portero <fcp1978@hotmail.com>",
|
|
6
6
|
"type": "module",
|
package/scripts/init-clients.js
CHANGED
|
@@ -123,7 +123,9 @@ const getServerConfig = ({ name, command, args, cwd }) => ({
|
|
|
123
123
|
config: {
|
|
124
124
|
command,
|
|
125
125
|
args,
|
|
126
|
-
|
|
126
|
+
env: {
|
|
127
|
+
MCP_PROJECT_ROOT: cwd,
|
|
128
|
+
},
|
|
127
129
|
},
|
|
128
130
|
});
|
|
129
131
|
|
|
@@ -131,7 +133,14 @@ const updateCursorConfig = (targetDir, serverConfig, dryRun) => {
|
|
|
131
133
|
const filePath = path.join(targetDir, '.cursor', 'mcp.json');
|
|
132
134
|
const current = readJson(filePath, { mcpServers: {} });
|
|
133
135
|
current.mcpServers ??= {};
|
|
134
|
-
current.mcpServers[serverConfig.name]
|
|
136
|
+
const existing = current.mcpServers[serverConfig.name] || {};
|
|
137
|
+
current.mcpServers[serverConfig.name] = {
|
|
138
|
+
...serverConfig.config,
|
|
139
|
+
env: {
|
|
140
|
+
...existing.env,
|
|
141
|
+
...serverConfig.config.env,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
135
144
|
writeFile(filePath, `${JSON.stringify(current, null, 2)}\n`, dryRun);
|
|
136
145
|
};
|
|
137
146
|
|
|
@@ -139,9 +148,13 @@ const updateClaudeConfig = (targetDir, serverConfig, dryRun) => {
|
|
|
139
148
|
const filePath = path.join(targetDir, '.mcp.json');
|
|
140
149
|
const current = readJson(filePath, { mcpServers: {} });
|
|
141
150
|
current.mcpServers ??= {};
|
|
151
|
+
const existing = current.mcpServers[serverConfig.name] || {};
|
|
142
152
|
current.mcpServers[serverConfig.name] = {
|
|
143
153
|
...serverConfig.config,
|
|
144
|
-
env:
|
|
154
|
+
env: {
|
|
155
|
+
...existing.env,
|
|
156
|
+
...serverConfig.config.env,
|
|
157
|
+
},
|
|
145
158
|
};
|
|
146
159
|
writeFile(filePath, `${JSON.stringify(current, null, 2)}\n`, dryRun);
|
|
147
160
|
};
|
|
@@ -152,7 +165,14 @@ const updateQwenConfig = (targetDir, serverConfig, dryRun) => {
|
|
|
152
165
|
current.mcp ??= {};
|
|
153
166
|
current.mcp.enabled = true;
|
|
154
167
|
current.mcpServers ??= {};
|
|
155
|
-
current.mcpServers[serverConfig.name]
|
|
168
|
+
const existing = current.mcpServers[serverConfig.name] || {};
|
|
169
|
+
current.mcpServers[serverConfig.name] = {
|
|
170
|
+
...serverConfig.config,
|
|
171
|
+
env: {
|
|
172
|
+
...existing.env,
|
|
173
|
+
...serverConfig.config.env,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
156
176
|
writeFile(filePath, `${JSON.stringify(current, null, 2)}\n`, dryRun);
|
|
157
177
|
};
|
|
158
178
|
|
|
@@ -163,11 +183,17 @@ const buildCodexSection = (serverConfig) => {
|
|
|
163
183
|
'required = false',
|
|
164
184
|
`command = ${JSON.stringify(serverConfig.config.command)}`,
|
|
165
185
|
`args = [${serverConfig.config.args.map((value) => JSON.stringify(value)).join(', ')}]`,
|
|
166
|
-
...(serverConfig.config.cwd ? [`cwd = ${JSON.stringify(serverConfig.config.cwd)}`] : []),
|
|
167
|
-
'startup_timeout_sec = 15.0',
|
|
168
|
-
'tool_timeout_sec = 30.0',
|
|
169
186
|
];
|
|
170
187
|
|
|
188
|
+
if (serverConfig.config.env && Object.keys(serverConfig.config.env).length > 0) {
|
|
189
|
+
const envEntries = Object.entries(serverConfig.config.env)
|
|
190
|
+
.map(([key, value]) => ` ${JSON.stringify(key)} = ${JSON.stringify(value)}`)
|
|
191
|
+
.join(',\n');
|
|
192
|
+
body.push(`env = {\n${envEntries}\n}`);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
body.push('startup_timeout_sec = 15.0', 'tool_timeout_sec = 30.0');
|
|
196
|
+
|
|
171
197
|
return { header, body };
|
|
172
198
|
};
|
|
173
199
|
|
package/src/mcp-server.js
CHANGED