claude-worker 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Yigit Konur
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,412 @@
1
+ Metadata-Version: 2.3
2
+ Name: claude-worker
3
+ Version: 0.1.1
4
+ Summary: Fire-and-forget task execution system for Claude Code SDK with CLI and MCP interfaces
5
+ License: MIT
6
+ Keywords: claude,ai,automation,task-queue,cli,mcp,anthropic
7
+ Author: Yigit Konur
8
+ Author-email: yigit@thinkbuddy.ai
9
+ Requires-Python: >=3.10,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Framework :: FastAPI
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Provides-Extra: full
24
+ Provides-Extra: mcp
25
+ Provides-Extra: server
26
+ Requires-Dist: claude-code-sdk (>=0.0.19)
27
+ Requires-Dist: fastapi (>=0.100.0) ; extra == "server" or extra == "full"
28
+ Requires-Dist: fastmcp (>=2.0.0) ; extra == "mcp" or extra == "full"
29
+ Requires-Dist: httpx (>=0.25.0) ; extra == "mcp" or extra == "server" or extra == "full"
30
+ Requires-Dist: sqlmodel (>=0.0.14)
31
+ Requires-Dist: typer[rich] (>=0.12.0) ; extra == "server" or extra == "full"
32
+ Requires-Dist: uvicorn[standard] (>=0.23.0) ; extra == "server" or extra == "full"
33
+ Project-URL: Bug Tracker, https://github.com/yigitkonur/claude-worker/issues
34
+ Project-URL: Changelog, https://github.com/yigitkonur/claude-worker/blob/main/CHANGELOG.md
35
+ Project-URL: Documentation, https://github.com/yigitkonur/claude-worker/blob/main/README.md
36
+ Project-URL: Homepage, https://github.com/yigitkonur/claude-worker
37
+ Project-URL: MCP Documentation, https://github.com/yigitkonur/claude-worker/blob/main/MCP_README.md
38
+ Project-URL: Repository, https://github.com/yigitkonur/claude-worker
39
+ Description-Content-Type: text/markdown
40
+
41
+
42
+ > **🔥 The most flexible fire-and-forget task execution system + prod-level MCP for Claude Code SDK**
43
+ > Run with zero infrastructure (MCP standalone) or at scale (REST API + Workers)
44
+
45
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
46
+ [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io)
47
+ [![FastAPI](https://img.shields.io/badge/FastAPI-0.100%2B-009688.svg)](https://fastapi.tiangolo.com)
48
+ [![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
49
+ [![PyPI Version](https://img.shields.io/badge/PyPI-v0.1.0%20(beta)-orange.svg)](https://pypi.org/project/claude-worker/)
50
+ [![Documentation](https://img.shields.io/badge/docs-comprehensive-success.svg)](docs/00-overview.md)
51
+
52
+ ## 🎯 Why Claude Worker?
53
+
54
+ **The Problem:** Claude Code SDK tasks can take minutes or hours to complete. Running them blocks your terminal and loses progress if interrupted. Sometimes parallel task execution is possible and this enable you to run multiple tasks in parallel. You can use Claude Code as CTO and run different execution by using MCP server mode!
55
+
56
+ **The Solution:** Claude Worker provides a robust task execution system that:
57
+ - ✅ **Runs anywhere** - From lightweight MCP tools to full enterprise deployments
58
+ - ✅ **Never loses work** - SQLite persistence survives crashes
59
+ - ✅ **Scales flexibly** - Process isolation with configurable workers
60
+ - ✅ **Integrates everywhere** - MCP, REST API, CLI, or programmatic
61
+
62
+ ## 🏗️ Architecture: Two Modes, One Codebase
63
+
64
+ ```mermaid
65
+ graph TB
66
+ subgraph "Lightweight Mode (MCP Only)"
67
+ User1[Claude Desktop/Code] -->|stdio| MCP1[MCP Server]
68
+ MCP1 --> DB1[(Embedded SQLite)]
69
+ MCP1 --> Executor1[Direct Execution]
70
+ end
71
+
72
+ subgraph "Full Stack Mode (REST + MCP)"
73
+ User2[CLI/API Client] -->|HTTP| REST[REST API]
74
+ User3[Claude Desktop] -->|stdio| MCP2[MCP Proxy]
75
+ MCP2 -->|HTTP| REST
76
+ REST --> DB2[(Shared Database)]
77
+ REST --> Pool[Process Pool]
78
+ Pool --> Workers[Worker Processes]
79
+ end
80
+
81
+ style MCP1 fill:#90EE90
82
+ style MCP2 fill:#87CEEB
83
+ style REST fill:#FFB6C1
84
+ ```
85
+
86
+ ## ⚡ Quick Start
87
+
88
+ ### Choose Your Path:
89
+
90
+ <table>
91
+ <tr>
92
+ <td width="33%">
93
+
94
+ ### 🪶 Lightweight (MCP Only)
95
+ **For:** Claude Desktop users, simple automation
96
+
97
+ ```bash
98
+ pip install "claude-worker[mcp]"
99
+ fastmcp install claude-desktop \
100
+ claude-worker-mcp
101
+ ```
102
+
103
+ [→ Installation Guide](docs/01-getting-started-installation.md)
104
+
105
+ </td>
106
+ <td width="33%">
107
+
108
+ ### 🏢 Full Stack
109
+ **For:** Teams, production, complex workflows
110
+
111
+ ```bash
112
+ pip install "claude-worker[full]"
113
+ claude-worker server start
114
+ claude-worker run "Your task"
115
+ ```
116
+
117
+ [→ Quick Start Guide](docs/01-getting-started-quick-start.md)
118
+
119
+ </td>
120
+ <td width="33%">
121
+
122
+ ### 🔧 Development
123
+ **For:** Contributors, customization
124
+
125
+ ```bash
126
+ git clone <repo>
127
+ poetry install
128
+ poetry run claude-worker
129
+ ```
130
+
131
+ [→ Development Setup](docs/06-contributing-development-setup.md)
132
+
133
+ </td>
134
+ </tr>
135
+ </table>
136
+
137
+ ---
138
+
139
+ ## 📚 Documentation
140
+
141
+ Comprehensive documentation is available in the `docs/` directory:
142
+
143
+ ### 🚀 Getting Started
144
+ - **[Overview](docs/00-overview.md)** - Project introduction and feature overview
145
+ - **[Installation](docs/01-getting-started-installation.md)** - Complete setup guide for all platforms
146
+ - **[Quick Start](docs/01-getting-started-quick-start.md)** - Get running in 5 minutes
147
+
148
+ ### 📖 User Guides
149
+ - **[CLI Reference](docs/02-user-guide-cli-reference.md)** - Complete command reference
150
+ - **[Task Submission](docs/02-user-guide-task-submission.md)** - Advanced submission methods (files, stdin, automation)
151
+ - **[Monitoring & Logs](docs/02-user-guide-monitoring-and-logs.md)** - Status checking and debugging
152
+
153
+ ### 🏗️ Core Concepts
154
+ - **[Architecture](docs/03-concepts-architecture.md)** - System design and component overview
155
+ - **[Database Schema](docs/03-concepts-database-schema.md)** - Data model and persistence
156
+ - **[Process Model](docs/03-concepts-process-model.md)** - Task execution lifecycle
157
+ - **[Project Philosophy](docs/03-concepts-project-philosophy.md)** - Design principles and SOLE responsibility
158
+
159
+ ### 🔌 Integrations
160
+ - **[REST API](docs/04-integrations-rest-api.md)** - HTTP endpoints and data models
161
+ - **[MCP for AI Agents](docs/04-integrations-mcp-for-agents.md)** - Model Context Protocol integration
162
+
163
+ ### ⚙️ Administration
164
+ - **[Configuration](docs/05-administration-configuration.md)** - Environment variables and settings
165
+ - **[Deployment](docs/05-administration-deployment.md)** - Production deployment strategies
166
+ - **[Security](docs/05-administration-security.md)** - Security considerations and best practices
167
+
168
+ ### 🤝 Contributing
169
+ - **[Development Setup](docs/06-contributing-development-setup.md)** - Local development environment
170
+ - **[Contribution Guide](docs/06-contributing-guide.md)** - How to contribute to the project
171
+
172
+ ---
173
+
174
+ ## 🚀 Installation
175
+
176
+ ### Prerequisites
177
+
178
+ - **Python 3.10+** and **Node.js 16+** (for Claude Code SDK)
179
+ - **Anthropic API Key** ([Get yours here](https://console.anthropic.com/))
180
+
181
+ ### Installation Options
182
+
183
+ ```bash
184
+ # 1. MCP Tools Only (Lightweight)
185
+ pip install "claude-worker[mcp]"
186
+
187
+ # 2. REST API + CLI (No MCP)
188
+ pip install "claude-worker[server]"
189
+
190
+ # 3. Everything (Recommended)
191
+ pip install "claude-worker[full]"
192
+
193
+ # 4. From Source (Development)
194
+ git clone https://github.com/yigitkonur/claude-worker
195
+ cd claude-worker
196
+ poetry install
197
+ ```
198
+
199
+ > 📖 **Need detailed setup instructions?** See the [Installation Guide](docs/01-getting-started-installation.md)
200
+
201
+ ## 🎮 Usage Examples
202
+
203
+ ### MCP Mode (Claude Desktop Integration)
204
+
205
+ ```bash
206
+ # Install MCP server
207
+ pip install "claude-worker[mcp]"
208
+ fastmcp install claude-desktop claude-worker-mcp
209
+
210
+ # Available tools in Claude Desktop:
211
+ # - create_task, get_task_status, list_tasks, get_task_logs
212
+ ```
213
+
214
+ ### Server Mode (CLI & API)
215
+
216
+ ```bash
217
+ # Start server
218
+ claude-worker server start
219
+
220
+ # Submit tasks
221
+ claude-worker run "Create a README for my project"
222
+ claude-worker run "Refactor this code" --dir ./src --watch
223
+
224
+ # Monitor tasks
225
+ claude-worker list
226
+ claude-worker status 1
227
+ ```
228
+
229
+ ### Advanced Task Submission
230
+
231
+ ```bash
232
+ # From files
233
+ claude-worker run prompt-template.txt --dir ./project
234
+
235
+ # From stdin (great for automation)
236
+ git diff | claude-worker run "Review these changes"
237
+ find . -name "*.py" | xargs -I {} claude-worker run "Document {}"
238
+ ```
239
+
240
+ > 📖 **For comprehensive usage examples:** See [Task Submission Guide](docs/02-user-guide-task-submission.md) and [CLI Reference](docs/02-user-guide-cli-reference.md)
241
+
242
+ ### REST API Usage
243
+
244
+ ```python
245
+ # Python example
246
+ import httpx
247
+
248
+ client = httpx.Client(base_url="http://localhost:8000")
249
+
250
+ # Create task
251
+ task = client.post("/api/v1/tasks", json={
252
+ "execution_prompt": "Build a todo app with FastAPI",
253
+ "working_directory": "./project",
254
+ "system_prompt": "You are a Python expert"
255
+ }).json()
256
+
257
+ # Check status
258
+ status = client.get(f"/api/v1/tasks/{task['id']}").json()
259
+ print(f"Task {task['id']}: {status['status']}")
260
+ ```
261
+
262
+ ```javascript
263
+ // JavaScript example
264
+ const response = await fetch('http://localhost:8000/api/v1/tasks', {
265
+ method: 'POST',
266
+ headers: { 'Content-Type': 'application/json' },
267
+ body: JSON.stringify({
268
+ execution_prompt: 'Build a todo app with FastAPI',
269
+ working_directory: './project'
270
+ })
271
+ });
272
+ const task = await response.json();
273
+ ```
274
+
275
+ > 📖 **For complete API documentation:** See [REST API Reference](docs/04-integrations-rest-api.md)
276
+
277
+ ## 🔧 Configuration
278
+
279
+ ### Essential Environment Variables
280
+
281
+ ```bash
282
+ # Required
283
+ export ANTHROPIC_API_KEY=your-api-key-here
284
+
285
+ # Optional (with defaults)
286
+ export CLAUDE_WORKER_DB=~/.claude-worker/tasks.db
287
+ export CLAUDE_WORKER_SERVER_URL=http://localhost:8000 # for CLI client
288
+ export CLAUDE_WORKER_LOG_DIR=~/.claude-worker/logs
289
+ ```
290
+
291
+ > 📖 **For complete configuration options:** See [Configuration Guide](docs/05-administration-configuration.md)
292
+
293
+ ## 🐛 Troubleshooting
294
+
295
+ ### Quick Fixes for Common Issues
296
+
297
+ | Issue | Quick Fix |
298
+ |-------|-----------|
299
+ | **MCP not showing in Claude Desktop** | Restart Claude Desktop completely (Cmd+Q) |
300
+ | **Tasks stuck in "running"** | Check `echo $ANTHROPIC_API_KEY` and task logs |
301
+ | **Database lock errors** | Stop all services: `pkill -f claude-worker` |
302
+ | **Permission denied** | Fix permissions: `chmod 755 ~/.claude-worker` |
303
+
304
+ ### Debug Commands
305
+
306
+ ```bash
307
+ # Check system status
308
+ claude-worker server health
309
+ echo $ANTHROPIC_API_KEY
310
+
311
+ # View logs
312
+ tail -f ~/.claude-worker/logs/*.log
313
+
314
+ # List processes
315
+ ps aux | grep claude-worker
316
+ ```
317
+
318
+ > 📖 **For detailed troubleshooting:** See [Security Guide](docs/05-administration-security.md) and check the issues on GitHub
319
+
320
+ ## 🚢 Production Deployment
321
+
322
+ ### Docker (Recommended)
323
+
324
+ ```bash
325
+ # Quick start with Docker Compose
326
+ curl -O https://raw.githubusercontent.com/yigitkonur/claude-worker/main/docker-compose.yml
327
+ echo "ANTHROPIC_API_KEY=your-key" > .env
328
+ docker-compose up -d
329
+ ```
330
+
331
+ ```dockerfile
332
+ # Custom Dockerfile
333
+ FROM python:3.11-slim
334
+ WORKDIR /app
335
+ RUN pip install "claude-worker[full]"
336
+ ENV CLAUDE_WORKER_DB=/data/tasks.db
337
+ EXPOSE 8000
338
+ CMD ["claude-worker", "server", "start", "--host", "0.0.0.0"]
339
+ ```
340
+
341
+ ### Systemd Service
342
+
343
+ ```ini
344
+ # /etc/systemd/system/claude-worker.service
345
+ [Unit]
346
+ Description=Claude Worker Server
347
+ After=network.target
348
+
349
+ [Service]
350
+ Type=exec
351
+ User=claude
352
+ WorkingDirectory=/opt/claude-worker
353
+ Environment="ANTHROPIC_API_KEY=your-key-here"
354
+ ExecStart=/usr/local/bin/claude-worker server start --host 0.0.0.0
355
+ Restart=on-failure
356
+
357
+ [Install]
358
+ WantedBy=multi-user.target
359
+ ```
360
+
361
+ > 📖 **For comprehensive deployment guides:** See [Deployment Guide](docs/05-administration-deployment.md)
362
+
363
+ ## 🏗️ Architecture Principles
364
+
365
+ - **🎯 SOLE Responsibility**: Each module has Single, Overarching, Lucidly-stated Expertise
366
+ - **🔒 Process Isolation**: Every task runs in its own process for safety
367
+ - **💾 Fail-Safe**: SQLite persistence ensures no work is lost
368
+ - **🔧 Extensible**: Clear interfaces for adding new features
369
+
370
+ > 📖 **Learn more about the design:** See [Project Philosophy](docs/03-concepts-project-philosophy.md) and [Architecture Overview](docs/03-concepts-architecture.md)
371
+
372
+ ## 🤝 Contributing
373
+
374
+ We welcome contributions! Here's how to get started:
375
+
376
+ ```bash
377
+ # 1. Fork and clone
378
+ git clone https://github.com/your-username/claude-worker
379
+ cd claude-worker
380
+
381
+ # 2. Set up development environment
382
+ poetry install
383
+ poetry run pre-commit install
384
+
385
+ # 3. Make your changes and test
386
+ poetry run pytest
387
+ poetry run black .
388
+ poetry run mypy .
389
+
390
+ # 4. Submit a pull request
391
+ ```
392
+
393
+ > 📖 **Detailed contribution guidelines:** See [Contributing Guide](docs/06-contributing-guide.md) and [Development Setup](docs/06-contributing-development-setup.md)
394
+
395
+ ## 📄 License
396
+
397
+ MIT License - see [LICENSE](LICENSE) file for details.
398
+
399
+ ## 🙏 Acknowledgments
400
+
401
+ Built with love using:
402
+ - **[Claude Code SDK](https://github.com/anthropics/claude-code-sdk)** - The AI execution engine
403
+ - **[FastAPI](https://fastapi.tiangolo.com/)** - Modern, fast web framework
404
+ - **[FastMCP](https://github.com/jlowin/fastmcp)** - MCP server framework
405
+ - **[Typer](https://typer.tiangolo.com/)** - Beautiful CLI interfaces
406
+ - **[SQLModel](https://sqlmodel.tiangolo.com/)** - Modern Python ORM
407
+
408
+ Special thanks to the **Anthropic team** and the **MCP community** 💜
409
+
410
+ ---
411
+
412
+ **⭐ Star this repo if Claude Worker helps you build amazing things!**