Last active
March 11, 2026 20:16
-
-
Save MaximAshin/34612c731f6b0a5b1c70697cae8e9e80 to your computer and use it in GitHub Desktop.
Antigravity to JEB 5.37 Decompiler MCP Server Bridge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| - Bridges JEB's legacy HTTP+SSE MCP to Antigravity's Streamable HTTP MCP. | |
| - Fixes JEB's incorrect MCP protocol implementation (lines 31-33) | |
| - Run with: | |
| node jeb-antigravity-mcp-bridge.js | |
| - Example config for Antigravity's mcp_config.json (you point AG to the proxy): | |
| { | |
| "mcpServers": { | |
| "jeb-proxy": { | |
| "command": "npx", | |
| "args": [ | |
| "-y", | |
| "mcp-remote", | |
| "http://localhost:8426/mcp" | |
| ] | |
| } | |
| } | |
| } | |
| */ | |
| const http = require('http'); | |
| const JEB_PORT = 8425; | |
| const PROXY_PORT = 8426; | |
| http.createServer((req, res) => { | |
| let targetPath = req.url; | |
| if (req.method === 'POST' && req.url.includes('sessionId=')) { | |
| targetPath = req.url.replace('/mcp?', '/?'); | |
| } | |
| console.log(`\n[Antigravity -> Proxy] ${req.method} ${req.url}`); | |
| console.log(`[Proxy -> JEB] Forwarding to: ${targetPath}`); | |
| const doProxy = (headers, bodyBuffer) => { | |
| const proxyReq = http.request({ | |
| hostname: 'localhost', | |
| port: JEB_PORT, | |
| path: targetPath, | |
| method: req.method, | |
| headers: headers | |
| }, (proxyRes) => { | |
| res.writeHead(proxyRes.statusCode, proxyRes.headers); | |
| console.log(`[JEB -> Proxy] Response Status: ${proxyRes.statusCode}`); | |
| proxyRes.on('data', (chunk) => { | |
| let data = chunk.toString(); | |
| // Fix the SSE endpoint URL | |
| if (data.includes('endpoint') && data.includes('sessionId=')) { | |
| data = data.replace(/http:\/\/[a-zA-Z0-9\.:]+\/\?sessionId=/g, '?sessionId='); | |
| } | |
| res.write(data); | |
| }); | |
| proxyRes.on('end', () => res.end()); | |
| }); | |
| proxyReq.on('error', (e) => { | |
| console.error('[Proxy Error]', e.message); | |
| res.writeHead(502).end(); | |
| }); | |
| if (bodyBuffer) proxyReq.write(bodyBuffer); | |
| proxyReq.end(); | |
| }; | |
| // If it's a POST request, intercept the body to clean the JSON | |
| if (req.method === 'POST') { | |
| let bodyChunks = []; | |
| req.on('data', chunk => bodyChunks.push(chunk)); | |
| req.on('end', () => { | |
| let buffer = Buffer.concat(bodyChunks); | |
| try { | |
| let json = JSON.parse(buffer.toString('utf8')); | |
| // If this is the initialize request, strip the incompatible capabilities | |
| if (json.method === 'initialize' && json.params?.capabilities?.elicitation) { | |
| console.log(`[Proxy] *** Intercepted 'initialize' payload! Stripping incompatible 'elicitation' capability... ***`); | |
| delete json.params.capabilities.elicitation; // Remove the field JEB crashes on | |
| // Repackage the payload and update the Content-Length header | |
| buffer = Buffer.from(JSON.stringify(json), 'utf8'); | |
| req.headers['content-length'] = buffer.length; | |
| } | |
| } catch (e) { | |
| // Ignore parse errors, just pass data through | |
| } | |
| doProxy(req.headers, buffer); | |
| }); | |
| } else { | |
| // GET requests (like SSE streams) have no body, just pass through | |
| doProxy(req.headers, null); | |
| } | |
| }).listen(PROXY_PORT, () => { | |
| console.log(`Proxy running! Point Antigravity to: http://localhost:${PROXY_PORT}/mcp`); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment