From 54f77ce3c9b2bfeff46578ada7ae7567c7aba679 Mon Sep 17 00:00:00 2001 From: Abhishek Anand Date: Mon, 23 Jun 2025 16:22:41 +0530 Subject: [PATCH] refactor: prepare project for open source release - Rename cookbooks/ to examples/ for clearer purpose - Rename mcp_main.py to server.py for better clarity - Rename openai_testmcp.py to openai_client.py for descriptive naming - Update MCP server name from "jupyter_tools" to "CodeRunner" - Remove personal information from config files - Add claude_desktop_config.example.json template - Add essential open source files (LICENSE, CONTRIBUTING.md) - Update .gitignore for better coverage - Update all file references in Dockerfile, entrypoint.sh, and README - Update GitHub repository references to BandarLabs organization --- .gitignore | 24 +++++++++- CONTRIBUTING.md | 45 +++++++++++++++++++ Dockerfile.coderunner | 4 +- LICENSE | 21 +++++++++ README.md | 10 +++-- .../claude_desktop_config.example.json | 18 ++++++++ claude_mcp_proxy/claude_desktop_config.json | 18 -------- entrypoint.sh | 2 +- {cookbooks => examples}/.mcp.json | 0 .../openai_client.py | 0 {cookbooks => examples}/systemprompt.txt | 0 mcp_main.py => server.py | 2 +- 12 files changed, 118 insertions(+), 26 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 claude_mcp_proxy/claude_desktop_config.example.json delete mode 100644 claude_mcp_proxy/claude_desktop_config.json rename {cookbooks => examples}/.mcp.json (100%) rename cookbooks/openai_testmcp.py => examples/openai_client.py (100%) rename {cookbooks => examples}/systemprompt.txt (100%) rename mcp_main.py => server.py (99%) diff --git a/.gitignore b/.gitignore index 365c4f3..5d6c19d 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,10 @@ coverage.xml # Environment variables .env +.env.local +.env.development.local +.env.test.local +.env.production.local # Editor directories and files .idea/ @@ -40,4 +44,22 @@ coverage.xml .DS_Store # Windows -Thumbs.db.env +Thumbs.db + +# Personal config files (use example files instead) +claude_mcp_proxy/claude_desktop_config.json + +# Runtime files +*.pid +*.sock +*.log + +# Uploads directory +uploads/ +jupyter_runtime/ + +# Jupyter Notebook +.ipynb_checkpoints + +# Node modules (if any) +node_modules/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..83a1a12 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,45 @@ +# Contributing to CodeRunner + +Thank you for your interest in contributing to CodeRunner! We welcome contributions from the community. + +## Getting Started + +1. Fork the repository +2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/coderunner.git` +3. Create a new branch: `git checkout -b feature/your-feature-name` +4. Make your changes +5. Test your changes thoroughly +6. Commit your changes: `git commit -m "Add your feature"` +7. Push to your fork: `git push origin feature/your-feature-name` +8. Create a Pull Request + +## Development Setup + +1. Install dependencies: `pip install -r requirements.txt` +2. Copy the example config: `cp claude_mcp_proxy/claude_desktop_config.example.json claude_mcp_proxy/claude_desktop_config.json` +3. Update the config file with your local paths +4. Follow the setup instructions in the README + +## Code Style + +- Follow PEP 8 for Python code +- Use meaningful variable and function names +- Add comments for complex logic +- Write tests for new features + +## Testing + +- Ensure all existing tests pass +- Add tests for new functionality +- Test with different Python versions if possible + +## Submitting Changes + +- Keep commits focused and atomic +- Write clear commit messages +- Update documentation as needed +- Ensure no sensitive information is included + +## Questions? + +Feel free to open an issue for questions or discussions about contributing. \ No newline at end of file diff --git a/Dockerfile.coderunner b/Dockerfile.coderunner index c8e1551..2a4c5e7 100644 --- a/Dockerfile.coderunner +++ b/Dockerfile.coderunner @@ -42,8 +42,8 @@ RUN python -m bash_kernel.install # Copy the application code (main.py) COPY ./main.py /app/main.py -# Copy the application code (main.py) -COPY ./mcp_main.py /app/mcp_main.py +# Copy the application code (server.py) +COPY ./server.py /app/server.py # Create application/jupyter directories RUN mkdir -p /app/uploads /app/jupyter_runtime diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b21b07d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 CodeRunner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index f37c411..6403d0a 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,12 @@ container run \ Finally, run the script from your terminal: ```bash -git clone https://github.com/instavm/coderunner.git +git clone https://github.com/BandarLabs/coderunner.git cd coderunner + +# Configure Claude Desktop MCP integration (optional) +cp claude_mcp_proxy/claude_desktop_config.example.json claude_mcp_proxy/claude_desktop_config.json +# Edit the config file with your local paths ``` Now you can give it prompts like `write python code to generate 100 primes` and watch it execute the code safely in the sandbox! @@ -56,14 +60,14 @@ Now you can give it prompts like `write python code to generate 100 primes` and Download `mcphost` from [releases](https://github.com/mark3labs/mcphost/releases/tag/v0.14.0) ```bash -cp cookbooks/.mcp.json ~/.mcp.json +cp examples/.mcp.json ~/.mcp.json ~/Downloads/mcphost_Darwin_arm64/mcphost -m ollama:llama3.1:8b ``` ### Can also run via python openai agents ```bash -python cookbooks/openai_testmcp.py +python examples/openai_client.py ``` ### Use via Curl diff --git a/claude_mcp_proxy/claude_desktop_config.example.json b/claude_mcp_proxy/claude_desktop_config.example.json new file mode 100644 index 0000000..72f332a --- /dev/null +++ b/claude_mcp_proxy/claude_desktop_config.example.json @@ -0,0 +1,18 @@ +{ + "mcpServers": { + "coderunner": { + "command": "/path/to/your/python", + "args": [ + "/path/to/coderunner/claude_mcp_proxy/mcp.py" + ] + }, + "filesystem": { + "command": "/path/to/your/node", + "args": [ + "/path/to/mcp/filesystem/server", + "/path/to/workspace1", + "/path/to/workspace2" + ] + } + } +} diff --git a/claude_mcp_proxy/claude_desktop_config.json b/claude_mcp_proxy/claude_desktop_config.json deleted file mode 100644 index 6faf07b..0000000 --- a/claude_mcp_proxy/claude_desktop_config.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "mcpServers": { - "jejus": { - "command": "/Users/manish/Work/venv/bin/python", - "args": [ - "/Users/manish/Work/proxymcp.py" - ] - }, - "filesystem2": { - "command": "/Users/manish/.nvm/versions/node/v23.9.0/bin/node", - "args": [ - "/Users/manish/.nvm/versions/node/v23.9.0/lib/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js", - "/Users/manish/Desktop/assets", - "/Users/manish/Downloads/chota" - ] - } - } -} diff --git a/entrypoint.sh b/entrypoint.sh index d8e519a..da0ee6e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -46,4 +46,4 @@ echo $kernel_id > /app/uploads/python_kernel_id.txt # exec python mcp_main.py # Start FastAPI application -exec uvicorn mcp_main:app --host 0.0.0.0 --port 8222 --workers 1 --no-access-log \ No newline at end of file +exec uvicorn server:app --host 0.0.0.0 --port 8222 --workers 1 --no-access-log \ No newline at end of file diff --git a/cookbooks/.mcp.json b/examples/.mcp.json similarity index 100% rename from cookbooks/.mcp.json rename to examples/.mcp.json diff --git a/cookbooks/openai_testmcp.py b/examples/openai_client.py similarity index 100% rename from cookbooks/openai_testmcp.py rename to examples/openai_client.py diff --git a/cookbooks/systemprompt.txt b/examples/systemprompt.txt similarity index 100% rename from cookbooks/systemprompt.txt rename to examples/systemprompt.txt diff --git a/mcp_main.py b/server.py similarity index 99% rename from mcp_main.py rename to server.py index b64e40f..0f7f7b5 100644 --- a/mcp_main.py +++ b/server.py @@ -20,7 +20,7 @@ logger = logging.getLogger(__name__) # Initialize the MCP server with a descriptive name for the toolset -mcp = FastMCP("jupyter_tools") +mcp = FastMCP("CodeRunner") # Jupyter connection settings