[MCP][Draft] Prototype of remote code execution#1030
[MCP][Draft] Prototype of remote code execution#1030tanish111 wants to merge 1 commit intomlco2:masterfrom
Conversation
SaboniAmine
left a comment
There was a problem hiding this comment.
Hello Tanish, thanks for your contribution!
Enabling remote code execution on the public API isn't something that we will allow, even if it's just to publish a Kaggle script. Please submit another design (the MCP discord channel might be the correct place to discuss it) that doesn't run on the server which manages user data.
Just to clarify the intent and current design: this approach does not allow arbitrary remote code execution on a public endpoint. Execution is only possible when the user explicitly provides both their CodeCarbon API key and their personal Kaggle API credentials. Without these, no code can be run.
The current design does not run code on the server that manages user data in any form. It can be modeled as rerouting user-provided data (with code treated as part of that data) to existing external infrastructure to obtain execution insights. |
|
Hi @tanish111, thanks for the contribution. |
|
@benoit-cty @SaboniAmine I will work on a local implementation this week and get back to you. |
|
Hey Tanish, thanks for your understanding.
I think that running this from a different server, potentially with a different set of credentials, could solve those limitations. |
Description
This work introduces a new endpoint in CodeCarbon that enables users to run code remotely and obtain carbon emission estimates. The implementation leverages Kaggle’s open APIs to push user code to their Kaggle environment, execute it remotely, and store the resulting carbon metrics directly in the user’s CodeCarbon dashboard.
By building on Kaggle’s infrastructure, this approach benefits from Kaggle’s free-tier GPU access, allowing users to generate carbon estimates without the need for expensive local or cloud GPU resources.
This endpoint is designed as a foundational step toward the future development of the CodeCarbon MCP server, which will require reliable remote code execution capabilities to support advanced carbon-aware workflows.
Related Issue
CodeCarbon MCP Development
Motivation and Context
AI agents, particularly MCP servers, increasingly need to run and test code autonomously. Today, this often relies on user-managed machines, leading to inconsistent environments, limited reproducibility, and higher operational overhead.
A standardized remote execution mechanism allows agents to run code independently of the user’s host system, ensuring consistent, isolated, and reproducible execution. By leveraging managed platforms with open APIs, agents can execute workloads, collect results, and report metrics without requiring users to provision infrastructure.
For CodeCarbon, this capability is critical to support future MCP server development, enabling autonomous remote execution and carbon estimation while reducing cost and complexity for users.
How Has This Been Tested?
Testing is yet to be done. I have tested it locally and have attached a video preview.
Screenshots (if appropriate):
Video-Preview:-
https://github.com/user-attachments/assets/82ac3bc9-3bde-47ef-9edd-9bd64240e161
Types of changes
What types of changes does your code introduce? Put an
xin all the boxes that apply:Checklist:
Go over all the following points, and put an
xin all the boxes that apply.