feat: add TypeScript support to code_execution#331
Merged
Conversation
Enable LLM agents to write code execution scripts in TypeScript with type annotations, interfaces, enums, generics, and namespaces. Types are automatically stripped via esbuild before execution in the goja sandbox with near-zero transpilation overhead (<5ms). Changes across all three surfaces (MCP tool, REST API, CLI): - New `language` parameter on code_execution tool (enum: javascript, typescript) - esbuild-based transpilation layer in internal/jsruntime/typescript.go - TRANSPILE_ERROR and INVALID_LANGUAGE error codes for clear diagnostics - Backward compatible: omitting language defaults to JavaScript - 38 jsruntime tests, 6 httpapi tests, 5 server tests all passing Spec: specs/033-typescript-code-execution/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 22898648966 --repo smart-mcp-proxy/mcpproxy-go
|
Resolve merge conflicts between TypeScript code execution feature and main branch changes (routing modes PR#327, tool quarantine PR#328, goja update PR#330). Conflicts resolved by keeping both sides: - internal/jsruntime/runtime.go: Added Language field alongside auth context fields from Spec 031 - internal/server/mcp.go: Combined TypeScript+ES2020+ tool descriptions and kept language parameter alongside updated code description - internal/server/mcp_code_execution.go: Kept language logging alongside auth context injection from Spec 031 - docs/code_execution/api-reference.md: Merged TypeScript language parameter docs with ES2020+ description updates Also fixed binary E2E test config to disable tool-level quarantine (quarantine_enabled: false), matching the approach in non-binary E2E tests. Without this, the new tool quarantine feature from Spec 032 causes tools to be quarantined during tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
code_executiontool using esbuild's Go APIlanguageparameter added to MCP tool, REST API, and CLI (javascript|typescript, default:javascript)Changes
internal/jsruntime/typescript.go: esbuild-based transpilation layer (TranspileTypeScript,ValidateLanguage)internal/jsruntime/runtime.go: AddedLanguagefield toExecutionOptions, auto-transpile inExecute()internal/jsruntime/errors.go: NewTRANSPILE_ERRORandINVALID_LANGUAGEerror codesinternal/server/mcp.go: Addedlanguageparameter to MCP tool schemainternal/server/mcp_code_execution.go: Language parsing and pass-throughinternal/httpapi/code_exec.go: Language field in REST API requestcmd/mcpproxy/code_cmd.go:--languageCLI flagdocs/code_execution/: Updated overview and API referenceUsage
Test plan
-race(10 new transpilation + 7 integration)language: "javascript"preserves existing behavior🤖 Generated with Claude Code