diff --git a/.github/workflows/gemini-extension.yml b/.github/workflows/gemini-extension.yml new file mode 100644 index 0000000..b3833ed --- /dev/null +++ b/.github/workflows/gemini-extension.yml @@ -0,0 +1,64 @@ +# Checks the Gemini CLI extension manifest (gemini-extension.json). +# +# Gemini CLI installs the extension from the latest release's source tarball and +# expects the manifest version to match the release tag. Releases bump the +# version in Cargo.toml, so this fails any change where the two disagree. + +name: Gemini extension + +on: + push: + branches: + - master + paths: + - "gemini-extension.json" + - "GEMINI.md" + - "Cargo.toml" + - ".github/workflows/gemini-extension.yml" + pull_request: + branches: + - master + paths: + - "gemini-extension.json" + - "GEMINI.md" + - "Cargo.toml" + - ".github/workflows/gemini-extension.yml" + +permissions: + contents: read + +jobs: + check: + name: Check manifest + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + + - name: Check manifest + shell: bash + run: | + set -euo pipefail + manifest=gemini-extension.json + + jq -e . "$manifest" > /dev/null + + cargo_version="$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n1)" + manifest_version="$(jq -r '.version' "$manifest")" + if [[ "$manifest_version" != "$cargo_version" ]]; then + echo "::error file=$manifest::version is $manifest_version but Cargo.toml is $cargo_version. Bump both together." + exit 1 + fi + + context_file="$(jq -r '.contextFileName // "GEMINI.md"' "$manifest")" + if [[ ! -f "$context_file" ]]; then + echo "::error file=$manifest::contextFileName $context_file does not exist" + exit 1 + fi + + # Gemini only passes declared settings to the server, and an empty + # API_TOKEN would override ~/.screenly, so the token must be declared. + jq -e '.settings | any(.envVar == "API_TOKEN" and .sensitive == true)' "$manifest" > /dev/null \ + || { echo "::error file=$manifest::API_TOKEN must be declared as a sensitive setting"; exit 1; } + + echo "gemini-extension.json $manifest_version OK" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 115810a..18d57e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,8 +6,41 @@ on: - "v*" jobs: + check-version: + name: check-version + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + + # Gemini CLI compares gemini-extension.json's version with the release tag, + # so a stable tag must match it and Cargo.toml before anything is built. + # Prerelease tags (v1.2.3-rc1) are skipped: Gemini installs only the + # release marked Latest. + - name: Check tag matches Cargo.toml and gemini-extension.json + shell: bash + env: + TAG: ${{ github.ref_name }} + run: | + set -euo pipefail + if [[ "$TAG" == *-* ]]; then + echo "Prerelease tag $TAG; skipping version check" + exit 0 + fi + tag_version="${TAG#v}" + cargo_version="$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n1)" + manifest_version="$(jq -r '.version' gemini-extension.json)" + if [[ "$cargo_version" != "$tag_version" || "$manifest_version" != "$tag_version" ]]; then + echo "::error::Tag $TAG does not match Cargo.toml ($cargo_version) and gemini-extension.json ($manifest_version)" + exit 1 + fi + echo "Tag $TAG matches Cargo.toml and gemini-extension.json" + build-release: name: deploy + needs: check-version permissions: contents: write id-token: write diff --git a/GEMINI.md b/GEMINI.md new file mode 100644 index 0000000..7b62172 --- /dev/null +++ b/GEMINI.md @@ -0,0 +1,33 @@ +# Screenly + +The `screenly` MCP server manages a Screenly digital signage network: screens, +assets, asset groups, playlists, labels, shared playlists and Edge Apps. It runs +the official Screenly CLI (`screenly mcp`), which must be installed and on +`PATH`. See https://github.com/Screenly/cli#installation. + +## How content reaches a screen + +1. An **asset** is a piece of content: a web page, image or video + (`asset_create` takes a public URL). +2. A **playlist** holds assets as **playlist items**, each with a duration and + position. A playlist's **predicate** decides when it plays; the server's + instructions describe the predicate syntax. +3. **Labels** connect playlists to screens: link the same label to a playlist + (`label_link_playlist`) and to screens (`label_link_screen`). + +To put HTML (for example a dashboard you just wrote) on screens, use +`edge_app_publish_from_html`, not `asset_create`. + +## Working safely + +- Prefer list and get tools to look things up before changing anything, and + refer to objects by UUID. +- Confirm with the user before any `*_delete` tool. `asset_group_delete` also + deletes every asset in the group. +- Changes apply to live screens right away, so state what will change before + making updates to playlists, labels or assets that are already in use. + +## Authentication + +The server reads the `API_TOKEN` setting provided when this extension was +installed. To change it, run `gemini extensions config screenly`. diff --git a/README.md b/README.md index 8d52d42..dedd828 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,17 @@ Details: [`mcpb/README.md`](mcpb/README.md). The token is stored in your operating system's keychain rather than a plaintext config file. +#### Gemini CLI + +Install the Screenly CLI first (see [Installation](#installation)), then add the extension: + +```bash +$ gemini extensions install https://github.com/Screenly/cli +``` + +Gemini CLI asks for your API token during install and keeps it in your system keychain. +To change it later, run `gemini extensions config screenly`. + #### Cursor / other clients Add to your MCP configuration file: diff --git a/gemini-extension.json b/gemini-extension.json new file mode 100644 index 0000000..64ed840 --- /dev/null +++ b/gemini-extension.json @@ -0,0 +1,23 @@ +{ + "name": "screenly", + "version": "26.11.0", + "description": "Manage your Screenly digital signage network: screens, playlists, assets, labels and Edge Apps.", + "contextFileName": "GEMINI.md", + "mcpServers": { + "screenly": { + "command": "screenly", + "args": ["mcp"], + "env": { + "API_TOKEN": "${API_TOKEN}" + } + } + }, + "settings": [ + { + "name": "Screenly API Token", + "description": "API token for your Screenly team. Create one in your Screenly workspace under Settings > Security > API tokens.", + "envVar": "API_TOKEN", + "sensitive": true + } + ] +}