Skip to content

Conversation

@bazinga012
Copy link
Contributor

Description

Enhanced the code executor server with two major improvements:

  1. Added support for virtualenv and UV virtualenv environments (previously conda-only)
  2. Implemented incremental code generation and execution to address LLM token limits

Server Details

  • Server: code-executor
  • Changes to: tools, environment handling, execution flow

Motivation and Context

This update addresses two important limitations:

  1. Environment Support: Previously, the server only supported conda environments. Now it fully supports virtualenv and UV virtualenv, making it more flexible for different development setups.
  2. Token Limits: LLMs sometimes hit token limits when generating large code blocks. The new incremental approach lets LLMs write code in smaller chunks by creating a file, appending to it across multiple interactions, and finally executing the complete file.

These improvements make the code executor more versatile across different Python environment management approaches while solving token limitation challenges without requiring changes to the LLM client.

How Has This Been Tested?

  • Tested with all three environment types: conda, virtualenv, and UV virtualenv
  • Verified package installation works correctly in each environment
  • Tested the incremental code generation workflow with Claude 3.7 Sonnet
  • Verified proper environment activation and execution across different OS platforms

Breaking Changes

No breaking changes. All existing functionality remains intact, with environment selection now configurable and new code generation tools added alongside the original methods.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

The environment configuration is now more flexible, allowing users to switch between conda, virtualenv, and UV virtualenv at runtime. All tools properly respect the environment configuration and activate the correct environment before execution. The incremental code generation tools maintain consistent environment activation patterns across all supported environment types.

@olaservo
Copy link
Member

olaservo commented Jun 9, 2025

Thanks for your contribution to the servers list. This has been merged in this combined PR: #2007

This is a new process we're trying out, so if you see any issues feel free to re-open the PR and tag me.

@olaservo olaservo closed this Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants