upstash/context7 · error · Error
Existing MCP args do not invoke ${STDIO_PACKAGE}
Error message
Existing MCP args do not invoke ${STDIO_PACKAGE} What it means
The server's args array parsed successfully, but no element matches the expected stdio package (STDIO_PACKAGE, e.g. the context7 MCP package). The tool only patches args that actually invoke that package, so it aborts instead of modifying an unrelated command.
Source
Thrown at packages/cli/src/setup/toml-editor.ts:194
apiKey: string | undefined
): Promise<boolean> {
let raw: string;
try {
raw = await readFile(filePath, "utf-8");
} catch {
return false;
}
if (raw.includes('"""') || raw.includes("'''")) {
throw new Error("TOML files containing multiline strings are not safely editable");
}
const range = findTomlServerArgs(raw, serverName);
if (!range) return false;
const args = range.tokens.map((token) => token.value);
if (!args.some(isContext7Package)) {
throw new Error(`Existing MCP args do not invoke ${STDIO_PACKAGE}`);
}
const apiKeyIndexes = args.flatMap((arg, index) => (arg === "--api-key" ? [index] : []));
let content: string;
if (apiKey && apiKeyIndexes.length === 1 && apiKeyIndexes[0] + 1 < range.tokens.length) {
const valueToken = range.tokens[apiKeyIndexes[0] + 1];
content = raw.slice(0, valueToken.start) + JSON.stringify(apiKey) + raw.slice(valueToken.end);
} else {
const patched = withoutApiKey(args);
if (apiKey) patched.push("--api-key", apiKey);
content = raw.slice(0, range.start) + JSON.stringify(patched) + raw.slice(range.end);
}
if (content !== raw) {
await mkdir(dirname(filePath), { recursive: true });
await writeFile(filePath, content, "utf-8");
}
return true;View on GitHub (pinned to edc9eeb77b)
Solutions
- Fix the args array so an element actually names the expected package (e.g. "-y", "@upstash/context7-mcp")
- Point the setup command at the correct server entry
- If intentional, skip the patch step for this server
Example fix
// before [context7] args = ["-y", "@other/mcp"] // after [context7] args = ["-y", "@upstash/context7-mcp"]
Defensive patterns
Strategy: validation
Validate before calling
const args = range.tokens.map(t => t.value);
if (!args.some(isContext7Package)) throw new Error('args do not invoke the expected package'); Type guard
function argsInvokePackage(args: string[], pkg: string): boolean {
return args.some(a => a === pkg || a.endsWith(`/${pkg}`) || a.includes(pkg));
} Try / catch
catch (e) { if (/do not invoke/.test(e.message)) { /* correct the package name in args, or target the right server */ } throw e; } Prevention
- Verify the package element in args matches the tool's expected package
- Run setup against the correct server entry
- Keep package names exact (no typos/versions)
When it happens
Trigger: args = ["-y", "some-other-mcp"] where the user pointed the setup at a server table that runs a different package, or renamed/misspelled the package element.
Common situations: See trigger scenarios.
Related errors
- Multiline strings are not supported in MCP args
- Unsupported TOML escape \\${escape}
- Expected a TOML array for MCP args
- MCP args must be a TOML array containing only strings
- Existing MCP server has no safely editable args array
AI-assisted analysis of upstash/context7@edc9eeb77b (2026-08-28).
Data as JSON: /api/errors/e380a08d5f6a99c7.
Report an issue: GitHub.