Skip to content

Open-source Revit MCP server: let Claude and other AI assistants read and edit BIM models, with human approval on every change.

Simplify README and standardize badges

A. Sam Mohammad7ec20afa8373
diff --git a/.github/workflows/download-metrics.yml b/.github/workflows/download-metrics.yml
deleted file mode 100644
index 83d3914..0000000
--- a/.github/workflows/download-metrics.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-name: Update Download Metrics
-
-on:
- schedule:
- - cron: "17 3 * * *"
- workflow_dispatch:
-
-permissions:
- contents: write
-
-concurrency:
- group: download-metrics
- cancel-in-progress: true
-
-jobs:
- update:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v5
-
- - name: Update release download metrics
- shell: pwsh
- env:
- GH_TOKEN: ${{ github.token }}
- run: ./scripts/update-download-metrics.ps1
-
- - name: Commit changed metrics
- shell: bash
- run: |
- if git diff --quiet; then
- echo "Download metrics are already current."
- exit 0
- fi
-
- git config user.name "github-actions[bot]"
- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- git add metrics/downloads.json assets/downloads-*.svg
- git commit -m "Update release download metrics [skip ci]"
- git push
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8050ba5..6c1a42d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+## Unreleased
+
+- Rewrite the README as a shorter product and installation guide.
+- Standardize public badges on the Shields.io `flat-square` style.
+- Remove the custom download dashboard and repository-owned metric assets.
+- Clarify installation for Revit 2024, 2025, 2026, and 2027.
+
## 1.0.2 - 2026-06-11
- Replace the external star-history chart with repository-owned release-download tracking.
diff --git a/README.md b/README.md
index 6be2aeb..ec71565 100644
--- a/README.md
+++ b/README.md
@@ -4,262 +4,199 @@
# AEC Model Bridge
-Independent Model Context Protocol integration for Autodesk Revit® software.
+MCP server and native add-in for AI-assisted Autodesk Revit workflows.
-[![Release downloads](assets/downloads-total.svg)](https://github.com/Sam-AEC/aec-model-bridge/releases)
-[![Latest release](https://img.shields.io/github/v/release/Sam-AEC/aec-model-bridge?style=flat-square)](https://github.com/Sam-AEC/aec-model-bridge/releases/latest)
-[![Build and test](https://github.com/Sam-AEC/aec-model-bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/Sam-AEC/aec-model-bridge/actions/workflows/ci.yml)
-[![Official MCP Registry](https://img.shields.io/badge/MCP_Registry-active-0F766E?style=flat-square)](https://registry.modelcontextprotocol.io/?q=io.github.Sam-AEC%2Faec-model-bridge)
-[![License: MIT](https://img.shields.io/badge/license-MIT-0078D4?style=flat-square)](LICENSE)
-[![Python 3.11+](https://img.shields.io/badge/Python-3.11+-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
-[![Revit 2024-2027](https://img.shields.io/badge/Revit-2024--2027-0696D7?style=flat-square)](https://www.autodesk.com/products/revit/)
+[![Release downloads](https://img.shields.io/github/downloads/Sam-AEC/aec-model-bridge/total?style=flat-square&logo=github&label=downloads&color=2563EB)](https://github.com/Sam-AEC/aec-model-bridge/releases)
+[![Latest release](https://img.shields.io/github/v/release/Sam-AEC/aec-model-bridge?style=flat-square&logo=github&color=2563EB)](https://github.com/Sam-AEC/aec-model-bridge/releases/latest)
+[![Build status](https://img.shields.io/github/actions/workflow/status/Sam-AEC/aec-model-bridge/ci.yml?branch=main&style=flat-square&logo=githubactions&label=build)](https://github.com/Sam-AEC/aec-model-bridge/actions/workflows/ci.yml)
+[![MCP Registry](https://img.shields.io/badge/MCP_Registry-active-0F766E?style=flat-square)](https://registry.modelcontextprotocol.io/?q=io.github.Sam-AEC%2Faec-model-bridge)
+[![License](https://img.shields.io/github/license/Sam-AEC/aec-model-bridge?style=flat-square&color=2563EB)](LICENSE)
+[![Python](https://img.shields.io/badge/Python-3.11+-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
+[![Revit](https://img.shields.io/badge/Revit-2024--2027-0696D7?style=flat-square)](https://www.autodesk.com/products/revit/)
-[Quick start](#quick-start) | [Tools](docs/tools.md) | [Architecture](docs/architecture.md) | [Security](docs/security.md) | [GitHub profile](https://github.com/Sam-AEC) | [LinkedIn](https://www.linkedin.com/in/a-sam-mohammad-92790416b)
+[Install](#installation) | [Tools](docs/tools.md) | [Documentation](#documentation) | [Latest release](https://github.com/Sam-AEC/aec-model-bridge/releases/latest)
</div>
-## What This Project Does
+AEC Model Bridge connects MCP clients such as Claude Desktop, VS Code, GitHub
+Copilot, and custom agents to a live Revit session.
-This repository connects MCP clients such as Claude Desktop, VS Code, and custom agents to Autodesk Revit.
+The Python server handles MCP communication. The C# add-in executes commands
+inside Revit through `ExternalEvent`, keeping API work on Revit's main thread.
-It has two runtime components:
+## Highlights
-- A Python MCP server that exposes tools to the AI client.
-- A C# Revit add-in that executes commands on Revit's main thread through `ExternalEvent`.
+- 100 MCP tools for model authoring, documentation, parameters, views, sheets,
+ exports, worksharing, architecture, structure, MEP, geometry, and QA.
+- Native Revit add-in with no pyRevit or Dynamo dependency.
+- Revit 2024, 2025, 2026, and 2027 support.
+- Reflection and in-process Python for advanced API workflows.
+- Localhost-only bridge by default.
+- Mock mode for development and automated testing without Revit.
-The bridge currently implements 103 active command routes across model authoring, documentation, parameters, views, sheets, exports, worksharing, MEP, structure, geometry, and model inspection.
+## How It Works
-## Download Activity
-
-The repository snapshots GitHub release-asset downloads every day and generates
-the badges and chart from [tracked metrics](metrics/downloads.json).
-
-<div align="center">
- <a href="metrics/downloads.json">
- <img src="assets/downloads-history.svg" alt="AEC Model Bridge GitHub release download history" width="920">
- </a>
-</div>
-
-Daily tracking started on June 11, 2026. The 7-day and 30-day badges show
-`tracking` until a complete baseline exists. GitHub does not provide historical
-per-day release-download data, so earlier daily totals cannot be reconstructed
-reliably. Counts exclude repository clones and GitHub-generated source archives.
+```text
+MCP client
+ |
+ | MCP over stdio
+ v
+Python MCP server
+ |
+ | HTTP on 127.0.0.1:3000
+ v
+AEC Model Bridge add-in
+ |
+ | ExternalEvent
+ v
+Revit API
+```
-## Why Use It
+## Installation
-- Direct Revit API execution without requiring pyRevit or Dynamo.
-- Localhost bridge with Revit-safe main-thread dispatch.
-- Typed tools for common BIM operations.
-- Reflection and in-process Python escape hatches for advanced workflows.
-- Mock mode for development and testing without Revit.
-- Version-specific builds for Revit 2024 through Revit 2027.
+### Requirements
-## Curated Tools and Broad API Access
+| Revit version | Add-in target | Required build tools |
+|---|---|---|
+| 2024 | .NET Framework 4.8 | .NET 8 SDK and .NET Framework 4.8 developer pack |
+| 2025 | .NET 8 for Windows | .NET 8 SDK |
+| 2026 | .NET 8 for Windows | .NET 8 SDK |
+| 2027 | .NET 10 for Windows | .NET 10 SDK |
-AEC Model Bridge provides two complementary access layers:
+You also need Windows 10 or 11, Python 3.11 or later, and a licensed Revit
+installation for the version you want to use.
-| Access layer | Purpose | Trade-off |
-|---|---|---|
-| 100 typed MCP tools backed by 103 active bridge routes | Predictable model authoring, queries, documentation, exports, worksharing, and QA | Easier for agents to discover, validate, audit, and call reliably |
-| `revit.invoke_method`, `revit.reflect_get`, and `revit.reflect_set` | Invoke public .NET methods and chain returned Revit objects without adding a dedicated route | Broad, but complex overloads and argument types are not always representable through JSON |
-| `revit.execute_python` | Run IronPython inside the Revit process with `doc`, `uidoc`, `uiapp`, `app`, and the Revit API assemblies available | Broadest access, but less predictable and equivalent to privileged local code execution |
+### 1. Install the MCP server
-The Python and reflection tools make a large part of the public Revit desktop
-API reachable even when no dedicated MCP route exists. They do not guarantee
-literal access to every API surface. Non-public APIs, unsupported IronPython
-interop, complex generic or overloaded signatures, and operations requiring a
-different Revit execution context can still require a compiled command.
+```powershell
+git clone https://github.com/Sam-AEC/aec-model-bridge.git
+cd aec-model-bridge
-The curated routes are therefore not the limit of the product. They are the
-reliable, typed layer for common work. The universal tools are an advanced
-fallback for operations that have not yet been formalized as stable routes.
+py -m venv .venv
+.\.venv\Scripts\Activate.ps1
+python -m pip install -e packages/mcp-server-revit
+```
-## Compatibility
+### 2. Install the Revit add-in
-| Revit | Add-in target | Status |
-|---|---|---|
-| 2024 | .NET Framework 4.8 | Supported |
-| 2025 | .NET 8 for Windows | Supported |
-| 2026 | .NET 8 for Windows | Supported |
-| 2027 | .NET 10 for Windows | Supported |
+Set the version to match your Revit installation:
-Revit 2027 support is compiled against the installed Autodesk Revit 2027 API assemblies.
+```powershell
+$RevitVersion = Read-Host "Revit year (2024, 2025, 2026, or 2027)"
-## Quick Start
+.\scripts\package.ps1 -RevitVersion $RevitVersion
+.\scripts\install.ps1 -RevitVersion $RevitVersion
+```
-### Prerequisites
+The installer places version-specific binaries in:
-- Windows 10 or 11
-- Autodesk Revit 2024-2027
-- Python 3.11 or later
-- The .NET SDK required by the selected Revit version
+```text
+C:\ProgramData\AECModelBridge\bin\<year>
+```
-### 1. Clone and install the MCP server
+The add-in manifest is installed per user in:
-```powershell
-git clone https://github.com/Sam-AEC/aec-model-bridge.git
-cd aec-model-bridge
-pip install -e packages/mcp-server-revit
+```text
+%APPDATA%\Autodesk\Revit\Addins\<year>
```
-### 2. Build, package, and install the Revit add-in
+Use `-AllUsers` with `install.ps1` to install the manifest under
+`C:\ProgramData\Autodesk\Revit\Addins\<year>` instead.
-For Revit 2027:
+To prepare binaries for every supported version in one pass:
```powershell
-.\scripts\build-addin.ps1 -RevitVersion 2027
-.\scripts\package.ps1 -RevitVersion 2027
-.\scripts\install.ps1 -RevitVersion 2027
+.\scripts\package.ps1 -RevitVersion All
```
-The installer places:
-
-- Version-specific binaries in `C:\ProgramData\AECModelBridge\bin\{year}`
-- The manifest in `%APPDATA%\Autodesk\Revit\Addins\2027`
-- Default configuration in `C:\ProgramData\AECModelBridge\config`
+Prebuilt packages are attached to GitHub releases when available. The source
+installation above is the canonical path for all supported Revit versions.
-Restart Revit after installing or replacing the add-in.
+### 3. Configure your MCP client
-### 3. Configure an MCP client
-
-Example Claude Desktop configuration:
+Use the Python executable from the virtual environment and choose a workspace
+that the server may access:
```json
{
"mcpServers": {
- "revit": {
- "command": "python",
+ "aec-model-bridge": {
+ "command": "C:\\path\\to\\aec-model-bridge\\.venv\\Scripts\\python.exe",
"args": ["-m", "revit_mcp_server.mcp_server"],
"env": {
+ "MCP_REVIT_MODE": "bridge",
"MCP_REVIT_BRIDGE_URL": "http://127.0.0.1:3000",
- "MCP_REVIT_MODE": "bridge"
+ "MCP_REVIT_WORKSPACE_DIR": "C:\\RevitProjects",
+ "MCP_REVIT_ALLOWED_DIRECTORIES": "C:\\RevitProjects"
}
}
}
}
```
-The repository also includes [`.vscode/mcp.json`](.vscode/mcp.json) for VS Code and GitHub Copilot.
+VS Code users can start from [`.vscode/mcp.json`](.vscode/mcp.json).
+
+Clients that support MCP Bundles can install the `.mcpb` file from the
+[latest release](https://github.com/Sam-AEC/aec-model-bridge/releases/latest).
+The Revit add-in is still required because the MCP server communicates with the
+running desktop application.
-### 4. Verify the bridge
+### 4. Verify the connection
-Start Revit, then run:
+Restart Revit after installing the add-in, open a model, and run:
```powershell
Invoke-RestMethod http://127.0.0.1:3000/health
```
-For Revit 2027, the response should include:
+The response should report `healthy` and the active Revit version.
-```json
-{
- "status": "healthy",
- "revit_version": "2027"
-}
-```
-
-## Architecture
-
-```text
-MCP client
- |
- | stdio / MCP
- v
-Python MCP server
- |
- | HTTP on 127.0.0.1:3000
- v
-C# Revit bridge add-in
- |
- | ExternalEvent on Revit main thread
- v
-Autodesk Revit API
-```
-
-The HTTP listener receives requests off the Revit UI thread. Commands are queued and executed through `ExternalEvent`, which is required for safe Revit API access.
-
-## Tool Coverage
-
-The active bridge command surface includes:
+## Revit API Access
-- Documents, levels, grids, walls, floors, roofs, rooms, and families
-- Parameters, project parameters, shared parameters, and batch updates
-- Views, view templates, sheets, title blocks, schedules, and annotations
-- Selection, transforms, groups, links, worksets, and synchronization
-- Structural columns, beams, foundations, ducts, pipes, and conduits
-- PDF, DWG, IFC, Navisworks, schedule, image, and rendering exports
-- Warnings, quantities, clashes, geometry, bounding boxes, and model queries
-- Reflection-based API calls and in-process Python execution
+The typed MCP tools cover the common workflow surface and are the recommended
+default for agents.
-See [docs/tools.md](docs/tools.md) for the tool reference.
+For work outside the tool catalog, `invoke_method`, `reflect_get`, and
+`reflect_set` can work with public .NET API members. `execute_python` runs
+IronPython inside Revit with `doc`, `uidoc`, `uiapp`, and `app` available.
-## Security
-
-The bridge listens on `127.0.0.1` by default. Do not expose port `3000` to a network without authentication and transport security.
-
-The `execute_python`, `invoke_method`, `reflect_get`, and `reflect_set` tools are privileged capabilities. They can modify the active model and execute broad API operations. Restrict them in shared or production environments and keep backups of important models.
-
-Do not expose these tools to untrusted MCP clients, users, prompts, or network
-connections. `execute_python` is intentionally not a sandbox.
-
-See [docs/security.md](docs/security.md) for the security model and [SECURITY.md](SECURITY.md) for vulnerability reporting.
-
-## Current Limitations
-
-- Some source directories are excluded from compilation while their APIs are stabilized.
-- Experimental command implementations are not advertised until they are active in the bridge.
-- Automated tests cover the Python server; full Revit integration testing still requires a licensed Windows/Revit environment.
+These advanced tools run with the same permissions as the Revit process. Keep
+the bridge on localhost and only use trusted MCP clients and prompts.
## Development
-Run the Python test suite:
-
```powershell
+# Python tests
python -m pytest packages/mcp-server-revit/tests
-```
-
-Build a specific Revit add-in:
-```powershell
-.\scripts\build-addin.ps1 -RevitVersion 2027 -Configuration Release
-```
-
-Package all supported versions:
+# Build one Revit version
+$RevitVersion = Read-Host "Revit year (2024, 2025, 2026, or 2027)"
+.\scripts\build-addin.ps1 -RevitVersion $RevitVersion -Configuration Release
-```powershell
+# Build all supported versions
.\scripts\package.ps1 -RevitVersion All
```
+CI builds the Python server and add-in targets for Revit 2024 through 2027.
+
## Documentation
-- [Installation](docs/install.md)
+- [Installation guide](docs/install.md)
- [Tool reference](docs/tools.md)
- [Architecture](docs/architecture.md)
- [Configuration reference](docs/configuration-reference.md)
-- [Build and install scripts](docs/build-and-install-scripts.md)
-- [Target frameworks and dependencies](docs/target-frameworks-and-dependencies.md)
-- [MCP marketplaces](docs/marketplaces.md)
+- [Security](docs/security.md)
+- [MCP clients and registry](docs/marketplaces.md)
- [Contributing](CONTRIBUTING.md)
-## License
-
-This repository is currently distributed under the [MIT License](LICENSE).
-
-## Maintainer
-
-AEC Model Bridge is maintained by
-[A. Sam Mohammad](https://github.com/Sam-AEC).
-Professional background and contact:
-[LinkedIn](https://www.linkedin.com/in/a-sam-mohammad-92790416b).
-
-## Trademark and Affiliation Notice
+## Project
-AEC Model Bridge is an independent project. It is not sponsored, endorsed, or
-provided by Autodesk.
+Maintained by [A. Sam Mohammad](https://github.com/Sam-AEC).
+[LinkedIn](https://www.linkedin.com/in/a-sam-mohammad-92790416b) |
+[Issues](https://github.com/Sam-AEC/aec-model-bridge/issues)
-Autodesk and Revit are trademarks of the Autodesk group of companies. Sam-AEC
-is not affiliated with Autodesk.
+Released under the [MIT License](LICENSE).
-The project uses the documented Revit desktop API and does not distribute
-Autodesk API assemblies, product icons, or other Autodesk software. Users must
-provide their own properly licensed installation. See [TRADEMARKS.md](TRADEMARKS.md).
+AEC Model Bridge is an independent project and is not sponsored, endorsed, or
+provided by Autodesk. Autodesk and Revit are trademarks of the Autodesk group
+of companies. See [TRADEMARKS.md](TRADEMARKS.md).
diff --git a/assets/downloads-30d.svg b/assets/downloads-30d.svg
deleted file mode 100644
index 7b93b8f..0000000
--- a/assets/downloads-30d.svg
+++ /dev/null
@@ -1,21 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="183" height="20" role="img" aria-label="downloads 30d: tracking">
- <title>downloads 30d: tracking</title>
- <linearGradient id="s" x2="0" y2="100%">
- <stop offset="0" stop-color="#fff" stop-opacity=".7"/>
- <stop offset=".1" stop-color="#aaa" stop-opacity=".1"/>
- <stop offset=".9" stop-color="#000" stop-opacity=".3"/>
- <stop offset="1" stop-color="#000" stop-opacity=".5"/>
- </linearGradient>
- <clipPath id="r"><rect width="183" height="20" rx="3" fill="#fff"/></clipPath>
- <g clip-path="url(#r)">
- <rect width="109" height="20" fill="#555"/>
- <rect x="109" width="74" height="20" fill="#7C3AED"/>
- <rect width="183" height="20" fill="url(#s)"/>
- </g>
- <g fill="#fff" text-anchor="middle" font-family="Verdana,DejaVu Sans,sans-serif" font-size="11">
- <text x="54" y="15" fill="#010101" fill-opacity=".3">downloads 30d</text>
- <text x="54" y="14">downloads 30d</text>
- <text x="146" y="15" fill="#010101" fill-opacity=".3">tracking</text>
- <text x="146" y="14">tracking</text>
- </g>
-</svg>
diff --git a/assets/downloads-7d.svg b/assets/downloads-7d.svg
deleted file mode 100644
index 97aa603..0000000
--- a/assets/downloads-7d.svg
+++ /dev/null
@@ -1,21 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="176" height="20" role="img" aria-label="downloads 7d: tracking">
- <title>downloads 7d: tracking</title>
- <linearGradient id="s" x2="0" y2="100%">
- <stop offset="0" stop-color="#fff" stop-opacity=".7"/>
- <stop offset=".1" stop-color="#aaa" stop-opacity=".1"/>
- <stop offset=".9" stop-color="#000" stop-opacity=".3"/>
- <stop offset="1" stop-color="#000" stop-opacity=".5"/>
- </linearGradient>
- <clipPath id="r"><rect width="176" height="20" rx="3" fill="#fff"/></clipPath>
- <g clip-path="url(#r)">
- <rect width="102" height="20" fill="#555"/>
- <rect x="102" width="74" height="20" fill="#0F766E"/>
- <rect width="176" height="20" fill="url(#s)"/>
- </g>
- <g fill="#fff" text-anchor="middle" font-family="Verdana,DejaVu Sans,sans-serif" font-size="11">
- <text x="51" y="15" fill="#010101" fill-opacity=".3">downloads 7d</text>
- <text x="51" y="14">downloads 7d</text>
- <text x="139" y="15" fill="#010101" fill-opacity=".3">tracking</text>
- <text x="139" y="14">tracking</text>
- </g>
-</svg>
diff --git a/assets/downloads-history.svg b/assets/downloads-history.svg
deleted file mode 100644
index e2faa53..0000000
--- a/assets/downloads-history.svg
+++ /dev/null
@@ -1,46 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="920" height="470" viewBox="0 0 920 470" role="img" aria-labelledby="title desc">
- <title id="title">AEC Model Bridge release download history</title>
- <desc id="desc">Current GitHub release downloads by release and cumulative daily history.</desc>
- <rect width="920" height="470" rx="14" fill="#0F172A"/>
- <text x="42" y="48" fill="#F8FAFC" font-family="Segoe UI,Arial,sans-serif" font-size="24" font-weight="600">GitHub release downloads</text>
- <text x="42" y="75" fill="#94A3B8" font-family="Segoe UI,Arial,sans-serif" font-size="13">Updated 2026-06-11 UTC. Source: GitHub release asset API.</text>
- <rect x="42" y="98" width="188" height="66" rx="8" fill="#1E293B" stroke="#334155"/>
- <text x="58" y="121" fill="#94A3B8" font-family="Segoe UI,Arial,sans-serif" font-size="11" font-weight="600">TOTAL</text>
- <text x="58" y="151" fill="#60A5FA" font-family="Segoe UI,Arial,sans-serif" font-size="24" font-weight="700">49</text>
- <rect x="258" y="98" width="188" height="66" rx="8" fill="#1E293B" stroke="#334155"/>
- <text x="274" y="121" fill="#94A3B8" font-family="Segoe UI,Arial,sans-serif" font-size="11" font-weight="600">LAST 7 DAYS</text>
- <text x="274" y="151" fill="#2DD4BF" font-family="Segoe UI,Arial,sans-serif" font-size="24" font-weight="700">tracking</text>
- <rect x="474" y="98" width="188" height="66" rx="8" fill="#1E293B" stroke="#334155"/>
- <text x="490" y="121" fill="#94A3B8" font-family="Segoe UI,Arial,sans-serif" font-size="11" font-weight="600">LAST 30 DAYS</text>
- <text x="490" y="151" fill="#C4B5FD" font-family="Segoe UI,Arial,sans-serif" font-size="24" font-weight="700">tracking</text>
- <rect x="690" y="98" width="188" height="66" rx="8" fill="#1E293B" stroke="#334155"/>
- <text x="706" y="121" fill="#94A3B8" font-family="Segoe UI,Arial,sans-serif" font-size="11" font-weight="600">LATEST RELEASE</text>
- <text x="706" y="151" fill="#FBBF24" font-family="Segoe UI,Arial,sans-serif" font-size="24" font-weight="700">0</text>
- <text x="42" y="188" fill="#E2E8F0" font-family="Segoe UI,Arial,sans-serif" font-size="14" font-weight="600">Downloads by release</text>
- <text x="46" y="204" fill="#CBD5E1" font-family="Segoe UI,Arial,sans-serif" font-size="12">v1.0.2</text>
- <rect x="46" y="210" width="360" height="10" rx="5" fill="#1E293B"/>
- <rect x="46" y="210" width="0" height="10" rx="5" fill="#3B82F6"/>
- <text x="416" y="219" fill="#F8FAFC" font-family="Segoe UI,Arial,sans-serif" font-size="12" font-weight="600">0</text>
- <text x="46" y="243" fill="#CBD5E1" font-family="Segoe UI,Arial,sans-serif" font-size="12">v1.0.1</text>
- <rect x="46" y="249" width="360" height="10" rx="5" fill="#1E293B"/>
- <rect x="46" y="249" width="8" height="10" rx="5" fill="#3B82F6"/>
- <text x="416" y="258" fill="#F8FAFC" font-family="Segoe UI,Arial,sans-serif" font-size="12" font-weight="600">1</text>
- <text x="46" y="282" fill="#CBD5E1" font-family="Segoe UI,Arial,sans-serif" font-size="12">v1.0.0</text>
- <rect x="46" y="288" width="360" height="10" rx="5" fill="#1E293B"/>
- <rect x="46" y="288" width="0" height="10" rx="5" fill="#3B82F6"/>
- <text x="416" y="297" fill="#F8FAFC" font-family="Segoe UI,Arial,sans-serif" font-size="12" font-weight="600">0</text>
- <text x="46" y="321" fill="#CBD5E1" font-family="Segoe UI,Arial,sans-serif" font-size="12">v0.1.1</text>
- <rect x="46" y="327" width="360" height="10" rx="5" fill="#1E293B"/>
- <rect x="46" y="327" width="360" height="10" rx="5" fill="#3B82F6"/>
- <text x="416" y="336" fill="#F8FAFC" font-family="Segoe UI,Arial,sans-serif" font-size="12" font-weight="600">48</text>
- <text x="46" y="360" fill="#CBD5E1" font-family="Segoe UI,Arial,sans-serif" font-size="12">v0.1.0</text>
- <rect x="46" y="366" width="360" height="10" rx="5" fill="#1E293B"/>
- <rect x="46" y="366" width="0" height="10" rx="5" fill="#3B82F6"/>
- <text x="416" y="375" fill="#F8FAFC" font-family="Segoe UI,Arial,sans-serif" font-size="12" font-weight="600">0</text>
- <text x="496" y="188" fill="#E2E8F0" font-family="Segoe UI,Arial,sans-serif" font-size="14" font-weight="600">Cumulative daily history</text>
- <rect x="500" y="190" width="374" height="205" rx="8" fill="#111C2F" stroke="#334155"/>
- <text x="687" y="274" text-anchor="middle" fill="#E2E8F0" font-family="Segoe UI,Arial,sans-serif" font-size="15" font-weight="600">Daily tracking has started</text>
- <text x="687" y="301" text-anchor="middle" fill="#94A3B8" font-family="Segoe UI,Arial,sans-serif" font-size="12">First snapshot: 11 Jun 2026</text>
- <text x="687" y="325" text-anchor="middle" fill="#94A3B8" font-family="Segoe UI,Arial,sans-serif" font-size="12">7-day and 30-day changes populate automatically.</text>
- <text x="42" y="441" fill="#64748B" font-family="Segoe UI,Arial,sans-serif" font-size="11">Counts include GitHub release assets only. Source archives and repository clones are not release downloads.</text>
-</svg>
diff --git a/assets/downloads-total.svg b/assets/downloads-total.svg
deleted file mode 100644
index cabcb2d..0000000
--- a/assets/downloads-total.svg
+++ /dev/null
@@ -1,21 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="185" height="20" role="img" aria-label="release downloads: 49">
- <title>release downloads: 49</title>
- <linearGradient id="s" x2="0" y2="100%">
- <stop offset="0" stop-color="#fff" stop-opacity=".7"/>
- <stop offset=".1" stop-color="#aaa" stop-opacity=".1"/>
- <stop offset=".9" stop-color="#000" stop-opacity=".3"/>
- <stop offset="1" stop-color="#000" stop-opacity=".5"/>
- </linearGradient>
- <clipPath id="r"><rect width="185" height="20" rx="3" fill="#fff"/></clipPath>
- <g clip-path="url(#r)">
- <rect width="137" height="20" fill="#555"/>
- <rect x="137" width="48" height="20" fill="#2563EB"/>
- <rect width="185" height="20" fill="url(#s)"/>
- </g>
- <g fill="#fff" text-anchor="middle" font-family="Verdana,DejaVu Sans,sans-serif" font-size="11">
- <text x="68" y="15" fill="#010101" fill-opacity=".3">release downloads</text>
- <text x="68" y="14">release downloads</text>
- <text x="161" y="15" fill="#010101" fill-opacity=".3">49</text>
- <text x="161" y="14">49</text>
- </g>
-</svg>
diff --git a/docs/install.md b/docs/install.md
index e21aed8..b25fd6b 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -1,140 +1,108 @@
-# Installation Guide
+# Installation
-This guide covers installation for both mock mode (no Revit required) and bridge mode (Windows with Revit).
+AEC Model Bridge has two components:
-## Prerequisites
+1. A Python MCP server used by the AI client.
+2. A native add-in loaded by Revit.
-### Mock Mode
-- Python 3.11 or later
-- pip package manager
-- Git
+Both are required for live Revit automation. Mock mode only requires the Python
+server.
-### Bridge Mode (Additional)
-- Windows 10/11
-- Autodesk Revit 2024-2027
-- .NET Framework 4.8 developer tools for Revit 2024
-- .NET 8 SDK for Revit 2025-2026
-- .NET 10 SDK for Revit 2027
-- Visual Studio 2022 Build Tools or the matching .NET SDK
+## Requirements
-## Mock Mode Setup
+| Revit version | Add-in target | Build requirement |
+|---|---|---|
+| 2024 | .NET Framework 4.8 | .NET 8 SDK and .NET Framework 4.8 developer pack |
+| 2025 | .NET 8 for Windows | .NET 8 SDK |
+| 2026 | .NET 8 for Windows | .NET 8 SDK |
+| 2027 | .NET 10 for Windows | .NET 10 SDK |
-Mock mode runs the complete MCP server with deterministic responses, suitable for CI, testing, and development without Revit.
+General requirements:
-### 1. Clone Repository
+- Windows 10 or 11
+- Python 3.11 or later
+- Git
+- A licensed Revit installation for live bridge mode
-```bash
+## Install From Source
+
+Clone the repository and create a virtual environment:
+
+```powershell
git clone https://github.com/Sam-AEC/aec-model-bridge.git
cd aec-model-bridge
-```
-
-### 2. Create Virtual Environment
-```bash
-python -m venv venv
+py -m venv .venv
+.\.venv\Scripts\Activate.ps1
+python -m pip install -e packages/mcp-server-revit
```
-Activate the environment:
-- Windows: `venv\Scripts\activate`
-- Linux/Mac: `source venv/bin/activate`
-
-### 3. Install Python Package
+Choose the Revit version installed on your machine:
-```bash
-pip install -e packages/mcp-server-revit[dev]
+```powershell
+$RevitVersion = Read-Host "Revit year (2024, 2025, 2026, or 2027)"
```
-This installs the MCP server with development dependencies (ruff, mypy, pytest).
-
-### 4. Configure Environment
-
-Set required environment variables:
+Build, package, and install the matching add-in:
```powershell
-# PowerShell (Windows)
-$env:MCP_REVIT_MODE = "mock"
-$env:MCP_REVIT_WORKSPACE_DIR = "C:\revit-workspace"
-$env:MCP_REVIT_ALLOWED_DIRECTORIES = "C:\revit-workspace;C:\temp"
-```
-
-```bash
-# Bash (Linux/Mac)
-export MCP_REVIT_MODE="mock"
-export MCP_REVIT_WORKSPACE_DIR="/home/user/revit-workspace"
-export MCP_REVIT_ALLOWED_DIRECTORIES="/home/user/revit-workspace;/tmp"
+.\scripts\package.ps1 -RevitVersion $RevitVersion
+.\scripts\install.ps1 -RevitVersion $RevitVersion
```
-### 5. Verify Installation
-
-```bash
-python -m pytest packages/mcp-server-revit/tests
-```
+The default installation is per user:
-All tests should pass.
+```text
+Add-in manifest:
+%APPDATA%\Autodesk\Revit\Addins\<year>\AECModelBridge.addin
-### 6. Run Mock Server
+Version-specific binaries:
+C:\ProgramData\AECModelBridge\bin\<year>\
-```bash
-python -m revit_mcp_server
+Configuration:
+C:\ProgramData\AECModelBridge\config\default.json
```
-The server listens on stdin/stdout for MCP protocol messages.
-
-## Bridge Mode Setup
-
-Bridge mode connects the MCP server to a running Revit instance via the .NET add-in.
-
-### 1. Complete Mock Mode Setup
-
-Follow steps 1-3 from Mock Mode Setup.
-
-### 2. Build Bridge Add-in
+For an all-user manifest installation:
```powershell
-.\scripts\build-addin.ps1 -RevitVersion 2027
+.\scripts\install.ps1 -RevitVersion $RevitVersion -AllUsers
```
-This compiles [RevitBridge.csproj](../packages/revit-bridge-addin/RevitBridge.csproj) to a DLL.
-
-Expected output: `packages/revit-bridge-addin/bin/Release/{year}/{framework}/AECModelBridge.dll`
-
-### 3. Package and Install the Add-in
+To package every supported Revit version:
```powershell
-.\scripts\package.ps1 -RevitVersion 2027
-.\scripts\install.ps1 -RevitVersion 2027
+.\scripts\package.ps1 -RevitVersion All
```
-By default, the installer copies [AECModelBridge.addin](../packages/revit-bridge-addin/AECModelBridge.addin)
-to `%APPDATA%\Autodesk\Revit\Addins\2027\`. Use `-AllUsers` to install
-the manifest under `%ProgramData%`.
-
-### 4. Launch Revit
+You can then run `install.ps1` once for each installed Revit year.
-Start Revit. The add-in loads automatically and starts the HTTP bridge on `http://127.0.0.1:3000/`.
+## Install From a Release
-Verify in Revit:
-- Check the `AEC Bridge` ribbon tab.
-- Use `Status` to inspect the local bridge.
+Download a package matching your Revit version from
+[GitHub Releases](https://github.com/Sam-AEC/aec-model-bridge/releases).
-### 5. Configure MCP Server for Bridge Mode
-
-Update environment:
+Extract the archive, check the available folders under `bin`, and install the
+matching year:
```powershell
-$env:MCP_REVIT_MODE = "bridge"
-$env:MCP_REVIT_BRIDGE_URL = "http://127.0.0.1:3000"
-$env:MCP_REVIT_WORKSPACE_DIR = "C:\RevitProjects"
-$env:MCP_REVIT_ALLOWED_DIRECTORIES = "C:\RevitProjects"
+Get-ChildItem .\bin -Directory
+$RevitVersion = Read-Host "Choose one of the listed Revit years"
+.\install.ps1 -RevitVersion $RevitVersion
```
-Or use the workspace MCP configuration in [.vscode/mcp.json](../.vscode/mcp.json) for VS Code and GitHub Copilot, and set the same environment variables in your shell for other clients:
+If a prebuilt package is not available for your year, use the source
+installation above.
+
+## Configure an MCP Client
+
+The server requires a bridge URL and an allowed workspace:
```json
{
- "servers": {
- "revit": {
- "command": "python",
+ "mcpServers": {
+ "aec-model-bridge": {
+ "command": "C:\\path\\to\\aec-model-bridge\\.venv\\Scripts\\python.exe",
"args": ["-m", "revit_mcp_server.mcp_server"],
"env": {
"MCP_REVIT_MODE": "bridge",
@@ -147,79 +115,74 @@ Or use the workspace MCP configuration in [.vscode/mcp.json](../.vscode/mcp.json
}
```
-### 6. Run Bridge Server
+The allowed directories value accepts multiple paths separated by semicolons.
-```bash
-python -m revit_mcp_server
-```
+VS Code users can start from [`.vscode/mcp.json`](../.vscode/mcp.json).
-## Configuration Reference
+Clients with MCP Bundle support can install the `.mcpb` asset from the latest
+release. The Revit add-in must still be installed separately.
-### Environment Variables
+## Verify the Bridge
-| Variable | Required | Default | Description |
-|----------|----------|---------|-------------|
-| `MCP_REVIT_MODE` | Yes | - | `mock` or `bridge` |
-| `MCP_REVIT_WORKSPACE_DIR` | Yes | - | Root directory for file operations |
-| `MCP_REVIT_ALLOWED_DIRECTORIES` | Yes | - | Semicolon-separated list of allowed paths |
-| `MCP_REVIT_BRIDGE_URL` | Bridge only | `http://127.0.0.1:3000` | Bridge HTTP endpoint |
-| `MCP_REVIT_AUDIT_LOG` | No | `workspace/audit.jsonl` | Audit log file path |
-| `REVIT_SDK` | Build only | - | Path to Revit SDK for building add-in |
+Restart Revit after installing or replacing the add-in. Open a model and run:
-## Troubleshooting
+```powershell
+Invoke-RestMethod http://127.0.0.1:3000/health
+```
-### Issue: Workspace Violation Error
+The response should include:
-**Error**: `WorkspaceViolation: Path outside allowed directories`
+```json
+{
+ "status": "healthy",
+ "revit_version": "<running Revit year>"
+}
+```
-**Fix**:
-1. Verify `MCP_REVIT_WORKSPACE_DIR` and `MCP_REVIT_ALLOWED_DIRECTORIES` are set
-2. Ensure paths use absolute paths (not relative)
-3. On Windows, use double backslashes or forward slashes: `C:\\workspace` or `C:/workspace`
-4. Check directory exists and has read/write permissions
+The reported year will match the running Revit version.
-### Issue: Schema Validation Failed
+## Mock Mode
-**Error**: `SchemaValidationError: Field 'document_path' is required`
+Mock mode runs the MCP server without Revit:
-**Fix**:
-1. Check tool input matches schema in [docs/tools.md](tools.md)
-2. Review error message for missing/invalid fields
-3. Run tests to see valid examples: `pytest packages/mcp-server-revit/tests/test_tools.py -v`
+```powershell
+$env:MCP_REVIT_MODE = "mock"
+$env:MCP_REVIT_WORKSPACE_DIR = "C:\revit-workspace"
+$env:MCP_REVIT_ALLOWED_DIRECTORIES = "C:\revit-workspace"
-### Issue: Bridge Connection Refused
+python -m revit_mcp_server
+```
-**Error**: `BridgeError: Connection refused to http://127.0.0.1:3000`
+Run the automated tests with:
-**Fix**:
-1. Verify Revit is running with the add-in loaded
-2. Check the add-in manifest under `%APPDATA%\Autodesk\Revit\Addins\{year}\AECModelBridge.addin` or the all-user `%ProgramData%` path
-3. Verify DLL path in manifest points to the built DLL
-4. Check Windows Firewall isn't blocking `127.0.0.1:3000`
-5. Review Revit Journal file for add-in load errors
+```powershell
+python -m pytest packages/mcp-server-revit/tests
+```
-### Issue: Add-in Build Failed
+## Troubleshooting
-**Error**: `MSBuild error: RevitAPI reference not found`
+### Bridge connection refused
-**Fix**:
-1. Set `REVIT_SDK` environment variable to correct SDK path
-2. Verify Revit SDK is installed (comes with Revit or download separately)
-3. Check [RevitBridge.csproj](../packages/revit-bridge-addin/RevitBridge.csproj) references match your Revit version
-4. Ensure Visual Studio or MSBuild tools are installed
+- Confirm Revit is running.
+- Confirm the `AEC Bridge` ribbon tab is present.
+- Check that the manifest year matches the running Revit year.
+- Check the bridge log at `%APPDATA%\AECModelBridge\Logs\bridge.jsonl`.
+- Confirm no other process is using port `3000`.
-### Issue: Mock Mode Files Not Created
+### Add-in build fails
-**Error**: Export tools don't create output files in mock mode
+- Run `dotnet --list-sdks` and confirm the required SDK is installed.
+- For Revit 2024, install the .NET Framework 4.8 developer pack.
+- Confirm the selected `-RevitVersion` is one of `2024`, `2025`, `2026`, or
+ `2027`.
+- If Revit is not installed on the build machine, the project uses matching
+ Revit API reference packages for compilation.
-**Fix**:
-1. Verify `MCP_REVIT_WORKSPACE_DIR` exists and is writable
-2. Check `MCP_REVIT_MODE=mock` is set
-3. Review audit log for errors: `cat workspace/audit.jsonl`
-4. Ensure no file permission issues in workspace directory
+### Workspace access denied
-## Next Steps
+- Use absolute paths for `MCP_REVIT_WORKSPACE_DIR`.
+- Include every required directory in `MCP_REVIT_ALLOWED_DIRECTORIES`.
+- Separate multiple Windows paths with semicolons.
-- Review [tool catalog](tools.md) for available operations
-- Understand [architecture](architecture.md) and trust boundaries
-- Read [security model](security.md) for production deployments
+See the [configuration reference](configuration-reference.md) and
+[security guide](security.md) for advanced settings.
diff --git a/metrics/downloads.json b/metrics/downloads.json
deleted file mode 100644
index 4b78d69..0000000
--- a/metrics/downloads.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "schema_version": 1,
- "repository": "Sam-AEC/aec-model-bridge",
- "updated_at": "2026-06-11T06:57:30.7704111+00:00",
- "totals": {
- "all_releases": 49,
- "latest_release": 0,
- "last_7_days": null,
- "last_30_days": null
- },
- "releases": [
- {
- "tag": "v1.0.2",
- "published_at": "2026-06-11T06:55:57.0000000+00:00",
- "prerelease": false,
- "downloads": 0
- },
- {
- "tag": "v1.0.1",
- "published_at": "2026-06-10T23:05:58.0000000+00:00",
- "prerelease": false,
- "downloads": 1
- },
- {
- "tag": "v1.0.0",
- "published_at": "2026-05-27T07:47:54.0000000+00:00",
- "prerelease": false,
- "downloads": 0
- },
- {
- "tag": "v0.1.1",
- "published_at": "2026-04-23T18:11:39.0000000+00:00",
- "prerelease": false,
- "downloads": 48
- },
- {
- "tag": "v0.1.0",
- "published_at": "2026-01-07T16:32:53.0000000+00:00",
- "prerelease": true,
- "downloads": 0
- }
- ],
- "history": [
- {
- "date": "2026-06-11",
- "total": 49
- }
- ]
-}
diff --git a/packages/mcp-server-revit/manifest.json b/packages/mcp-server-revit/manifest.json
index a05c473..30dc571 100644
--- a/packages/mcp-server-revit/manifest.json
+++ b/packages/mcp-server-revit/manifest.json
@@ -14,7 +14,7 @@
"url": "https://github.com/Sam-AEC/aec-model-bridge.git"
},
"homepage": "https://github.com/Sam-AEC/aec-model-bridge",
- "documentation": "https://github.com/Sam-AEC/aec-model-bridge#quick-start",
+ "documentation": "https://github.com/Sam-AEC/aec-model-bridge#installation",
"support": "https://github.com/Sam-AEC/aec-model-bridge/issues",
"server": {
"type": "uv",
diff --git a/scripts/package.ps1 b/scripts/package.ps1
index d797183..855cd6e 100644
--- a/scripts/package.ps1
+++ b/scripts/package.ps1
@@ -139,20 +139,27 @@ This package contains AEC Model Bridge for Revit software and its MCP server.
## Installation
-### Quick Install (Revit 2027)
+This archive contains these Revit binaries:
+
+``````
+bin\$($versionsToBuild -join "`nbin\")
+``````
+
+Check the available version folders and install the one matching Revit:
+
``````powershell
-.\install.ps1 -RevitVersion 2027
+Get-ChildItem .\bin -Directory
+$RevitVersion = Read-Host "Choose one of the listed Revit years"
+.\install.ps1 -RevitVersion $RevitVersion
``````
-### Manual Install
-Use ``install.ps1`` so the add-in manifest receives the correct absolute,
-version-specific assembly path. Binaries are installed under
-``C:\ProgramData\AECModelBridge\bin\{year}\``.
+The installer writes binaries to
+``C:\ProgramData\AECModelBridge\bin\{year}\`` and creates the matching manifest.
## Verify Installation
1. Start Revit
2. In PowerShell: ``curl http://127.0.0.1:3000/health``
-3. Should return: ``{"status":"healthy","revit_version":"2027",...}``
+3. The response should report ``healthy`` and the running Revit version.
## Run MCP Server
``````powershell
diff --git a/scripts/update-download-metrics.ps1 b/scripts/update-download-metrics.ps1
deleted file mode 100644
index b7e9be8..0000000
--- a/scripts/update-download-metrics.ps1
+++ /dev/null
@@ -1,281 +0,0 @@
-param(
- [string]$Repository = $(if ($env:GITHUB_REPOSITORY) { $env:GITHUB_REPOSITORY } else { "Sam-AEC/aec-model-bridge" }),
- [string]$Token = $(if ($env:GH_TOKEN) { $env:GH_TOKEN } else { $env:GITHUB_TOKEN }),
- [string]$MetricsPath = "metrics/downloads.json",
- [string]$ChartPath = "assets/downloads-history.svg",
- [string]$BadgeDirectory = "assets"
-)
-
-$ErrorActionPreference = "Stop"
-
-function ConvertTo-XmlText {
- param([AllowNull()][object]$Value)
-
- if ($null -eq $Value) {
- return ""
- }
-
- return [System.Security.SecurityElement]::Escape([string]$Value)
-}
-
-function Write-Utf8NoBom {
- param(
- [string]$Path,
- [string]$Content
- )
-
- $directory = Split-Path -Parent $Path
- if ($directory) {
- New-Item -ItemType Directory -Path $directory -Force | Out-Null
- }
-
- [System.IO.File]::WriteAllText(
- [System.IO.Path]::GetFullPath($Path),
- $Content,
- [System.Text.UTF8Encoding]::new($false)
- )
-}
-
-function Write-Badge {
- param(
- [string]$Path,
- [string]$Label,
- [string]$Message,
- [string]$Color
- )
-
- $labelWidth = [Math]::Max(92, ($Label.Length * 7) + 18)
- $messageWidth = [Math]::Max(48, ($Message.Length * 7) + 18)
- $width = $labelWidth + $messageWidth
- $labelX = [Math]::Round($labelWidth / 2)
- $messageX = $labelWidth + [Math]::Round($messageWidth / 2)
- $labelText = ConvertTo-XmlText $Label
- $messageText = ConvertTo-XmlText $Message
-
- $svg = @"
-<svg xmlns="http://www.w3.org/2000/svg" width="$width" height="20" role="img" aria-label="${labelText}: ${messageText}">
- <title>${labelText}: ${messageText}</title>
- <linearGradient id="s" x2="0" y2="100%">
- <stop offset="0" stop-color="#fff" stop-opacity=".7"/>
- <stop offset=".1" stop-color="#aaa" stop-opacity=".1"/>
- <stop offset=".9" stop-color="#000" stop-opacity=".3"/>
- <stop offset="1" stop-color="#000" stop-opacity=".5"/>
- </linearGradient>
- <clipPath id="r"><rect width="$width" height="20" rx="3" fill="#fff"/></clipPath>
- <g clip-path="url(#r)">
- <rect width="$labelWidth" height="20" fill="#555"/>
- <rect x="$labelWidth" width="$messageWidth" height="20" fill="$Color"/>
- <rect width="$width" height="20" fill="url(#s)"/>
- </g>
- <g fill="#fff" text-anchor="middle" font-family="Verdana,DejaVu Sans,sans-serif" font-size="11">
- <text x="$labelX" y="15" fill="#010101" fill-opacity=".3">${labelText}</text>
- <text x="$labelX" y="14">${labelText}</text>
- <text x="$messageX" y="15" fill="#010101" fill-opacity=".3">${messageText}</text>
- <text x="$messageX" y="14">${messageText}</text>
- </g>
-</svg>
-"@
-
- Write-Utf8NoBom -Path $Path -Content ($svg.Trim() + [Environment]::NewLine)
-}
-
-$headers = @{
- Accept = "application/vnd.github+json"
- "User-Agent" = "aec-model-bridge-download-metrics"
- "X-GitHub-Api-Version" = "2022-11-28"
-}
-if ($Token) {
- $headers.Authorization = "Bearer $Token"
-}
-
-$releases = @()
-$page = 1
-do {
- $uri = "https://api.github.com/repos/$Repository/releases?per_page=100&page=$page"
- $response = Invoke-RestMethod -Uri $uri -Headers $headers -Method Get
- if ($null -eq $response) {
- $response = @()
- }
- $releases += $response
- $page++
-} while ($response.Count -eq 100)
-
-$publishedReleases = @(
- $releases |
- Where-Object { -not $_.draft } |
- Sort-Object { [DateTimeOffset]$_.published_at } -Descending
-)
-
-$releaseMetrics = @(
- foreach ($release in $publishedReleases) {
- $downloads = [int](($release.assets | Measure-Object -Property download_count -Sum).Sum)
- [pscustomobject][ordered]@{
- tag = [string]$release.tag_name
- published_at = ([DateTimeOffset]$release.published_at).ToUniversalTime().ToString("o")
- prerelease = [bool]$release.prerelease
- downloads = $downloads
- }
- }
-)
-
-$totalDownloads = [int](($releaseMetrics | Measure-Object -Property downloads -Sum).Sum)
-$snapshotDate = [DateTimeOffset]::UtcNow.Date
-$today = $snapshotDate.ToString("yyyy-MM-dd")
-$history = @()
-
-if (Test-Path -LiteralPath $MetricsPath) {
- $existing = Get-Content -LiteralPath $MetricsPath -Raw | ConvertFrom-Json
- if ($existing.history) {
- $history = @(
- $existing.history |
- Where-Object { $_.date -ne $today } |
- ForEach-Object {
- [pscustomobject][ordered]@{
- date = [string]$_.date
- total = [int]$_.total
- }
- }
- )
- }
-}
-
-$history += [pscustomobject][ordered]@{
- date = $today
- total = $totalDownloads
-}
-$history = @(
- $history |
- Sort-Object { [DateTime]$_.date } |
- Select-Object -Last 180
-)
-
-function Get-DownloadDelta {
- param([int]$Days)
-
- $targetDate = $snapshotDate.AddDays(-$Days)
- $baseline = $history |
- Where-Object { [DateTimeOffset]::Parse($_.date) -le $targetDate } |
- Select-Object -Last 1
-
- if ($null -eq $baseline) {
- return $null
- }
-
- return [int]($totalDownloads - [int]$baseline.total)
-}
-
-$delta7 = Get-DownloadDelta -Days 7
-$delta30 = Get-DownloadDelta -Days 30
-$latestRelease = $releaseMetrics | Where-Object { -not $_.prerelease } | Select-Object -First 1
-$latestDownloads = if ($latestRelease) { [int]$latestRelease.downloads } else { 0 }
-
-$metrics = [ordered]@{
- schema_version = 1
- repository = $Repository
- updated_at = [DateTimeOffset]::UtcNow.ToString("o")
- totals = [ordered]@{
- all_releases = $totalDownloads
- latest_release = $latestDownloads
- last_7_days = $delta7
- last_30_days = $delta30
- }
- releases = $releaseMetrics
- history = $history
-}
-
-$metricsJson = ($metrics | ConvertTo-Json -Depth 10) + [Environment]::NewLine
-Write-Utf8NoBom -Path $MetricsPath -Content $metricsJson
-
-$delta7Label = if ($null -eq $delta7) { "tracking" } else { "+$delta7" }
-$delta30Label = if ($null -eq $delta30) { "tracking" } else { "+$delta30" }
-Write-Badge -Path (Join-Path $BadgeDirectory "downloads-total.svg") -Label "release downloads" -Message ([string]$totalDownloads) -Color "#2563EB"
-Write-Badge -Path (Join-Path $BadgeDirectory "downloads-7d.svg") -Label "downloads 7d" -Message $delta7Label -Color "#0F766E"
-Write-Badge -Path (Join-Path $BadgeDirectory "downloads-30d.svg") -Label "downloads 30d" -Message $delta30Label -Color "#7C3AED"
-
-$chartWidth = 920
-$chartHeight = 470
-$releaseChartX = 46
-$releaseChartY = 190
-$releaseChartWidth = 360
-$trendChartX = 500
-$trendChartY = 190
-$trendChartWidth = 374
-$chartPlotHeight = 205
-$topReleases = @($releaseMetrics | Select-Object -First 5)
-$maxReleaseDownloads = [Math]::Max(1, [int](($topReleases | Measure-Object -Property downloads -Maximum).Maximum))
-$svgLines = [System.Collections.Generic.List[string]]::new()
-$svgLines.Add('<svg xmlns="http://www.w3.org/2000/svg" width="920" height="470" viewBox="0 0 920 470" role="img" aria-labelledby="title desc">')
-$svgLines.Add(' <title id="title">AEC Model Bridge release download history</title>')
-$svgLines.Add(' <desc id="desc">Current GitHub release downloads by release and cumulative daily history.</desc>')
-$svgLines.Add(' <rect width="920" height="470" rx="14" fill="#0F172A"/>')
-$svgLines.Add(' <text x="42" y="48" fill="#F8FAFC" font-family="Segoe UI,Arial,sans-serif" font-size="24" font-weight="600">GitHub release downloads</text>')
-$svgLines.Add(" <text x=`"42`" y=`"75`" fill=`"#94A3B8`" font-family=`"Segoe UI,Arial,sans-serif`" font-size=`"13`">Updated $(ConvertTo-XmlText $today) UTC. Source: GitHub release asset API.</text>")
-
-$cards = @(
- @{ X = 42; Label = "TOTAL"; Value = [string]$totalDownloads; Color = "#60A5FA" },
- @{ X = 258; Label = "LAST 7 DAYS"; Value = $delta7Label; Color = "#2DD4BF" },
- @{ X = 474; Label = "LAST 30 DAYS"; Value = $delta30Label; Color = "#C4B5FD" },
- @{ X = 690; Label = "LATEST RELEASE"; Value = [string]$latestDownloads; Color = "#FBBF24" }
-)
-foreach ($card in $cards) {
- $svgLines.Add(" <rect x=`"$($card.X)`" y=`"98`" width=`"188`" height=`"66`" rx=`"8`" fill=`"#1E293B`" stroke=`"#334155`"/>")
- $svgLines.Add(" <text x=`"$($card.X + 16)`" y=`"121`" fill=`"#94A3B8`" font-family=`"Segoe UI,Arial,sans-serif`" font-size=`"11`" font-weight=`"600`">$($card.Label)</text>")
- $svgLines.Add(" <text x=`"$($card.X + 16)`" y=`"151`" fill=`"$($card.Color)`" font-family=`"Segoe UI,Arial,sans-serif`" font-size=`"24`" font-weight=`"700`">$($card.Value)</text>")
-}
-
-$svgLines.Add(' <text x="42" y="188" fill="#E2E8F0" font-family="Segoe UI,Arial,sans-serif" font-size="14" font-weight="600">Downloads by release</text>')
-if ($topReleases.Count -eq 0) {
- $svgLines.Add(' <text x="46" y="225" fill="#94A3B8" font-family="Segoe UI,Arial,sans-serif" font-size="13">No published releases found.</text>')
-}
-else {
- for ($i = 0; $i -lt $topReleases.Count; $i++) {
- $release = $topReleases[$i]
- $y = $releaseChartY + ($i * 39)
- $barWidth = [Math]::Round(($release.downloads / $maxReleaseDownloads) * $releaseChartWidth)
- if ($release.downloads -gt 0) {
- $barWidth = [Math]::Max(4, $barWidth)
- }
- $tag = ConvertTo-XmlText $release.tag
- $svgLines.Add(" <text x=`"$releaseChartX`" y=`"$($y + 14)`" fill=`"#CBD5E1`" font-family=`"Segoe UI,Arial,sans-serif`" font-size=`"12`">$tag</text>")
- $svgLines.Add(" <rect x=`"$releaseChartX`" y=`"$($y + 20)`" width=`"$releaseChartWidth`" height=`"10`" rx=`"5`" fill=`"#1E293B`"/>")
- $svgLines.Add(" <rect x=`"$releaseChartX`" y=`"$($y + 20)`" width=`"$barWidth`" height=`"10`" rx=`"5`" fill=`"#3B82F6`"/>")
- $svgLines.Add(" <text x=`"$($releaseChartX + $releaseChartWidth + 10)`" y=`"$($y + 29)`" fill=`"#F8FAFC`" font-family=`"Segoe UI,Arial,sans-serif`" font-size=`"12`" font-weight=`"600`">$($release.downloads)</text>")
- }
-}
-
-$svgLines.Add(' <text x="496" y="188" fill="#E2E8F0" font-family="Segoe UI,Arial,sans-serif" font-size="14" font-weight="600">Cumulative daily history</text>')
-$svgLines.Add(" <rect x=`"$trendChartX`" y=`"$trendChartY`" width=`"$trendChartWidth`" height=`"$chartPlotHeight`" rx=`"8`" fill=`"#111C2F`" stroke=`"#334155`"/>")
-if ($history.Count -lt 2) {
- $trackingDate = [DateTime]::Parse($history[0].date).ToString("d MMM yyyy")
- $svgLines.Add(' <text x="687" y="274" text-anchor="middle" fill="#E2E8F0" font-family="Segoe UI,Arial,sans-serif" font-size="15" font-weight="600">Daily tracking has started</text>')
- $svgLines.Add(" <text x=`"687`" y=`"301`" text-anchor=`"middle`" fill=`"#94A3B8`" font-family=`"Segoe UI,Arial,sans-serif`" font-size=`"12`">First snapshot: $(ConvertTo-XmlText $trackingDate)</text>")
- $svgLines.Add(' <text x="687" y="325" text-anchor="middle" fill="#94A3B8" font-family="Segoe UI,Arial,sans-serif" font-size="12">7-day and 30-day changes populate automatically.</text>')
-}
-else {
- $historyValues = @($history | ForEach-Object { [int]$_.total })
- $minValue = [int](($historyValues | Measure-Object -Minimum).Minimum)
- $maxValue = [int](($historyValues | Measure-Object -Maximum).Maximum)
- if ($maxValue -eq $minValue) {
- $maxValue = $minValue + 1
- }
-
- $points = @()
- for ($i = 0; $i -lt $history.Count; $i++) {
- $x = $trendChartX + 12 + (($i / ($history.Count - 1)) * ($trendChartWidth - 24))
- $normalized = ([int]$history[$i].total - $minValue) / ($maxValue - $minValue)
- $y = $trendChartY + $chartPlotHeight - 16 - ($normalized * ($chartPlotHeight - 32))
- $points += "$([Math]::Round($x, 1)),$([Math]::Round($y, 1))"
- }
- $svgLines.Add(" <polyline points=`"$($points -join ' ')`" fill=`"none`" stroke=`"#2DD4BF`" stroke-width=`"3`" stroke-linecap=`"round`" stroke-linejoin=`"round`"/>")
- $svgLines.Add(" <text x=`"$($trendChartX + 12)`" y=`"$($trendChartY + $chartPlotHeight - 4)`" fill=`"#64748B`" font-family=`"Segoe UI,Arial,sans-serif`" font-size=`"10`">$(ConvertTo-XmlText $history[0].date)</text>")
- $svgLines.Add(" <text x=`"$($trendChartX + $trendChartWidth - 12)`" y=`"$($trendChartY + $chartPlotHeight - 4)`" text-anchor=`"end`" fill=`"#64748B`" font-family=`"Segoe UI,Arial,sans-serif`" font-size=`"10`">$(ConvertTo-XmlText $history[-1].date)</text>")
-}
-
-$svgLines.Add(' <text x="42" y="441" fill="#64748B" font-family="Segoe UI,Arial,sans-serif" font-size="11">Counts include GitHub release assets only. Source archives and repository clones are not release downloads.</text>')
-$svgLines.Add('</svg>')
-Write-Utf8NoBom -Path $ChartPath -Content (($svgLines -join [Environment]::NewLine) + [Environment]::NewLine)
-
-Write-Host "Updated download metrics for $Repository"
-Write-Host "Total downloads: $totalDownloads"
-Write-Host "7-day change: $delta7Label"
-Write-Host "30-day change: $delta30Label"