forked from 1b-agent/opencadstudio-upstream
Remove MCP bundle distribution
This commit is contained in:
1 parent
afbf826b0c
commit
cbb4015760
5 files changed
+11
-237
No files matched your search
@@ -17,9 +17,9 @@ jobs:
|
|||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- name: Validate control contract
|
- name: Validate control contract
|
||||||
run: cargo test --lib app::control::tests
|
run: cargo test --lib app::control::tests
|
||||||
- name: Validate MCP packaging scripts
|
- name: Validate MCP smoke script
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
run: python3 -m py_compile docs/automation/mcp_smoke.py packaging/mcpb/pack.py
|
run: python3 -m py_compile docs/automation/mcp_smoke.py
|
||||||
mcp:
|
mcp:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -28,7 +28,6 @@ jobs:
|
|||||||
- run: cargo test --lib mcp::tests
|
- run: cargo test --lib mcp::tests
|
||||||
- run: cargo build
|
- run: cargo build
|
||||||
- run: python3 docs/automation/mcp_smoke.py target/debug/OpenCADStudio
|
- run: python3 docs/automation/mcp_smoke.py target/debug/OpenCADStudio
|
||||||
- run: python3 packaging/mcpb/pack.py --version 0.0.0 --linux /bin/true --windows /bin/true --macos /bin/true --output /tmp/OpenCADStudio.mcpb --server-json /tmp/server.json
|
|
||||||
web:
|
web:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -233,14 +233,6 @@ jobs:
|
|||||||
timestamp-rfc3161: http://timestamp.acs.microsoft.com
|
timestamp-rfc3161: http://timestamp.acs.microsoft.com
|
||||||
timestamp-digest: SHA256
|
timestamp-digest: SHA256
|
||||||
|
|
||||||
- name: Upload signed executable for MCP Bundle
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: mcpb-windows-binary
|
|
||||||
path: target/release/OpenCADStudio.exe
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
- name: Build MSI installer
|
- name: Build MSI installer
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
@@ -436,14 +428,6 @@ jobs:
|
|||||||
codesign --force --deep --sign - --timestamp=none OpenCADStudio.app
|
codesign --force --deep --sign - --timestamp=none OpenCADStudio.app
|
||||||
codesign --verify --strict --verbose=2 OpenCADStudio.app
|
codesign --verify --strict --verbose=2 OpenCADStudio.app
|
||||||
|
|
||||||
- name: Upload signed executable for MCP Bundle
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: mcpb-macos-binary
|
|
||||||
path: OpenCADStudio.app/Contents/MacOS/OpenCADStudio
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
- name: Create .dmg
|
- name: Create .dmg
|
||||||
run: |
|
run: |
|
||||||
# hdiutil intermittently fails with "Resource busy" on the hosted
|
# hdiutil intermittently fails with "Resource busy" on the hosted
|
||||||
@@ -491,99 +475,3 @@ jobs:
|
|||||||
echo " sha256 \"$SHA\""
|
echo " sha256 \"$SHA\""
|
||||||
echo '```'
|
echo '```'
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|
||||||
build-mcpb:
|
|
||||||
if: github.event_name == 'release' || inputs.target == 'all'
|
|
||||||
needs: [build-appimage, build-windows, build-macos]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Download Linux executable
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: linux-payload
|
|
||||||
path: mcpb/linux
|
|
||||||
|
|
||||||
- name: Download Windows executable
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: mcpb-windows-binary
|
|
||||||
path: mcpb/windows
|
|
||||||
|
|
||||||
- name: Download macOS executable
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: mcpb-macos-binary
|
|
||||||
path: mcpb/macos
|
|
||||||
|
|
||||||
- name: Set package version
|
|
||||||
id: package
|
|
||||||
env:
|
|
||||||
EVENT_NAME: ${{ github.event_name }}
|
|
||||||
REF_NAME: ${{ github.ref_name }}
|
|
||||||
run: |
|
|
||||||
if [ "$EVENT_NAME" = "release" ]; then
|
|
||||||
VERSION="${REF_NAME#v}"
|
|
||||||
if [ "v$VERSION" != "$REF_NAME" ]; then
|
|
||||||
echo "::error::Release tag must be vX.Y.Z"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
VERSION="$(sed -n 's/^version = "\([0-9][0-9.]*\)"/\1/p' Cargo.toml | head -1)"
|
|
||||||
fi
|
|
||||||
if ! printf '%s' "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
||||||
echo "::error::Invalid package version: $VERSION"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Build MCP Bundle
|
|
||||||
env:
|
|
||||||
VERSION: ${{ steps.package.outputs.version }}
|
|
||||||
run: |
|
|
||||||
tar -C mcpb/linux -xzf mcpb/linux/linux-payload.tar.gz
|
|
||||||
chmod +x \
|
|
||||||
mcpb/linux/usr/bin/OpenCADStudio \
|
|
||||||
mcpb/windows/OpenCADStudio.exe \
|
|
||||||
mcpb/macos/OpenCADStudio
|
|
||||||
python3 packaging/mcpb/pack.py \
|
|
||||||
--version "$VERSION" \
|
|
||||||
--linux mcpb/linux/usr/bin/OpenCADStudio \
|
|
||||||
--windows mcpb/windows/OpenCADStudio.exe \
|
|
||||||
--macos mcpb/macos/OpenCADStudio \
|
|
||||||
--output "OpenCADStudio-v${VERSION}.mcpb" \
|
|
||||||
--server-json server.json
|
|
||||||
|
|
||||||
- name: Upload MCP Bundle to release
|
|
||||||
if: github.event_name == 'release'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
VERSION: ${{ steps.package.outputs.version }}
|
|
||||||
run: gh release upload "${{ github.ref_name }}" "OpenCADStudio-v${VERSION}.mcpb" server.json --clobber --repo "${{ github.repository }}"
|
|
||||||
|
|
||||||
- name: Install MCP Registry publisher
|
|
||||||
if: github.event_name == 'release'
|
|
||||||
run: |
|
|
||||||
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
|
|
||||||
|
|
||||||
- name: Publish to official MCP Registry
|
|
||||||
if: github.event_name == 'release'
|
|
||||||
run: |
|
|
||||||
./mcp-publisher login github-oidc
|
|
||||||
./mcp-publisher publish server.json
|
|
||||||
|
|
||||||
- name: Upload MCP Bundle as workflow artifact
|
|
||||||
if: github.event_name == 'workflow_dispatch'
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: OpenCADStudio-v${{ steps.package.outputs.version }}-mcpb
|
|
||||||
path: |
|
|
||||||
OpenCADStudio-v${{ steps.package.outputs.version }}.mcpb
|
|
||||||
server.json
|
|
||||||
if-no-files-found: error
|
|
||||||
@@ -183,7 +183,7 @@ OpenCADStudio --serve --port 4242
|
|||||||
OpenCADStudio --mcp
|
OpenCADStudio --mcp
|
||||||
```
|
```
|
||||||
|
|
||||||
The automation server exchanges one JSON object per line over standard input/output or a local TCP socket. The self-contained MCP endpoint exposes the live desktop editor through the same tools to every compatible client. Releases also publish a standard MCP Bundle and official registry metadata. See the [MCP control guide](docs/automation/README.md).
|
The automation server exchanges one JSON object per line over standard input/output or a local TCP socket. The self-contained MCP endpoint exposes the live desktop editor through the same tools to every compatible client. To connect a client, configure it to launch `OpenCADStudio --mcp`. See the [MCP control guide](docs/automation/README.md).
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
Every native OpenCADStudio build contains the same MCP server as the editor. `OpenCADStudio --mcp` starts it over stdio, opens the desktop editor when needed, and exposes the live document without Python, a package manager, a sidecar service, or client-specific code.
|
Every native OpenCADStudio build contains the same MCP server as the editor. `OpenCADStudio --mcp` starts it over stdio, opens the desktop editor when needed, and exposes the live document without Python, a package manager, a sidecar service, or client-specific code.
|
||||||
|
|
||||||
|
MCP lets an AI client inspect the open drawing, execute editor commands, and verify the result through a shared protocol. Install OpenCADStudio, then add a local MCP server in the client and set its command to:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
OpenCADStudio --mcp
|
||||||
|
```
|
||||||
|
|
||||||
|
The client must start that command over standard input/output. If it asks for the executable and arguments separately, select the installed `OpenCADStudio` executable and enter `--mcp` as its only argument. The exact registration screen or configuration location belongs to the client. Once connected, the four tools below should appear in the client's MCP tool list.
|
||||||
|
|
||||||
The server provides four tools:
|
The server provides four tools:
|
||||||
|
|
||||||
- `ocs_sessions` finds running editor sessions and opens OpenCADStudio when none exists.
|
- `ocs_sessions` finds running editor sessions and opens OpenCADStudio when none exists.
|
||||||
@@ -11,10 +19,6 @@ The server provides four tools:
|
|||||||
|
|
||||||
Mutations carry a session ID, document ID, expected revision, selection, and idempotent request ID. Commands report `waiting_input` while more input is required and asynchronous work remains `running` until its real callback finishes. Geometry stays in OpenCADStudio and its geometry kernel.
|
Mutations carry a session ID, document ID, expected revision, selection, and idempotent request ID. Commands report `waiting_input` while more input is required and asynchronous work remains `running` until its real callback finishes. Geometry stays in OpenCADStudio and its geometry kernel.
|
||||||
|
|
||||||
Release builds also produce one standard MCP Bundle containing the native binaries for supported desktop platforms. The release workflow publishes its `server.json` metadata to the official MCP Registry. Compatible AI hosts can therefore discover and install the same server without an OpenCADStudio-specific adapter.
|
|
||||||
|
|
||||||
Registry discovery and permission prompts belong to the AI host. Hosts that implement MCP Registry and MCP Bundle support need no OpenCADStudio-specific setup; other hosts cannot be enabled silently by the application.
|
|
||||||
|
|
||||||
The source-tree protocol smoke test uses only the Python standard library:
|
The source-tree protocol smoke test uses only the Python standard library:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@@ -1,117 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""Build the client-neutral OpenCADStudio MCP Bundle and registry metadata."""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import hashlib
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
import stat
|
|
||||||
import zipfile
|
|
||||||
|
|
||||||
|
|
||||||
def manifest(version: str) -> dict:
|
|
||||||
return {
|
|
||||||
"manifest_version": "0.3",
|
|
||||||
"name": "opencadstudio",
|
|
||||||
"display_name": "OpenCADStudio",
|
|
||||||
"version": version,
|
|
||||||
"description": "Control and inspect live OpenCADStudio drawings through MCP",
|
|
||||||
"long_description": "Opens OpenCADStudio when needed and provides semantic drawing commands, document inspection, measurements, and visual verification.",
|
|
||||||
"author": {
|
|
||||||
"name": "Hakan Seven",
|
|
||||||
"url": "https://github.com/HakanSeven12/OpenCADStudio",
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/HakanSeven12/OpenCADStudio",
|
|
||||||
},
|
|
||||||
"server": {
|
|
||||||
"type": "binary",
|
|
||||||
"entry_point": "server/linux-x86_64/OpenCADStudio",
|
|
||||||
"mcp_config": {
|
|
||||||
"command": "${__dirname}/server/linux-x86_64/OpenCADStudio",
|
|
||||||
"args": ["--mcp"],
|
|
||||||
"env": {},
|
|
||||||
"platform_overrides": {
|
|
||||||
"win32": {
|
|
||||||
"command": "${__dirname}/server/win32-x86_64/OpenCADStudio.exe"
|
|
||||||
},
|
|
||||||
"darwin": {
|
|
||||||
"command": "${__dirname}/server/darwin-aarch64/OpenCADStudio"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"tools": [
|
|
||||||
{"name": "ocs_sessions", "description": "List or open live editor sessions"},
|
|
||||||
{"name": "ocs_read", "description": "Read drawing and editor state"},
|
|
||||||
{"name": "ocs_execute", "description": "Execute a semantic editor action"},
|
|
||||||
{"name": "ocs_capture", "description": "Capture the current editor window"},
|
|
||||||
],
|
|
||||||
"keywords": ["cad", "drawing", "mcp"],
|
|
||||||
"license": "GPL-3.0-or-later",
|
|
||||||
"compatibility": {"platforms": ["linux", "win32", "darwin"]},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def add(archive: zipfile.ZipFile, source: Path, destination: str) -> None:
|
|
||||||
if not source.is_file():
|
|
||||||
raise SystemExit(f"Missing MCP binary: {source}")
|
|
||||||
info = zipfile.ZipInfo(destination, date_time=(1980, 1, 1, 0, 0, 0))
|
|
||||||
info.compress_type = zipfile.ZIP_DEFLATED
|
|
||||||
info.create_system = 3
|
|
||||||
info.external_attr = (stat.S_IFREG | 0o755) << 16
|
|
||||||
archive.writestr(info, source.read_bytes())
|
|
||||||
|
|
||||||
|
|
||||||
def registry_metadata(version: str, bundle: Path) -> dict:
|
|
||||||
digest = hashlib.sha256(bundle.read_bytes()).hexdigest()
|
|
||||||
return {
|
|
||||||
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
||||||
"name": "io.github.HakanSeven12/opencadstudio",
|
|
||||||
"title": "OpenCADStudio",
|
|
||||||
"description": "Control and inspect live OpenCADStudio drawings through MCP",
|
|
||||||
"version": version,
|
|
||||||
"repository": {
|
|
||||||
"url": "https://github.com/HakanSeven12/OpenCADStudio",
|
|
||||||
"source": "github",
|
|
||||||
},
|
|
||||||
"websiteUrl": "https://github.com/HakanSeven12/OpenCADStudio",
|
|
||||||
"packages": [
|
|
||||||
{
|
|
||||||
"registryType": "mcpb",
|
|
||||||
"identifier": f"https://github.com/HakanSeven12/OpenCADStudio/releases/download/v{version}/{bundle.name}",
|
|
||||||
"version": version,
|
|
||||||
"fileSha256": digest,
|
|
||||||
"transport": {"type": "stdio"},
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument("--version", required=True)
|
|
||||||
parser.add_argument("--linux", type=Path, required=True)
|
|
||||||
parser.add_argument("--windows", type=Path, required=True)
|
|
||||||
parser.add_argument("--macos", type=Path, required=True)
|
|
||||||
parser.add_argument("--output", type=Path, required=True)
|
|
||||||
parser.add_argument("--server-json", type=Path, required=True)
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
with zipfile.ZipFile(args.output, "w") as archive:
|
|
||||||
archive.writestr("manifest.json", json.dumps(manifest(args.version), indent=2) + "\n")
|
|
||||||
add(archive, args.linux, "server/linux-x86_64/OpenCADStudio")
|
|
||||||
add(archive, args.windows, "server/win32-x86_64/OpenCADStudio.exe")
|
|
||||||
add(archive, args.macos, "server/darwin-aarch64/OpenCADStudio")
|
|
||||||
|
|
||||||
args.server_json.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
args.server_json.write_text(
|
|
||||||
json.dumps(registry_metadata(args.version, args.output), indent=2) + "\n",
|
|
||||||
encoding="utf-8",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
Reference in new issue
Block a user