mirror of
https://github.com/trycua/lume.git
synced 2026-05-05 11:50:24 -05:00
add claude desktop extension build script
This commit is contained in:
-57
@@ -2,14 +2,11 @@
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
node_modules/*
|
||||
*/node_modules
|
||||
**/node_modules
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
@@ -31,17 +28,14 @@ share/python-wheels/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
@@ -56,52 +50,39 @@ coverage.xml
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
.pdm.toml
|
||||
.pdm-python
|
||||
.pdm-build/
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
@@ -110,89 +91,63 @@ venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Git worktrees
|
||||
.worktrees/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Scripts
|
||||
server/scripts/
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# Ruff stuff:
|
||||
.ruff_cache/
|
||||
|
||||
# PyPI configuration file
|
||||
.pypirc
|
||||
|
||||
# Conda
|
||||
.conda/
|
||||
|
||||
# Local environment
|
||||
.env.local
|
||||
|
||||
# macOS DS_Store
|
||||
.DS_Store
|
||||
|
||||
weights/
|
||||
weights/icon_detect/
|
||||
weights/icon_detect/model.pt
|
||||
weights/icon_detect/model.pt.zip
|
||||
weights/icon_detect/model.pt.zip.part*
|
||||
|
||||
libs/python/omniparser/weights/icon_detect/model.pt
|
||||
|
||||
# Example test data and output
|
||||
examples/test_data/
|
||||
examples/output/
|
||||
|
||||
/screenshots/
|
||||
|
||||
/experiments/
|
||||
|
||||
/logs/
|
||||
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
## User settings
|
||||
xcuserdata/
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
|
||||
## App packaging
|
||||
*.ipa
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
## Playgrounds
|
||||
timeline.xctimeline
|
||||
playground.xcworkspace
|
||||
|
||||
# Swift Package Manager
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
|
||||
@@ -205,7 +160,6 @@ playground.xcworkspace
|
||||
# hence it is not needed unless you have added a package configuration file to your project
|
||||
.swiftpm/
|
||||
.build/
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
@@ -216,13 +170,11 @@ playground.xcworkspace
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from the Xcode workspace
|
||||
# *.xcworkspace
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
Carthage/Build/
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo.
|
||||
@@ -233,30 +185,21 @@ fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots/**/*.png
|
||||
fastlane/test_output
|
||||
|
||||
# Ignore folder
|
||||
ignore
|
||||
|
||||
# .release
|
||||
.release/
|
||||
|
||||
# Shared folder
|
||||
shared
|
||||
|
||||
# Trajectories
|
||||
trajectories/
|
||||
|
||||
# Installation ID Storage
|
||||
.storage/
|
||||
|
||||
# Gradio settings
|
||||
.gradio_settings.json
|
||||
|
||||
# Lumier Storage
|
||||
storage/
|
||||
|
||||
# Trashes
|
||||
.Trashes
|
||||
.Trash-1000/
|
||||
|
||||
post-provision
|
||||
@@ -102,6 +102,31 @@ Expected results:
|
||||
- Assistant messages streamed during execution
|
||||
- A final screenshot image
|
||||
|
||||
## Desktop Extension
|
||||
|
||||
CUA also provides a Claude Desktop Extension (`.mcpb` file) for easy one-click installation.
|
||||
|
||||
### Building the Desktop Extension
|
||||
|
||||
To build the desktop extension from source:
|
||||
|
||||
```bash
|
||||
cd libs/python/mcp-server
|
||||
python3 build-extension.py
|
||||
```
|
||||
|
||||
This creates `desktop-extension/cua-extension.mcpb` which can be installed directly in Claude Desktop.
|
||||
|
||||
### Installing the Desktop Extension
|
||||
|
||||
1. Build the extension (see above)
|
||||
2. Open Claude Desktop Settings
|
||||
3. Go to Extensions
|
||||
4. Drop the `cua-extension.mcpb` file into the window
|
||||
5. Follow the installation prompts
|
||||
|
||||
See [desktop-extension/README.md](desktop-extension/README.md) for more details.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Installation: https://trycua.com/docs/libraries/mcp-server/installation
|
||||
|
||||
Executable
+111
@@ -0,0 +1,111 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Build script for CUA Desktop Extension (.mcpb file)
|
||||
|
||||
This script:
|
||||
1. Creates a temporary build directory
|
||||
2. Copies necessary files from mcp_server/ to the build directory
|
||||
3. Copies manifest and other static files
|
||||
4. Creates a .mcpb (zip) file
|
||||
5. Cleans up the temporary directory
|
||||
|
||||
Usage:
|
||||
python build-extension.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
"""Build the desktop extension."""
|
||||
# Get the script directory (libs/python/mcp-server)
|
||||
script_dir = Path(__file__).parent
|
||||
repo_root = script_dir.parent.parent.parent
|
||||
|
||||
# Define paths
|
||||
output_dir = script_dir / "desktop-extension"
|
||||
output_file = output_dir / "cua-extension.mcpb"
|
||||
|
||||
# Source directories
|
||||
mcp_server_dir = script_dir / "mcp_server"
|
||||
|
||||
# Required files to copy
|
||||
files_to_copy = {
|
||||
"manifest.json": output_dir / "manifest.json",
|
||||
"logo_black.png": output_dir / "logo_black.png",
|
||||
"requirements.txt": output_dir / "requirements.txt",
|
||||
"run_server.sh": output_dir / "run_server.sh",
|
||||
"setup.py": output_dir / "setup.py",
|
||||
}
|
||||
|
||||
# MCP server files to copy
|
||||
mcp_server_files = [
|
||||
"server.py",
|
||||
"session_manager.py",
|
||||
]
|
||||
|
||||
print("Building CUA Desktop Extension...")
|
||||
print(f" Output: {output_file}")
|
||||
|
||||
# Create temporary build directory
|
||||
with tempfile.TemporaryDirectory(prefix="cua-extension-build-") as build_dir:
|
||||
build_path = Path(build_dir)
|
||||
|
||||
# Copy MCP server files
|
||||
print(" Copying MCP server files...")
|
||||
for filename in mcp_server_files:
|
||||
src = mcp_server_dir / filename
|
||||
dst = build_path / filename
|
||||
if src.exists():
|
||||
shutil.copy2(src, dst)
|
||||
print(f" ✓ {filename}")
|
||||
else:
|
||||
print(f" ✗ {filename} (not found)")
|
||||
sys.exit(1)
|
||||
|
||||
# Copy static files from desktop-extension directory
|
||||
print(" Copying static files...")
|
||||
for src_name, src_path in files_to_copy.items():
|
||||
if src_path.exists():
|
||||
dst = build_path / src_name
|
||||
# Special handling for shell script - ensure executable
|
||||
shutil.copy2(src_path, dst)
|
||||
if src_name.endswith(".sh"):
|
||||
os.chmod(dst, 0o755)
|
||||
print(f" ✓ {src_name}")
|
||||
else:
|
||||
print(f" ✗ {src_name} (not found)")
|
||||
sys.exit(1)
|
||||
|
||||
# Validate manifest.json exists
|
||||
manifest_path = build_path / "manifest.json"
|
||||
if not manifest_path.exists():
|
||||
print(" ✗ manifest.json not found in build directory")
|
||||
sys.exit(1)
|
||||
|
||||
# Create the .mcpb file (zip archive)
|
||||
print(" Creating .mcpb archive...")
|
||||
with zipfile.ZipFile(output_file, "w", zipfile.ZIP_DEFLATED) as zipf:
|
||||
# Add all files from build directory to the zip
|
||||
for root, dirs, files in os.walk(build_path):
|
||||
# Skip __pycache__ and other unwanted directories
|
||||
dirs[:] = [d for d in dirs if d not in ["__pycache__", ".git"]]
|
||||
|
||||
for file in files:
|
||||
file_path = Path(root) / file
|
||||
# Use relative path from build directory as archive name
|
||||
arcname = file_path.relative_to(build_path)
|
||||
zipf.write(file_path, arcname)
|
||||
print(f" ✓ Added {arcname}")
|
||||
|
||||
print(f"✓ Build complete: {output_file}")
|
||||
print(f" Archive size: {output_file.stat().st_size / 1024:.1f} KB")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,63 @@
|
||||
# CUA Desktop Extension
|
||||
|
||||
This directory contains the build artifacts for the CUA Desktop Extension (`.mcpb` file).
|
||||
|
||||
## Building the Extension
|
||||
|
||||
To build the extension, run the build script from the parent directory:
|
||||
|
||||
```bash
|
||||
cd /path/to/libs/python/mcp-server
|
||||
python3 build-extension.py
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
1. Copy the MCP server code from `mcp_server/` directory
|
||||
2. Copy static files (manifest, icons, scripts)
|
||||
3. Create a `.mcpb` zip archive in `desktop-extension/cua-extension.mcpb`
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
desktop-extension/
|
||||
├── README.md # This file
|
||||
├── manifest.json # Extension manifest
|
||||
├── logo_black.png # Extension icon
|
||||
├── requirements.txt # Python dependencies
|
||||
├── run_server.sh # Server launcher script
|
||||
├── setup.py # Dependency installer
|
||||
└── cua-extension.mcpb # Generated extension archive (gitignored)
|
||||
```
|
||||
|
||||
## Source Files
|
||||
|
||||
The actual MCP server code lives in `../mcp_server/`:
|
||||
|
||||
- `server.py` - Main MCP server implementation
|
||||
- `session_manager.py` - Session management and resource pooling
|
||||
|
||||
## Static Files
|
||||
|
||||
These files are maintained in this directory:
|
||||
|
||||
- `manifest.json` - Extension metadata and configuration
|
||||
- `logo_black.png` - Extension icon
|
||||
- `requirements.txt` - Python package dependencies
|
||||
- `run_server.sh` - Shell script to launch the server
|
||||
- `setup.py` - Python script to install dependencies
|
||||
|
||||
## Generated Files
|
||||
|
||||
The `.mcpb` file is generated by the build script and is gitignored.
|
||||
|
||||
## Installing the Extension
|
||||
|
||||
Once built, you can install the extension in Claude Desktop by:
|
||||
|
||||
1. Opening Claude Desktop Settings
|
||||
2. Going to the Extensions section
|
||||
3. Dropping the `cua-extension.mcpb` file into the window
|
||||
4. Following the installation prompts
|
||||
|
||||
For more information, see the [Anthropic Desktop Extensions documentation](https://www.anthropic.com/engineering/desktop-extensions).
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user