A multi-agent code generation plugin that replicates the human programming cycle through four specialized agents: Retrieval, Planning, Coding, and Debugging. Port of MapCoder: Multi-Agent Code Generation for Competitive Problem Solving
β’ π± Code β’ π Paper β’ π Website
MapCoder implements a systematic approach to solving coding problems:
/plugin marketplace add NewJerseyStyle/Claude-plugins-marketplace
/plugin install mapcoder@code-agent-ports
# Solve a coding problem (defaults to Python)
/mapcoder implement binary search
# Specify a language
/mapcoder --lang javascript implement a debounce function
# Use sandbox for safer execution
/mapcoder --sandbox implement file operations
# Read problem from file
/mapcoder problem.txt| Skill | Description |
|---|---|
/mapcoder |
Full pipeline: retrieve β plan β code β debug |
/mapcoder-retrieve |
Generate similar problems from knowledge |
/mapcoder-plan |
Create algorithmic plans |
/mapcoder-code |
Implement code from plans |
/mapcoder-debug |
Fix failing code |
Default language is Python. Supported languages:
| Language | Flag | Example |
|---|---|---|
| Python | --lang python |
/mapcoder --lang python two sum |
| JavaScript | --lang javascript |
/mapcoder --lang javascript two sum |
| TypeScript | --lang typescript |
/mapcoder --lang typescript two sum |
| Rust | --lang rust |
/mapcoder --lang rust two sum |
| Go | --lang go |
/mapcoder --lang go two sum |
| Java | --lang java |
/mapcoder --lang java two sum |
| C++ | --lang cpp |
/mapcoder --lang cpp two sum |
MapCoder can integrate with external knowledge bases for enhanced retrieval for best performance. Two options are supported:
Best for teams with existing infrastructure who want powerful web crawling and RAG capabilities.
Requirements:
- Docker
- Supabase with pgvector extension
- OpenAI API key
Setup:
- Follow the setup guide at: https://github.com/coleam00/mcp-crawl4ai-rag
- Start the MCP server:
docker-compose up -d - Edit
.mcp.jsonin this plugin and set"disabled": falseforcrawl4ai-rag
Best for local development with minimal setup.
Setup:
- Install nodejs: Tutorial
- Install RAG server by terminal command:
npm install -g mcp-rag-server(Follow the setup guide at: https://github.com/kwanLeeFrmVi/mcp-rag-server#installation) - Edit
.mcp.jsonin this plugin and set"disabled": falseforrag-server
For safer code execution, especially when working with file operations or untrusted problems, use the sandbox feature.
-
Install Docker: https://docs.docker.com/get-docker/
-
Build the sandbox image:
cd mapcoder-plugin docker build -t mapcoder-sandbox -f Dockerfile.sandbox .
-
Verify it works:
./scripts/sandbox-runner.sh python -c "print('Hello, Sandbox!')"
Add --sandbox flag to any /mapcoder command:
/mapcoder --sandbox implement file deletion utilityEnvironment variables for sandbox:
| Variable | Default | Description |
|---|---|---|
MAPCODER_SANDBOX_IMAGE |
mapcoder-sandbox |
Docker image name |
MAPCODER_TIMEOUT |
30 |
Execution timeout (seconds) |
MAPCODER_MEMORY |
256m |
Memory limit |
MAPCODER_CPU |
1 |
CPU limit |
When running without --sandbox, code executes directly on your system.
Recommendations:
- Back up important files before running
- Review generated code before allowing execution
- Do not use on production systems
- Avoid problems involving file system operations without sandbox
The plugin validates syntax before execution but cannot guarantee code safety. Always review:
- File operations (read, write, delete)
- Network operations
- System commands
- Any code that modifies state
Edit .claude-plugin/plugin.json to customize:
{
"name": "mapcoder",
"version": "1.0.0",
"skills": "./skills/",
"agents": "./agents/",
"hooks": "./hooks/hooks.json",
"mcpServers": "./.mcp.json"
}Edit hooks/hooks.json to customize validation:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "python scripts/validate-code.py \"$TOOL_INPUT_FILE_PATH\""
}
]
}
]
}
}# Check plugin structure
ls -la .claude-plugin/
# Should show plugin.json
# Verify JSON is valid
python -c "import json; json.load(open('.claude-plugin/plugin.json'))"# Check Docker is running
docker info
# Check image exists
docker images | grep mapcoder-sandbox
# Rebuild if needed
docker build -t mapcoder-sandbox -f Dockerfile.sandbox .Increase timeout:
export MAPCODER_TIMEOUT=60
/mapcoder --sandbox "solve complex problem"MIT License - See LICENSE file for details.
Based on the MapCoder paper: "MapCoder: Multi-Agent Code Generation for Competitive Problem Solving"
@article{islam2024mapcoder,
title={MapCoder: Multi-Agent Code Generation for Competitive Problem Solving},
author={Islam, Md Ashraful and Ali, Mohammed Eunus and Parvez, Md Rizwan},
journal={arXiv preprint arXiv:2405.11403},
year={2024}
}
