Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,7 @@ jobs:
git tag -a "$TAG" -m "Version ${NEW_VERSION}"
git push origin "$TAG"

- name: Package server for release
env:
NEW_VERSION: ${{ steps.compute.outputs.new_version }}
shell: bash
run: |
set -euo pipefail
cd MCPForUnity
zip -r ../mcp-for-unity-server-v${NEW_VERSION}.zip UnityMcpServer~
cd ..
ls -lh mcp-for-unity-server-v${NEW_VERSION}.zip
echo "Server package created: mcp-for-unity-server-v${NEW_VERSION}.zip"

- name: Create GitHub release with server artifact
- name: Create GitHub release
env:
NEW_VERSION: ${{ steps.compute.outputs.new_version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -130,8 +118,7 @@ jobs:
set -euo pipefail
TAG="v${NEW_VERSION}"

# Create release
# Create release with auto-generated notes
gh release create "$TAG" \
--title "v${NEW_VERSION}" \
--notes "Release v${NEW_VERSION}" \
"mcp-for-unity-server-v${NEW_VERSION}.zip#MCP Server v${NEW_VERSION}"
--generate-notes
17 changes: 15 additions & 2 deletions MCPForUnity/UnityMcpServer~/src/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,23 @@ dev = [
"pytest-asyncio>=0.23",
]

[project.scripts]
mcp-for-unity = "server:main"

[build-system]
requires = ["setuptools>=64.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
py-modules = ["config", "server", "unity_connection"]
packages = ["tools"]
py-modules = [
"config",
"models",
"module_discovery",
"port_discovery",
"reload_sentinel",
"server",
"telemetry",
"telemetry_decorator",
"unity_connection"
]
packages = ["tools", "resources", "registry"]
7 changes: 6 additions & 1 deletion MCPForUnity/UnityMcpServer~/src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ def asset_creation_strategy() -> str:
)


def main():
"""Entry point for uvx and console scripts."""
mcp.run(transport='stdio')


# Run the server
if __name__ == "__main__":
mcp.run(transport='stdio')
main()
24 changes: 17 additions & 7 deletions MCPForUnity/UnityMcpServer~/src/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import contextlib
from dataclasses import dataclass
from enum import Enum
import importlib
from importlib import import_module, metadata
import json
import logging
import os
Expand Down Expand Up @@ -38,12 +38,22 @@

def get_package_version() -> str:
"""
Open pyproject.toml and parse version
We use the tomli library instead of tomllib to support Python 3.10
Get package version in different ways:
1. First we try the installed metadata - this is because uvx is used on the asset store
2. If that fails, we try to read from pyproject.toml - this is available for users who download via Git
Default is "unknown", but that should never happen
"""
with open("pyproject.toml", "rb") as f:
data = tomli.load(f)
return data["project"]["version"]
try:
return metadata.version("MCPForUnityServer")
except Exception:
# Fallback for development: read from pyproject.toml
try:
pyproject_path = Path(__file__).parent / "pyproject.toml"
with open(pyproject_path, "rb") as f:
data = tomli.load(f)
return data["project"]["version"]
except Exception:
return "unknown"


MCP_VERSION = get_package_version()
Expand Down Expand Up @@ -100,7 +110,7 @@ def __init__(self):
"MCPForUnity.UnityMcpServer.src.config",
):
try:
mod = importlib.import_module(modname)
mod = import_module(modname)
server_config = getattr(mod, "config", None)
if server_config is not None:
break
Expand Down