MCP server launched from a request
LLM-V2-04An endpoint that starts an MCP stdio server with a command taken from the request lets anyone run programs on your server.
server/mcp-proxy.ts
Flagged
app.get('/connect', async (req, res) => {
const transport = new StdioClientTransport({
command: req.query.command as string,
args: (req.query.args as string).split(' '),
});
await client.connect(transport);
});
Passes
app.get('/connect', async (req, res) => {
const server = SERVERS[String(req.query.server)];
if (!server) return res.status(404).end();
const transport = new StdioClientTransport({
command: server.command,
args: server.args,
});
await client.connect(transport);
});