refactor(mcp_service): migrate index.js to TypeScript - #19
shayanshafii wants to merge 1 commit into
Conversation
Co-Authored-By: shayan <shayan@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| start(): void { | ||
| // The bin script handles the execution. Resolve it relative to the | ||
| // package root so the lookup works from the compiled output directory. | ||
| require(path.join(__dirname, '..', 'bin', 'superset-mcp.js')); | ||
| } |
There was a problem hiding this comment.
🚩 Pre-existing: stop() is a no-op because start() never sets this.process
The start() method at superset/mcp_service/index.ts:67-71 calls require() to load the bin script, which internally spawns a Python child process. However, that child process reference is local to the bin script (superset/mcp_service/bin/superset-mcp.js:250) and is never exported or returned. As a result, this.process remains null after start(), and stop() at line 73-78 can never actually kill the spawned process. This is unchanged from the original JS — the old code also never set this.process — but it means the class's lifecycle management is incomplete. If anyone ever calls stop(), it silently does nothing.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Thanks — agreed, and as the note says this is pre-existing: the original index.js also never set this.process, so stop() has always been a no-op. This PR is intentionally a behavior-preserving JS→TS migration, so I've left the lifecycle logic unchanged rather than expanding scope here. Properly wiring up start()/stop() (e.g. having the bin runner expose the spawned ChildProcess so it can be tracked and killed) would be a good follow-up, but it's a functional change beyond this migration.
SUMMARY
Migrates the MCP service Node.js entry module from JavaScript to TypeScript, in line with the repo-wide "NO JavaScript files" modernization guidance in
AGENTS.md.superset/mcp_service/index.jsexported a thinSupersetMCPServerwrapper class via CommonJS. It is nowindex.tswith:SupersetMCPServerOptions) and a fully-resolved internal options shape.process: ChildProcess | nullfield (type imported fromchild_process).spawn/path-as-dead-code imports;pathis now actually used.The public CommonJS shape is preserved using
export = SupersetMCPServer, sorequire('@superset/mcp-server')still returns the class directly (compiles tomodule.exports = SupersetMCPServer).Because the compiled output now lives in
dist/,start()resolves the bin script relative to the package root instead of the source dir:Tooling added to make the TS source build/run, mirroring the existing
superset-websocketNode package convention:tsconfig.json(module: commonjs,target: es2020,strict,declaration: true,outDir: dist).package.json:main->dist/index.js, addedtypes->dist/index.d.ts,build/type-checkscripts, andtypescript+@types/nodedevDependencies. Thebin/superset-mcp.jsrunner is unchanged and remains the package'sbinentry.dist/andnode_modules/are already covered by the root.gitignore, so no build artifacts are committed.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — no UI changes.
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
Link to Devin session: https://app.devin.ai/sessions/5c09535882164e0f9746046ea0776643
Requested by: @shayanshafii
Devin Review