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
13 changes: 3 additions & 10 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,14 @@ jobs:
fetch-depth: 0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
cache: 'npm'

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: npm ci

- name: Run semantic-release dry-run
id: version
Expand All @@ -42,7 +35,7 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# semantic-release dry-runを実行してバージョン番号を取得
OUTPUT=$(pnpm exec semantic-release --dry-run --branches develop 2>&1)
OUTPUT=$(npx semantic-release --dry-run --branches develop 2>&1)
echo "$OUTPUT"

# Conventional Commits検証
Expand Down
26 changes: 8 additions & 18 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install build tools (Linux)
if: runner.os == 'Linux'
Expand All @@ -32,22 +27,22 @@ jobs:
sudo apt-get install -y build-essential python3 make gcc g++

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: npm ci

- name: Run Markdownlint
working-directory: ./mcp-server
run: >
pnpm exec markdownlint "./**/*.md"
npx markdownlint "./**/*.md"
--config ../.markdownlint.json
--ignore-path ../.markdownlintignore

- name: Run ESLint
working-directory: ./mcp-server
run: pnpm exec eslint src tests --ext .js --max-warnings=0
run: npx eslint src tests --ext .js --max-warnings=0

- name: Check formatting
working-directory: ./mcp-server
run: pnpm exec prettier --check .
run: npx prettier --check .
continue-on-error: true

commitlint:
Expand All @@ -61,23 +56,18 @@ jobs:
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: npm ci

- name: Validate commit messages
run: >
pnpm exec commitlint
npx commitlint
--from ${{ github.event.pull_request.base.sha }}
--to ${{ github.event.pull_request.head.sha }}
--verbose
10 changes: 2 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,6 @@ jobs:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
run_install: false

- name: Get latest tag
id: tag
run: |
Expand Down Expand Up @@ -237,11 +231,11 @@ jobs:
exit 1

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: npm ci

- name: Run tests
working-directory: mcp-server
run: pnpm run test:ci
run: npm run test:ci

- name: Publish to npm
working-directory: mcp-server
Expand Down
32 changes: 9 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,11 @@ jobs:
with:
ref: ${{ github.ref }}

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
cache: 'npm'

- name: Install build tools (Linux)
if: runner.os == 'Linux'
Expand All @@ -47,26 +40,26 @@ jobs:
sudo apt-get install -y build-essential python3 make gcc g++

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: npm ci

- name: Run Markdownlint
working-directory: ./mcp-server
run: >
pnpm exec markdownlint "./**/*.md"
npx markdownlint "./**/*.md"
--config ../.markdownlint.json
--ignore-path ../.markdownlintignore

- name: Run ESLint
working-directory: ./mcp-server
run: pnpm exec eslint src tests --ext .js --max-warnings=0
run: npx eslint src tests --ext .js --max-warnings=0

- name: Check formatting
working-directory: ./mcp-server
run: pnpm exec prettier --check .
run: npx prettier --check .
continue-on-error: true

- name: Run tests
run: pnpm --filter mcp-server run test:ci
run: npm run test:ci --workspace=mcp-server
env:
NODE_ENV: test
CI: true
Expand Down Expand Up @@ -97,21 +90,14 @@ jobs:
fetch-depth: 0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
cache: 'npm'

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: npm ci

- name: Run semantic-release
id: semantic
Expand All @@ -126,7 +112,7 @@ jobs:
run: |
# semantic-releaseを実行して出力を取得(ログも表示)
set -o pipefail
pnpm exec semantic-release | tee release-output.txt
npx semantic-release | tee release-output.txt
RELEASE_EXIT_CODE=${PIPESTATUS[0]}

# semantic-releaseの出力を解析して新しいリリースが作成されたか確認
Expand Down
24 changes: 7 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install build tools (Linux)
if: runner.os == 'Linux'
Expand All @@ -32,17 +27,17 @@ jobs:
sudo apt-get install -y build-essential python3 make gcc g++

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: npm ci

- name: Run targeted CI tests
run: pnpm --filter mcp-server run test:ci
run: npm run test:ci --workspace=mcp-server
env:
NODE_ENV: test
CI: true
DISABLE_AUTO_RECONNECT: true

- name: Generate coverage report
run: pnpm --filter mcp-server run test:ci:coverage
run: npm run test:ci:coverage --workspace=mcp-server
continue-on-error: true
env:
NODE_ENV: test
Expand Down Expand Up @@ -71,16 +66,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.20.0
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install build tools (Linux)
if: runner.os == 'Linux'
Expand All @@ -89,11 +79,11 @@ jobs:
sudo apt-get install -y build-essential python3 make gcc g++

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: npm ci

- name: Pack npm artifact
working-directory: ./mcp-server
run: pnpm pack
run: npm pack

- name: Verify package archive
run: |
Expand Down
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ sequenceDiagram
## Setup

- Unity 2020.3 LTS or newer
- Node.js 18.x / 20.x / 22.x LTS (the server refuses to start on newer majors) and pnpm (via Corepack)
- Node.js 18.x / 20.x / 22.x LTS (the server refuses to start on newer majors)
- Prefer Node.js 20.x or 22.x for the best compatibility (prebuilt `better-sqlite3` binaries are available); Node.js 18.x works, but anything ≥23 is rejected at launch.
- Claude Desktop or another MCP-compatible client

Expand All @@ -207,35 +207,34 @@ Installation

### MCP Server Environment Setup

You must install the MCP server's pnpm-managed dependencies **on the same OS where the server runs** so that native modules such as `better-sqlite3` are built for the correct platform.
You must install the MCP server's dependencies **on the same OS where the server runs** so that native modules such as `better-sqlite3` are built for the correct platform.

