https://github.com/leblancfg/code-mcp
STDIO MCP server that allows agents to run their code in Google Cloud Functions
https://github.com/leblancfg/code-mcp
cloudfunction codeinterpreter google mcp-server
Last synced: 3 months ago
JSON representation
STDIO MCP server that allows agents to run their code in Google Cloud Functions
- Host: GitHub
- URL: https://github.com/leblancfg/code-mcp
- Owner: leblancfg
- Created: 2025-07-17T21:54:16.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-07-17T22:08:29.000Z (5 months ago)
- Last Synced: 2025-09-09T04:46:29.612Z (4 months ago)
- Topics: cloudfunction, codeinterpreter, google, mcp-server
- Language: Python
- Homepage: https://leblancfg.com/code-mcp
- Size: 52.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Code MCP Server
An MCP (Model Context Protocol) server that provides code interpretation capabilities via Google Cloud Functions.
## Features
- Execute Python, JavaScript, and Bash code in a sandboxed environment
- Automatic deployment to Google Cloud Functions
- STDIO-based MCP server implementation
## Prerequisites
- Python 3.11+
- Google Cloud SDK (`gcloud`) installed and configured
- A Google Cloud Project with Cloud Functions API enabled
## Installation
```console
$ pip install -e ".[dev]"
```
## Usage
You'll first need to set up a Google Cloud Function that can execute code. The server will handle requests to this function. In this repo, run it with
```console
$ uv run python deploy_gcf.py
```
### As an MCP Server
```console
$ uv run python main.py
```
### Running Tests
```console
$ uv run pytest
```
### Testing with the MCP Inspector
You can use the CLI feature with
```console
$ GCF_URL=$MY_COOL_GCF_URL \
npx @modelcontextprotocol/inspector@0.11.0 \
--cli uv run python main.py \
--method tools/call \
--tool-name run_code \
--tool-arg "code=print(1+1)" \
--tool-arg language=python \
| jq
```
## Configuration
Set the `GCF_URL` environment variable to use an existing Cloud Function, otherwise the server will attempt to deploy one automatically.
```console
$ export GCF_URL="https://region-project.cloudfunctions.net/code-interpreter"
```
## Architecture
- **MCP Server**: Handles tool requests from AI agents
- **Google Cloud Function**: Executes code in an isolated environment
- **Supported Languages**: Python, JavaScript (Node.js), Bash