Skip to content

Conversation

@EntangledQuantum
Copy link
Collaborator

@EntangledQuantum EntangledQuantum commented Mar 20, 2025

This pull request includes several changes to the mcpServer and Unity Editor connection management. The primary focus is updating the WebSocket port configuration and enhancing the MCP server's functionality with new filesystem tools.

WebSocket Port Configuration Updates:

Docker and Environment Configuration:

  • mcpServer/Dockerfile: Added a Dockerfile to set up the MCP server environment, including setting the default WebSocket port to 5010.
  • mcpServer/.dockerignore: Added a .dockerignore file to exclude unnecessary files from the Docker build context.

MCP Server Enhancements:

Minor Changes and Fixes:

These changes collectively improve the configurability and functionality of the MCP server and its integration with the Unity Editor.

Summary by CodeRabbit

  • New Features

    • Updated the default WebSocket connection port to 5010, ensuring a more reliable communication setup.
    • Introduced comprehensive filesystem operations for better management of Unity project assets.
    • Added containerization support with Docker Compose for streamlined deployment.
  • Refactor

    • Standardized configuration settings across the application.
    • Enhanced error handling and project path management for improved stability and user experience.

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update primarily changes the default WebSocket port from 8080 to 5010 across both the Unity Editor integration and the MCP server. It also adds comprehensive filesystem utility functions with asynchronous operations and robust path validation, integrates new Docker configuration files and metadata, and updates dependency versions. Additionally, the server startup process now dynamically determines the Unity project path, registers new filesystem tools, and improves error handling and logging, especially in the WebSocket handler.

Changes

Files Change Summary
Editor/MCPConnectionManager.cs, Editor/UI/MCPDebugWindow.cs, Editor/UI/MCPDebugWindow.uxml Updated default WebSocket port from 8080 to 5010 in connection management, debug UI logic, and UI layout placeholder/text.
mcpServer/.dockerignore, mcpServer/.env.example, mcpServer/Dockerfile, mcpServer/Dockerfile.meta, mcpServer/docker-compose.yml, mcpServer/docker-compose.yml.meta Introduced new Docker configuration files and metadata, and set environment variables to use port 5010.
mcpServer/build/filesystemTools.js, mcpServer/build/filesystemTools.js.meta
mcpServer/src/filesystemTools.ts, mcpServer/src/filesystemTools.ts.meta
Added comprehensive asynchronous filesystem utilities for Unity project file management with new tool registration functions.
mcpServer/build/index.js, mcpServer/build/toolDefinitions.js, mcpServer/build/types.js Updated server version to 0.2.0, enabled dynamic port assignment to 5010, registered filesystem tools, and added new file operation validation schemas and type definitions.
mcpServer/src/index.ts, mcpServer/src/toolDefinitions.ts, mcpServer/src/types.ts, mcpServer/src/websocketHandler.ts Enhanced project path sanitization, dynamic port configuration, improved error handling, integrated filesystem tools, and refined type interfaces and enums.
mcpServer/build/websocketHandler.js Changed default constructor port to 5010, renamed heartbeat method to sendPing, and introduced a generic sendMessage method with improved error checking.
mcpServer/package.json, mcpServer/tsconfig.json Updated dependency versions (including @modelcontextprotocol/sdk, diff, minimatch, zod, etc.) and added a new TypeScript compiler option (useUnknownInCatchVariables).

Sequence Diagram(s)

sequenceDiagram
    participant S as MCP Server
    participant E as Environment
    participant W as WebSocketHandler
    participant U as Unity Editor
    participant F as Filesystem Tools

    S->>E: Read MCP_WEBSOCKET_PORT (default 5010)
    S->>W: Initialize WebSocketHandler(port=5010)
    S->>F: Register filesystem tools
    W->>U: Accept connection request
    U->>W: Send command (e.g., filesystem tool request)
    W->>F: Dispatch tool handling
    F-->>W: Return operation result
    W->>U: Send back response message
Loading

Poem

Oh, I’m a rabbit with a coding beat,
Hopping from 8080 to 5010 so neat,
New tools and Docker on my joyful trail,
Files and webs now flow without fail,
In code fields, I dance with endless cheer—
Updates so fresh, they make my whiskers revere!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed4e9f2 and b86aef2.

⛔ Files ignored due to path filters (1)
  • mcpServer/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (23)
  • Editor/MCPConnectionManager.cs (1 hunks)
  • Editor/UI/MCPDebugWindow.cs (3 hunks)
  • Editor/UI/MCPDebugWindow.uxml (1 hunks)
  • mcpServer/.dockerignore (1 hunks)
  • mcpServer/.env.example (1 hunks)
  • mcpServer/Dockerfile (1 hunks)
  • mcpServer/Dockerfile.meta (1 hunks)
  • mcpServer/build/filesystemTools.js (1 hunks)
  • mcpServer/build/filesystemTools.js.meta (1 hunks)
  • mcpServer/build/index.js (2 hunks)
  • mcpServer/build/toolDefinitions.js (3 hunks)
  • mcpServer/build/types.js (1 hunks)
  • mcpServer/build/websocketHandler.js (9 hunks)
  • mcpServer/docker-compose.yml (1 hunks)
  • mcpServer/docker-compose.yml.meta (1 hunks)
  • mcpServer/package.json (1 hunks)
  • mcpServer/src/filesystemTools.ts (1 hunks)
  • mcpServer/src/filesystemTools.ts.meta (1 hunks)
  • mcpServer/src/index.ts (4 hunks)
  • mcpServer/src/toolDefinitions.ts (3 hunks)
  • mcpServer/src/types.ts (2 hunks)
  • mcpServer/src/websocketHandler.ts (11 hunks)
  • mcpServer/tsconfig.json (1 hunks)
✨ Finishing Touches
  • 📝 Docstrings were successfully generated. (🔄 Check again to generate again)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@EntangledQuantum EntangledQuantum merged commit 3754a0b into main Mar 20, 2025
1 check was pending
coderabbitai bot added a commit that referenced this pull request Mar 20, 2025
Docstrings generation was requested by @shahzadgamedev.

* #6 (comment)

The following files were modified:

* `Editor/UI/MCPDebugWindow.cs`
* `mcpServer/build/filesystemTools.js`
* `mcpServer/build/toolDefinitions.js`
* `mcpServer/src/filesystemTools.ts`
* `mcpServer/src/toolDefinitions.ts`
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2025

Note

Generated docstrings for this pull request at #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants