Metadata-Version: 2.4
Name: uijit
Version: 0.1.1
Summary: MCP Server for A2UI Canvas rendering and Chromecast casting
Project-URL: Homepage, https://github.com/pigeek/uijit
Project-URL: Repository, https://github.com/pigeek/uijit
Author: Pigeek
License: MIT
License-File: LICENSE
Keywords: a2ui,canvas,chromecast,mcp,visualization
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Requires-Dist: aiofiles>=23.0.0
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: click>=8.0.0
Requires-Dist: loguru>=0.7.0
Requires-Dist: mcp>=1.0.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
Requires-Dist: pytest-aiohttp>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# uijit

**UI Just-In-Time** - MCP server for A2UI canvas rendering and Chromecast casting.

## What is uijit?

uijit is an MCP (Model Context Protocol) server that enables AI agents to create rich visualizations using the A2UI component format and cast them to Chromecast/Google TV devices in real-time.

This repository also hosts the **Canvas Receiver** - a Google Cast receiver application served via GitHub Pages at [uijit.com](https://uijit.com).

## Installation

```bash
pip install uijit
```

## Usage

### As an MCP server (stdio transport)

```bash
uijit --host 0.0.0.0 --port 8090
```

### With nanobot

Add to your nanobot config:

```json
{
  "tools": {
    "mcpServers": {
      "uijit": {
        "command": "uijit",
        "args": ["--host", "0.0.0.0", "--port", "8090"]
      }
    }
  }
}
```

### MCP Tools

| Tool | Description |
|------|-------------|
| `canvas_create` | Create a new canvas surface |
| `canvas_update` | Update components using A2UI format |
| `canvas_data` | Update data model without re-rendering |
| `canvas_close` | Close and delete a surface |
| `canvas_list` | List all surfaces |
| `canvas_show` | Show/navigate existing surfaces |
| `canvas_get` | Get full state of a canvas |

## How It Works

```
┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│  AI Agent   │────▶│   uijit     │────▶│   uijit     │────▶│ Chromecast  │
│  (nanobot)  │     │  MCP Server │     │  Receiver   │     │    TV       │
└─────────────┘     └─────────────┘     └─────────────┘     └─────────────┘
      │                   │                   │                   │
      │  A2UI JSON        │  WebSocket        │  Cast SDK         │
      │  (components)     │  (real-time)      │  (custom msg)     │
```

1. **AI Agent** generates A2UI visualization components via MCP tools
2. **uijit MCP Server** manages surfaces, renders HTML, serves via WebSocket
3. **uijit Receiver** (GitHub Pages) is loaded by Chromecast and connects to the server
4. **Chromecast** displays the live-updating visualization

## URLs

| Path | Description |
|------|-------------|
| [uijit.com](https://uijit.com) | Landing page |
| [uijit.com/canvas-receiver/](https://uijit.com/canvas-receiver/) | Google Cast receiver application |

## Chromecast Casting

uijit includes a pre-registered Google Cast receiver (App ID: `BE2EA00B`) that points to `https://uijit.com/canvas-receiver/`. No registration is needed — casting works out of the box when paired with [androidtvmcp](https://github.com/pigeek/androidtvmcp).

## Repository Structure

```
uijit/
├── index.html                 # Landing page (GitHub Pages)
├── canvas-receiver/
│   └── index.html             # Cast receiver application
├── pyproject.toml             # Python package metadata
├── src/uijit/                 # MCP server source
│   ├── cli.py                 # CLI entry point
│   ├── server.py              # MCP protocol handler
│   ├── canvas_manager.py      # Surface lifecycle management
│   ├── renderer.py            # A2UI → HTML renderer
│   ├── web_server.py          # HTTP/WebSocket server
│   └── models.py              # Data models
└── tests/
    └── test_canvas_manager.py # Tests
```

## Related Projects

- [androidtvmcp](https://github.com/pigeek/androidtvmcp) - MCP server for Android TV control

## License

MIT
