# PrintCast Agent ๐๏ธ๐โ๏ธ
An automated voice-to-print service that integrates AI conversational agents with physical printing and delivery. Users can call a phone number, interact with an AI agent to select trending content (GitHub repos, RSS feeds, news), and have it printed and delivered to their address.
## ๐ Features
- **Voice Interface**: Natural conversation through phone calls using ElevenLabs Conversational AI
- **Multi-language Support**: Czech and English language support
- **Content Sources**:
- GitHub Trending repositories
- RSS feeds
- News articles
- **Automated Printing**: CUPS integration for local/network printing
- **Delivery Integration**: Support for multiple carriers (Czech Post, Zรกsilkovna, DPD, PPL)
- **MCP Server**: Full Model Context Protocol implementation for AI client integration
- **Workflow Orchestration**: Complete automation from call to delivery
## ๐๏ธ Architecture
```
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Asterisk โโโโโโถโ ElevenLabs โโโโโโถโ Content โ
โ SIP Server โ โ AI Agent โ โ Fetcher โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโผโโโโโโโโโ
โ PrintCast โ
โ MCP Server โ
โโโโโโโโโฌโโโโโโโโโ
โ
โโโโโโโโโโโโโผโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโผโโโโโ โโโโโผโโโโโ โโโโโโผโโโโโโ
โ Print โ โDeliveryโ โ AWS โ
โ Server โ โService โ โ Services โ
โโโโโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโโโ
```
## ๐ Prerequisites
- Python 3.11+
- Asterisk PBX (optional, for telephony)
- CUPS (optional, for printing)
- ElevenLabs API key
- Carrier API keys (for delivery services)
## ๐ Quick Start
### 1. Clone the repository
```bash
git clone https://github.com/yourusername/printcast-agent.git
cd printcast-agent
```
### 2. Install dependencies
```bash
pip install -e .
```
### 3. Configure environment
Create a `.env` file:
```bash
# Core settings
SERVER_NAME=PrintCast Agent
DEBUG=false
# Asterisk settings
ASTERISK_HOST=localhost
ASTERISK_PORT=5038
ASTERISK_USERNAME=admin
ASTERISK_PASSWORD=your_password
# ElevenLabs settings
ELEVENLABS_API_KEY=your_api_key
ELEVENLABS_VOICE_ID=voice_id
# Content sources
GITHUB_TOKEN=optional_token
NEWS_API_KEY=optional_key
RSS_FEEDS=https://news.ycombinator.com/rss,https://feeds.feedburner.com/TechCrunch/
# Printing
DEFAULT_PRINTER=default
CUPS_SERVER=localhost:631
# Delivery
DEFAULT_CARRIER=post
SENDER_NAME=PrintCast
SENDER_STREET=Your Street
SENDER_CITY=Your City
SENDER_POSTAL_CODE=12345
SENDER_COUNTRY=CZ
# Carrier APIs (optional)
ZASILKOVNA_API_KEY=your_key
DPD_API_KEY=your_key
PPL_API_KEY=your_key
```
### 4. Run the MCP server
```bash
python -m mcp_server.main
```
## ๐ณ Docker Deployment
### Build the container
```bash
podman build -t printcast-agent -f Containerfile .
```
### Run with Podman
```bash
podman run -d \
--name printcast \
-p 8000:8000 \
-p 5038:5038 \
-p 5060:5060 \
-v ./config:/app/config \
--env-file .env \
printcast-agent
```
## ๐ Workflow Example
1. **User calls the service** โ Asterisk receives call
2. **AI agent greets user** โ "Welcome to PrintCast! What would you like to print today?"
3. **Content selection** โ User chooses GitHub trending, RSS, or news
4. **Agent reads options** โ "Here are today's top 5 trending repositories..."
5. **User selects items** โ Via voice or DTMF keys
6. **Address collection** โ User provides delivery address
7. **Order confirmation** โ Agent confirms selection and address
8. **Processing** โ System generates PDF, prints, and arranges delivery
9. **Completion** โ User receives tracking number via SMS
## ๐ ๏ธ MCP Tools Available
The server provides these MCP tools:
- `handle_incoming_call` - Process incoming phone calls
- `fetch_trending_content` - Get trending content from various sources
- `process_user_selection` - Handle user's content selection
- `generate_print_preview` - Create print preview
- `get_delivery_quote` - Get shipping cost estimate
- `end_call_session` - Terminate call session
## ๐ Monitoring
The server provides real-time monitoring through MCP resources:
- `resource://sessions/active` - Active call sessions
- `resource://config/services` - Service configuration status
- `resource://metrics/daily` - Daily usage metrics
## ๐งช Testing
Run tests with pytest:
```bash
pytest tests/ -v --cov=src
```
## ๐ฆ Project Structure
```
printcast-agent/
โโโ src/
โ โโโ mcp_server/ # MCP server implementation
โ โโโ integrations/ # Service integrations
โ โ โโโ asterisk.py # SIP/telephony
โ โ โโโ elevenlabs.py # AI voice agent
โ โ โโโ content.py # Content fetching
โ โ โโโ printing.py # Print management
โ โ โโโ delivery.py # Shipping services
โ โโโ orchestration/ # Workflow engine
โ โโโ utils/ # Utilities
โโโ config/ # Configuration files
โโโ scripts/ # Deployment scripts
โโโ tests/ # Test suite
โโโ Containerfile # Container definition
โโโ pyproject.toml # Project metadata
```
## ๐ค Integration with MCP Clients
### With Cursor Agent
```bash
# Add to Cursor's MCP settings
{
"printcast": {
"command": "python",
"args": ["-m", "mcp_server.main"],
"cwd": "/path/to/printcast-agent"
}
}
```
### With Gemini CLI
```bash
# Configure Gemini to use PrintCast MCP server
gemini config add-server printcast http://localhost:8000
```
## ๐ API Documentation
### Starting a workflow
```python
# MCP tool call
await handle_incoming_call(
caller_id="+420123456789",
language="cs"
)
```
### Fetching content
```python
# Get trending GitHub repos
repos = await fetch_trending_content(
content_type="github",
limit=5,
language="python"
)
```
### Processing order
```python
# Process user selection
result = await process_user_selection(
session_id="call_20240101_120000",
selected_items=["gh_openai_gpt", "gh_astro_framework"],
delivery_address="Vรกclavskรฉ nรกmฤstรญ 1, Praha, 11000",
delivery_method="post"
)
```
## ๐ Security Considerations
- All API keys should be kept secure
- Use HTTPS/TLS for production deployments
- Implement rate limiting for API endpoints
- Validate and sanitize all user inputs
- Regular security audits recommended
## ๐ License
MIT License - see LICENSE file for details
## ๐ Acknowledgments
- ElevenLabs for conversational AI capabilities
- Asterisk community for telephony infrastructure
- MCP protocol developers
- Open source contributors
## ๐ฎ Contact
For questions and support:
- GitHub Issues: [Report bugs](https://github.com/yourusername/printcast-agent/issues)
- Email: team@printcast.ai
---
**PrintCast Agent** - Bridging the digital and physical worlds through voice ๐๏ธโ๐โ๐ฎ