feat(agentenv-mcp): Environment with MCP-configurable action space #68
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.
Overview
An AgentGym environment where actions are determined by MCP servers you configure.
Instead of hardcoded tools, this environment's action space adapts based on which MCP servers you connect to. Configure servers via JSON, and the environment automatically uses their tools.
Concept
Example: Configure a directional server → Environment gains
up,down,left,rightactionsWhat's Included
Environment
Configuration
mcp.example.json- Define which servers to useExample Server
Utilities
Usage
1. Configure Servers
{ "mcpServers": { "directional": { "command": "uv", "args": ["run", "python", "-m", "examples.directional.server"], "url": "http://localhost:8001" } } }2. Run Environment
Internal Mode (built-in tools)
External Mode (configured servers)
3. Environment Adapts
The environment's
action_spaceautomatically reflects tools from your configured servers.Extending
Add your own MCP server:
examples/myserver/server.pywith FastMCPmcp.jsonNo environment code changes needed—just configuration.
Key Files
mcp_environment.py- Environment that reads from MCP serversmcp_client.py- Connects to servers via SSEmcp.example.json- Server configuration templateexamples/directional/- Example server implementationVerified
See
README.mdfor architecture •MIGRATION.mdfor integration details