feat: Add support for R execution environments and enhance execution tooling
This commit is contained in:
parent
ac91362bd2
commit
17577d3fba
2 changed files with 41 additions and 7 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Overview
|
||||
|
||||
MCP-Forge is an MCP (Model Context Protocol) server that provides intelligent code execution capabilities for AI agents. It enables agents to execute Python code in isolated containers while having access to other MCP tools, optimizing data processing by keeping large datasets in the execution environment rather than passing them through the LLM context.
|
||||
MCP-Forge is an MCP (Model Context Protocol) server that provides intelligent code execution capabilities for AI agents. It enables agents to execute Python and R code in isolated containers while having access to other MCP tools, optimizing data processing by keeping large datasets in the execution environment rather than passing them through the LLM context.
|
||||
|
||||
## Core Concept
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ MCP-Forge is an MCP (Model Context Protocol) server that provides intelligent co
|
|||
- Limited by context window size
|
||||
|
||||
**Solution:** MCP-Forge provides a code execution environment where:
|
||||
- MCP tools are available as Python functions
|
||||
- MCP tools are available as language-native functions (Python and R)
|
||||
- Agents can write code to process data locally
|
||||
- Only relevant results flow back to the agent
|
||||
- The agent already knows tool signatures from its own configuration
|
||||
|
|
@ -58,7 +58,7 @@ MCP-Forge Server
|
|||
│ └─ mcp-forge/custom:{user-env-name}
|
||||
│
|
||||
└─ Isolated Execution Containers
|
||||
├─ Python Runtime
|
||||
├─ Python/R Runtime
|
||||
├─ MCP Client (injected tools)
|
||||
└─ Session Volumes
|
||||
```
|
||||
|
|
@ -137,17 +137,19 @@ MCP-Forge Server
|
|||
|
||||
#### Tools
|
||||
|
||||
**`execute_python`**
|
||||
**`execute_code`**
|
||||
|
||||
Execute Python code in an isolated container with MCP tools available.
|
||||
Execute Python or R code in an isolated container with MCP tools available.
|
||||
|
||||
Parameters:
|
||||
```json
|
||||
{
|
||||
"code": "string (required) - Python code to execute",
|
||||
"code": "string (required) - Source code to execute",
|
||||
"language": "string (optional) - 'python' (default) or 'r'",
|
||||
"mcp_tools": "array (optional) - List of MCP tool names to inject",
|
||||
"session_id": "string (optional) - Session ID for stateful execution (null = stateless)",
|
||||
"backend": "string (optional) - 'simple' (default) or 'jupyter'",
|
||||
"kernel": "string (optional) - for jupyter backend: 'python' (ipykernel) or 'r' (rkernel)",
|
||||
"timeout": "integer (optional) - Max execution time in seconds (default: 300)",
|
||||
"volumes": "object (optional) - Volume mount configuration",
|
||||
"custom_image": "string (optional) - Custom environment name to use",
|
||||
|
|
@ -1445,4 +1447,29 @@ print(result['result'])
|
|||
- Advanced security scanning
|
||||
- Comprehensive monitoring
|
||||
- High availability setup
|
||||
- Documentation and examples
|
||||
- Documentation and examples
|
||||
|
||||
## Multi-language Execution (Python + R)
|
||||
|
||||
MCP-Forge supports both Python and R execution modes:
|
||||
|
||||
- **Simple backend**
|
||||
- `language=python` runs python shell execution (existing path)
|
||||
- `language=r` runs R shell execution (new path)
|
||||
- Stateless by default
|
||||
|
||||
- **Jupyter backend**
|
||||
- `kernel=python` uses IPython kernel (existing path)
|
||||
- `kernel=r` uses IRkernel (new path)
|
||||
- Stateful sessions keyed by `session_id`
|
||||
|
||||
### Tool Injection for R
|
||||
|
||||
The MCP bridge protocol remains Unix-socket JSON based and language-agnostic.
|
||||
R injection wrappers mirror Python wrappers at a behavioral level:
|
||||
|
||||
- Generate R wrapper functions per allowed MCP tool
|
||||
- Forward tool calls over mounted bridge socket
|
||||
- Decode JSON responses to R lists/vectors
|
||||
|
||||
This keeps execution containers air-gapped while preserving access to configured MCP tools.
|
||||
|
|
|
|||
|
|
@ -68,6 +68,13 @@
|
|||
- Phase 5.3: Integration & End-to-End Testing
|
||||
- Phase 6: Documentation & Deployment
|
||||
|
||||
**New Workstream (2026-03-04): R execution environments**
|
||||
- Add language selection to execution tooling (`python` + `r`)
|
||||
- Add simple backend R shell execution path
|
||||
- Add stateful Jupyter R kernel support (`IRkernel`)
|
||||
- Add MCP tool injection generator for R wrappers
|
||||
- Add tests first for R simple/stateful execution and server dispatch
|
||||
|
||||
**Test Count:** 387 tests passing
|
||||
|
||||
**Last Updated:** 2026-02-06
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue