bgagents
Enables turning AI code agents like Anthropic Claude and OpenAI Codex into background agents accessible via MCP protocol for code generation, branch creation, and PR automation.
README
bgagents

bgagents is the first open-source project that turns the most powerful code agents, such as ANTHROPIC ClaudeCode and OpenAI Codex into background agents, accessible via REST API, MCP, and an interactive frontend
✨ Features
Getting Started
Quick Start (Recommended)
The fastest way to get bgagents running is with our pre-built Docker image:
GitHub Authentication (Choose one method):
Option 1: Direct Token
docker run -e GITHUB_TOKEN=[ghp_xxx] \
-e API_KEY=[sk-...-xxx] \ # Optional
bgagents/bgagents:v1.0.1-alpha
Option 2: OAuth Flow
docker run -e GITHUB_CLIENT_ID=[your_client_id] \
-e GITHUB_CLIENT_SECRET=[your_client_secret] \
-e GITHUB_REDIRECT_URI=http://localhost:3000 \
-e API_KEY=[sk-...-xxx] \ # Optional
bgagents/bgagents:v1.0.1-alpha
Optional Environment Variables:
API_KEY: Your Anthropic Claude or OpenAI API key (auto-detects provider)GITHUB_TOKEN: GitHub access token (alternative to providing it in requests)
🤖 Supported AI Models:
- Anthropic: claude-sonnet-4-20250514 (default), claude-opus-4-20250514, claude-3-7-sonnet-20250219
- OpenAI: codex-mini-latest (default), o4-mini
Production
Prerequisites
With Docker Compose (Recommended)
-
Clone the repository:
git clone https://github.com/michael-elkabetz/claudecodex.git cd claudecodex -
Set up environment variables:
Update
docker-compose.ymlwith the following environment variables:VITE_GITHUB_CLIENT_ID=[VITE_GITHUB_CLIENT_ID] VITE_GITHUB_REDIRECT_URI=[VITE_GITHUB_REDIRECT_URI] GITHUB_CLIENT_SECRET=[GITHUB_CLIENT_SECRET] GITHUB_TOKEN=ghp_xxx API_KEY=[your_anthropic_or_openai_api_key] # Optional -
Deploy with Docker Compose:
# Build and start all services docker-compose up --build -d # View logs docker-compose logs -f -
Access the services:
- Frontend: http://localhost (port 80)
- Backend API: http://localhost:3000
- MCP Server: http://localhost:6213
With Docker (Frontend + Backend)
-
Clone the repository:
git clone https://github.com/michael-elkabetz/claudecodex.git cd claudecodex -
Set up environment variables:
Update the main
Dockerfilewith the following environment variables:VITE_GITHUB_CLIENT_ID=[VITE_GITHUB_CLIENT_ID] VITE_GITHUB_REDIRECT_URI=[VITE_GITHUB_REDIRECT_URI] GITHUB_CLIENT_SECRET=[GITHUB_CLIENT_SECRET] GITHUB_TOKEN=ghp_xxx API_KEY=[your_anthropic_or_openai_api_key] # Optional
3. Build and deploy:
```bash
docker build -t ClaudeCodex-backend .
docker run -d -p 80:80 ClaudeCodex-backend
```
Development
Quick Setup
npm install
npm run dev
# Individual services
npm run dev:frontend
npm run dev:backend
npm run dev:mcp
Development URLs
- Frontend: http://localhost
- Backend: http://localhost:3000
- MCP Server: http://localhost:6213
🚀 Docker Deployment
Using Docker Compose (Recommended)
# Production deployment
docker-compose up --build -d
# Development with hot reload
docker-compose -f docker-compose.dev.yml up --build
Individual Services
# Frontend
docker build -f frontend/Dockerfile -t claudecodex-frontend ./frontend
docker run -d -p 80:80 claudecodex-frontend
# Backend
docker build -f backend/Dockerfile -t ClaudeCodex-backend ./backend
docker run -d -p 3000:3000 ClaudeCodex-backend
# MCP Server
docker build -f mcp/Dockerfile -t ClaudeCodex-mcp ./mcp
docker run -d -p 6213:6213 ClaudeCodex-mcp
Docker Compose Services
| Service | Port | Description |
|---|---|---|
| frontend | 80 | React TypeScript UI |
| backend | 3000 | Express.js REST API |
| mcp | 6213 | Model Context Protocol Server |
🔌 MCP Integration
Connecting to MCP Server
The MCP server runs on port 6213 and provides AI-powered code generation capabilities.
Connection URL: http://localhost:6213
MCP Inspector Setup
-
Start the MCP Inspector:
npm run inspector -
Open Inspector UI:
- Navigate to: http://127.0.0.1:6274
-
Configure Connection:
- Transport Type:
Streamable HTTP - MCP Server URL:
http://localhost:6213
- Transport Type:
-
Authentication:
- Copy the
MCP_PROXY_AUTH_TOKENfrom the inspector logs - Paste it in the Proxy Session Token field
- Click Connect
- Copy the
MCP Tools Available
- Execute: Complete AI-powered workflow (code generation, branch creation, PR automation)
- Integrates with GitHub repositories
- Supports Anthropic Claude and OpenAI GPT
- Automated branch and PR creation
📖 API Documentation
Backend Endpoints
- Swagger UI: http://localhost:3000/api-docs
- Health Check:
GET /api/health - AI Code Generation:
POST /api/dev/execute - GitHub Authentication:
POST /api/github/auth - Repository Branches:
POST /api/github/branches
MCP Protocol
- Server Info:
GET / - Tools List:
GET /tools - Generate:
POST /tools/generate
🛠️ Development
Tech Stack
Project Structure
ClaudeCodex/
├── frontend/ # React TypeScript UI
├── backend/ # Express.js API
├── mcp/ # MCP Server
├── docker-compose.yml # Multi-service deployment
└── README.md # You are here
Available Scripts
npm run dev # Start all services
npm run build # Build all services
npm run test # Run all tests
npm run lint # Lint all projects
npm run clean # Clean build artifacts
npm run dev:frontend # Frontend development
npm run dev:backend # Backend development
npm run dev:mcp # MCP server development
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Thanks to Anthropic for Claude Code
- Thanks to OpenAI for Codex
- Thanks to the open-source community
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。