Sugar MCP Server for Claude Code Automation
Automate Claude Code workflows with the Sugar MCP server, enabling task management, specialized agents, and Python CLI-driven autonomous execution.
Overview
Sugar is an open-source Model Context Protocol (MCP) server designed to automate Claude Code workflows. It provides a lightweight HTTP/MCP interface and a Python CLI that let you define tasks, attach specialized agents, and run autonomous or semi-autonomous code-oriented workflows. Sugar is useful when you want to orchestrate multi-step code operations (generate code, run tests, review changes, commit) while keeping the orchestration logic outside of the model itself.
The server implements MCP-compatible endpoints so Claude Code or other MCP-aware models can connect and exchange structured context and actions. Developers use Sugar to manage task state, persist task histories, and hand off subtasks to specialized agents (for example: code-generation, testing, linting, or deployment agents). A small Python client/CLI makes it easy to script or run autonomous task loops from local development environments or CI pipelines.
Features
- MCP-compatible HTTP server that exposes task and agent endpoints
- Python client and CLI for creating, listing, and running tasks/agents
- Task lifecycle management (create, update, status, history)
- Agent orchestration: register specialized agents and route subtasks
- Autonomous run mode: CLI-driven loops that execute until task completion
- Pluggable configuration for model keys, timeouts, and persistence backends
- Simple JSON-based API suitable for integration with Claude Code or other MCP consumers
Installation / Configuration
Prerequisites:
- Python 3.10+
- Git
- An API key for your model provider (Claude Code or other MCP-capable endpoint)
Quick start:
- Clone the repo and create a virtual environment
- Configure environment variables (example)
# Optional: persistence settings, timeouts
- Run the MCP server
# Start the server (example)
# Or use the provided CLI:
Example configuration file (YAML)
host: 0.0.0.0
port: 8080
db_url: sqlite:///./sugar.db
model:
provider: claude
api_key_env: CLAUDE_API_KEY
agents:
- name: code-generator
role: generator
- name: test-runner
role: tester
Available Tools
- Python CLI: sugar
- Commands: server start, tasks create/list/get, agents register/run, run-autonomy
- HTTP API endpoints (examples)
- POST /tasks — create a new task
- GET /tasks — list tasks
- GET /tasks/{id} — fetch task status/history
- POST /agents/{agent_name}/run — request an agent to process a task
- Python client library (import sugar.client)
- sugar.client.SugarClient for programmatic access from scripts and CI
CLI quick reference
| Command | Purpose |
|---|---|
| sugar server start | Launch the MCP server |
| sugar tasks create | Create a new task from CLI |
| sugar tasks list | List all tasks |
| sugar agents register | Register a new agent |
| sugar run-autonomy | Run an autonomous loop for a task |
Example: create a task via curl
Example: Python client usage
=
=
Use Cases
Automated test generation and execution
- Use Sugar to create a “generate tests” task, call a code-generator agent to produce test code, then pass the result to a test-runner agent that executes the tests and records results in the task history.
Codebase refactor with CI integration
- Define a refactor task, have a generator agent propose changes, run a linter/formatter agent, and then a reviewer agent to produce a summary. Use the autonomous run mode in CI to apply, test, and report changes.
Multi-agent code review workflow
- Register different agents (static analysis, security scan, human reviewer). When a new task (PR or change) appears, route it through agents sequentially and aggregate their outputs into a single task report.
Prototyping autonomous developer agents
- Experiment with an autonomous loop: create a task like “implement feature X”, set a sequence of agents (plan -> generate -> test -> iterate), and run sugar run-autonomy to let agents drive the workflow until the task reaches a terminal status.
Resources
- Source code and issues: https://github.com/cdnsteve/sugar
- Python package entry points and CLI live in the repository (see sugar/cli and sugar/server)
- Use