Status: COMPLETE / GA (2026-06-24, MCP-38). All 19 tasks implemented and verified: esbuild
LoaderTStranspiler ininternal/jsruntime/typescript.go(+typescript_test.go, passing),Languageoption threaded through the MCP tool (internal/server/mcp_code_execution.go), REST/api/v1/code/exec(+internal/httpapi/code_exec_test.go), and CLIcode exec --language. Acceptance US1.1 verified live:code exec --language typescript --code 'const x: number = 42; ({ result: x })'→{ ok: true, value: { result: 42 } }. Cookbook + benchmarks published indocs/code_execution/cookbook.md.
Input: Design documents from /specs/033-typescript-code-execution/
Prerequisites: plan.md (required), spec.md (required for user stories), research.md, data-model.md, contracts/
Tests: Included - the constitution (V. Test-Driven Development) requires tests for all features.
Organization: Tasks are grouped by user story to enable independent implementation and testing of each story.
- [P]: Can run in parallel (different files, no dependencies)
- [Story]: Which user story this task belongs to (e.g., US1, US2, US3)
- Include exact file paths in descriptions
Purpose: Add esbuild dependency and foundational types
- T001 Add esbuild dependency by running
go get github.com/evanw/esbuildand verifygo.mod/go.sumare updated - T002 Add
ErrorCodeTranspileErrorerror code constant tointernal/jsruntime/errors.go - T003 Add
Languagefield (string, default "javascript") toExecutionOptionsstruct ininternal/jsruntime/runtime.go
Purpose: Core transpilation layer that ALL user stories depend on
- T004 Create
internal/jsruntime/typescript.gowithTranspileTypeScript(code string) (string, error)function using esbuildapi.Transform()withLoader: api.LoaderTS. Return transpiled JS code on success; return*JsErrorwithErrorCodeTranspileErroron failure, including line/column from esbuild error messages. - T005 Create
internal/jsruntime/typescript_test.gowith unit tests: (a) basic type annotation stripping, (b) interfaces removed, (c) generics removed, (d) enums produce valid JS, (e) namespaces produce valid JS, (f) plain JavaScript passes through unchanged, (g) invalid TypeScript returns error with line/column, (h) empty code input, (i) performance benchmarkBenchmarkTranspileTypeScriptverifying <5ms for 10KB code - T006 Modify
Execute()function ininternal/jsruntime/runtime.goto checkopts.Language: if"typescript", callTranspileTypeScript(code)before passing toexecuteWithVM(). If transpilation fails, return the transpile error. If"javascript"or empty, execute as before (no transpilation). If unsupported language value, return error with codeINVALID_ARGSlisting valid options. - T007 Add TypeScript execution tests to
internal/jsruntime/runtime_test.go: (a) TypeScript code with types executes correctly viaExecute(), (b) JavaScript code withLanguage: "javascript"works unchanged, (c) emptyLanguagedefaults to JavaScript, (d) invalid language returns error, (e) TypeScript withcall_tool()works, (f) TypeScript transpilation error returnsTRANSPILE_ERRORcode, (g) transpilation overhead is logged
Checkpoint: Transpilation layer is complete and tested. All user stories can now proceed.
Goal: AI agents can submit TypeScript code through the code_execution MCP tool with language: "typescript" and get correct results.
Independent Test: Send a code_execution MCP tool call with language: "typescript" and TypeScript code containing type annotations; verify the result matches expected output.
- T008 [P] [US1] Add test cases to
internal/server/mcp_code_execution_test.go: (a) TypeScript code withlanguage: "typescript"executes correctly, (b) JavaScript code without language parameter works unchanged, (c) invalid language returns error, (d) TypeScript transpilation error returns proper MCP error format, (e) language parameter is passed through to activity log
- T009 [US1] Add
languagestring parameter to thecode_executiontool schema ininternal/server/mcp.go(around line 450) usingmcp.WithString("language", mcp.Description("..."), mcp.Enum("javascript", "typescript"))with description from contracts/mcp-tool-schema.md. Update the tool description to mention TypeScript support. - T010 [US1] Modify
handleCodeExecution()ininternal/server/mcp_code_execution.goto: (a) parselanguagefromrequest.GetArguments()with default"javascript", (b) setoptions.Languagebefore callingjsruntime.Execute(), (c) log the language used alongside existing execution logging, (d) includelanguagein the activity record arguments map
Checkpoint: TypeScript execution works via MCP tool. AI agents can use language: "typescript".
Goal: Developers and automation tools can execute TypeScript code through POST /api/v1/code/exec with a language field.
Independent Test: Send a POST request to /api/v1/code/exec with language: "typescript" and TypeScript code; verify the JSON response.
- T011 [P] [US2] Add test cases to
internal/httpapi/code_exec_test.go: (a) TypeScript code withlanguage: "typescript"returns successful result, (b) request withoutlanguagefield defaults to JavaScript, (c) invalid language returnsINVALID_LANGUAGEerror, (d) TypeScript transpilation error returns proper error response
- T012 [US2] Add
Languagefield (json:"language") toCodeExecRequeststruct ininternal/httpapi/code_exec.go - T013 [US2] Modify
ServeHTTP()ininternal/httpapi/code_exec.goto: (a) passreq.Languagein theargsmap as"language"key when callingh.toolCaller.CallTool(), (b) validate language if non-empty (must be "javascript" or "typescript"), returningINVALID_LANGUAGEerror for unsupported values
Checkpoint: TypeScript execution works via REST API. Integrations and automation tools can use language: "typescript".
Goal: Developers can run TypeScript code locally via mcpproxy code exec --language typescript.
Independent Test: Run mcpproxy code exec --language typescript --code "const x: number = 42; ({ result: x })" and verify output.
- T014 [US3] Add
--languageflag (string, default "javascript") tocodeExecCmdincmd/mcpproxy/code_cmd.gousingcodeExecCmd.Flags().StringVar(). Add validation invalidateOptions()to reject unsupported language values. - T015 [US3] Pass the language flag value in the
argsmap in bothrunCodeExecStandalone()andrunCodeExecClientMode()functions incmd/mcpproxy/code_cmd.go. Update the command description and examples to include TypeScript usage.
Checkpoint: TypeScript execution works via CLI. Developers can test TypeScript code locally.
Purpose: Documentation, backward compatibility verification, and build validation
- T016 [P] Update
docs/code_execution/overview.mdto document TypeScript support: what it is, how to use it, language parameter, limitations (type-stripping only, no type checking) - T017 [P] Update
docs/code_execution/api-reference.mdto document thelanguageparameter in the MCP tool schema and REST API request body - T018 Verify full build succeeds:
go build ./cmd/mcpproxy(personal edition) andgo build -tags server ./cmd/mcpproxy(server edition) - T019 Run complete test suite:
go test ./internal/jsruntime/... -v -race && go test ./internal/server/... -v -race && go test ./internal/httpapi/... -v -race
- Setup (Phase 1): No dependencies - can start immediately
- Foundational (Phase 2): Depends on Setup (Phase 1) completion - BLOCKS all user stories
- User Story 1 (Phase 3): Depends on Foundational (Phase 2) completion
- User Story 2 (Phase 4): Depends on Foundational (Phase 2) completion - can run in parallel with US1
- User Story 3 (Phase 5): Depends on Foundational (Phase 2) completion - can run in parallel with US1/US2
- Polish (Phase 6): Depends on all user stories being complete
- User Story 1 (P1): Can start after Phase 2. No dependencies on other stories. This is the MVP.
- User Story 2 (P2): Can start after Phase 2. Independent of US1 (uses same foundational transpiler). The REST handler calls the MCP tool internally, so US1 implementation (T009, T010) must be complete first.
- User Story 3 (P3): Can start after Phase 2. Independent of US1/US2 in standalone mode. Client mode relies on daemon having US1/US2 changes, but the CLI flag addition is independent.
- Tests should be written and verified to fail before implementation
- Schema/model changes before handler logic
- Handler logic before integration
- T002 and T003 can run in parallel (different files)
- T004 and T005 can be developed together (new file + its tests)
- T008 and T011 can run in parallel (different test files)
- T016 and T017 can run in parallel (different doc files)
- User Stories 1, 2, and 3 can theoretically be developed in parallel after Phase 2 (though US2 depends on US1 for the MCP handler)
# Test and implementation can be developed in sequence:
Task T008: "Add TypeScript test cases to internal/server/mcp_code_execution_test.go"
# then
Task T009: "Add language parameter to code_execution tool schema in internal/server/mcp.go"
Task T010: "Modify handleCodeExecution() to parse and pass language parameter"- Complete Phase 1: Setup (T001-T003)
- Complete Phase 2: Foundational (T004-T007)
- Complete Phase 3: User Story 1 (T008-T010)
- STOP and VALIDATE: Test TypeScript execution via MCP tool
- Deploy/demo if ready
- Complete Setup + Foundational -> Transpilation layer ready
- Add User Story 1 -> TypeScript works via MCP tool (MVP!)
- Add User Story 2 -> TypeScript works via REST API
- Add User Story 3 -> TypeScript works via CLI
- Polish -> Docs updated, full build validated
- [P] tasks = different files, no dependencies
- [Story] label maps task to specific user story for traceability
- Each user story is independently completable and testable after the foundational phase
- The esbuild dependency adds ~5MB to the binary but provides near-zero transpilation latency
- All tasks preserve backward compatibility - JavaScript execution is never affected