- **General rule**: if your `.mcp.json` uses `"command": "node"` (e.g. `node bin/unity-mcp-server serve`), run `pnpm install` (or `pnpm install --frozen-lockfile`) inside the directory where the package lives _on that machine/container_ before launching the MCP client.
- **pnpm build approval**: pnpm v10+ blocks native build scripts until you approve them. Run `pnpm approve-builds better-sqlite3` once (select the package and confirm) so the SQLite binding can compile successfully.citeturn1view0
- **General rule**: if your `.mcp.json` uses `"command": "node"` (e.g. `node bin/unity-mcp-server serve`), run `npm install` (or `npm ci`) inside the directory where the package lives _on that machine/container_ before launching the MCP client.
- **`npx` launch**: the README example above (`npx @akiojin/unity-mcp-server@latest`) downloads dependencies at runtime and works on the supported Node.js versions (18.x / 20.x / 22.x). Node.js 23+ is not supported; the server exits early with a version error.
- **Avoid sharing `node_modules` across operating systems** (Windows ↔ Linux/macOS). Native binaries compiled for one platform cannot be reused on another.

Environment-specific notes:

- **Windows (PowerShell / Command Prompt)**
- Install Node.js 20.x or 22.x LTS (18.x also works if you prefer). Newer major versions (23+) are unsupported.
- In your workspace: change into the installed package directory (for repo clones: `cd C:\path\to\unity-mcp-server\mcp-server`) then run `pnpm install --frozen-lockfile`.
- In your workspace: change into the installed package directory (for repo clones: `cd C:\path\to\unity-mcp-server\mcp-server`) then run `npm ci`.
- Point `.mcp.json` to `node` or keep using `npx` once dependencies exist.

- **Windows Subsystem for Linux (WSL)**
- Keep the repository on the Linux filesystem (e.g. `/home/<user>/unity-mcp-server`).
- Use Node.js 20.x or 22.x inside WSL (18.x also works).
- Run `pnpm install --frozen-lockfile` inside the installed package directory (for repo clones: `/home/<user>/unity-mcp-server/mcp-server`).
- Run `npm ci` inside the installed package directory (for repo clones: `/home/<user>/unity-mcp-server/mcp-server`).

- **Docker / Linux containers**
- Base your image on Node.js 20.x or 22.x (18.x also works). Images with newer Node versions (23+) are unsupported and will fail fast.
- During the image build run `pnpm install --filter mcp-server --frozen-lockfile` (or `pnpm install --frozen-lockfile` inside the package directory) so the container has platform-matched dependencies.
- During the image build run `npm ci --workspace=mcp-server` (or `npm ci` inside the package directory) so the container has platform-matched dependencies.
- Do not bind-mount a host `node_modules` directory into the container.

- **macOS**
- Install Node.js 20.x or 22.x (e.g. `brew install node@22` / `node@20` and add it to `PATH`). Node 18.x also works; newer majors (23+) are unsupported.
- Run `pnpm install --frozen-lockfile` wherever the package is installed (for repo clones: `cd ~/unity-mcp-server/mcp-server && pnpm install --frozen-lockfile`).
- Run `npm ci` wherever the package is installed (for repo clones: `cd ~/unity-mcp-server/mcp-server && npm ci`).

After installation you can verify the server with `node mcp-server/bin/unity-mcp-server --version`. If `better-sqlite3` fails to load, reinstall the dependencies _inside the target environment_ or rebuild with `pnpm rebuild better-sqlite3 --filter mcp-server --build-from-source` once the toolchain is present.
After installation you can verify the server with `node mcp-server/bin/unity-mcp-server --version`. If `better-sqlite3` fails to load, reinstall the dependencies _inside the target environment_ or rebuild with `npm rebuild better-sqlite3` once the toolchain is present.

## Usage Workflow

Expand Down
9 changes: 2 additions & 7 deletions mcp-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"simulate:code-index": "node scripts/simulate-code-index-status.mjs",
"test:verbose": "VERBOSE_TEST=true node --test tests/**/*.test.js",
"prepare": "cd .. && husky || true",
"prepublishOnly": "pnpm run test:ci",
"prepublishOnly": "npm run test:ci",
"postinstall": "chmod +x bin/unity-mcp-server || true",
"test:ci:unity": "timeout 60 node --test tests/unit/core/codeIndex.test.js tests/unit/core/codeIndexDb.test.js tests/unit/core/config.test.js tests/unit/core/indexWatcher.test.js tests/unit/core/projectInfo.test.js tests/unit/core/server.test.js || exit 0",
"test:unity": "node tests/run-unity-integration.mjs",
"test:nounity": "pnpm run test:integration",
"test:nounity": "npm run test:integration",
"test:ci:integration": "CI=true NODE_ENV=test node --test tests/integration/code-index-background.test.js"
},
"keywords": [
Expand Down Expand Up @@ -60,11 +60,6 @@
"url": "https://github.com/akiojin/unity-mcp-server.git",
"directory": "mcp-server"
},
"pnpm": {
"onlyBuiltDependencies": [
"better-sqlite3"
]
},
"homepage": "https://github.com/akiojin/unity-mcp-server#readme",
"bugs": {
"url": "https://github.com/akiojin/unity-mcp-server/issues"
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "1.0.0",
"private": true,
"description": "Workspace root for unity-mcp-server monorepo",
"packageManager": "[email protected]",
"scripts": {
"release": "semantic-release"
},
Expand All @@ -22,8 +21,5 @@
},
"workspaces": [
"mcp-server"
],
"pnpm": {
"onlyBuiltDependencies": ["better-sqlite3"]
}
]
}
Loading
Loading