Add MCP injection support to Jupyter backend
- start_kernel() now accepts injection_code and bridge_socket_path - Bridge Unix domain socket mounted as volume in container - Injection code executed once on kernel startup (silent, no history) - New _execute_injection_code() helper method with error handling - Parameters passed through SessionManager.create_session() - Parameters passed through JupyterBackend.execute() - Updated JUPYTER_IMPLEMENTATION_STATUS.md This mirrors the MCP injection pattern from the simple executor, allowing MCP tools to be available in Jupyter sessions.
This commit is contained in:
parent
ed58c6ad5a
commit
9cc43e4166
4 changed files with 106 additions and 13 deletions
|
|
@ -121,7 +121,9 @@ class SessionManager:
|
|||
self,
|
||||
session_id: str,
|
||||
resource_limits: ResourceLimits,
|
||||
volumes: Optional[Dict[str, dict]] = None
|
||||
volumes: Optional[Dict[str, dict]] = None,
|
||||
injection_code: Optional[str] = None,
|
||||
bridge_socket_path: Optional[str] = None
|
||||
) -> Session:
|
||||
"""
|
||||
Create new stateful session.
|
||||
|
|
@ -130,6 +132,8 @@ class SessionManager:
|
|||
session_id: Unique identifier for session
|
||||
resource_limits: Resource limits for session
|
||||
volumes: Optional volume mounts
|
||||
injection_code: Optional MCP tool injection code to execute at startup
|
||||
bridge_socket_path: Optional path to MCP bridge socket for mounting
|
||||
|
||||
Returns:
|
||||
Created Session object
|
||||
|
|
@ -144,8 +148,13 @@ class SessionManager:
|
|||
# Check max concurrent limit
|
||||
self._enforce_max_concurrent()
|
||||
|
||||
# Start kernel
|
||||
kernel_id = self.kernel_manager.start_kernel(session_id, volumes=volumes)
|
||||
# Start kernel with MCP injection if provided
|
||||
kernel_id = self.kernel_manager.start_kernel(
|
||||
session_id,
|
||||
volumes=volumes,
|
||||
injection_code=injection_code,
|
||||
bridge_socket_path=bridge_socket_path
|
||||
)
|
||||
|
||||
# Create session
|
||||
now = datetime.utcnow()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue