@glutamateapp/blender-mcp-ts
v0.10.0
Published
TypeScript version of Blender MCP server with SSE support
Readme
Blender MCP TypeScript Server
A TypeScript implementation of the Blender Model Context Protocol (MCP) server with Server-Sent Events (SSE) support.
Features
- TypeScript implementation with full type safety
- SSE-based communication with MCP clients
- Socket-based communication with Blender
- Built-in tools:
get_scene_info: Get detailed information about the current Blender sceneexecute_blender_code: Execute Python code in Blender- PolyHaven Integration:
get_polyhaven_categories: Get available categories for a specific type of PolyHaven assetsearch_polyhaven_assets: Search for assets on PolyHaven with optional category filteringdownload_polyhaven_asset: Download and import a PolyHaven asset into Blenderset_texture: Apply a downloaded PolyHaven texture to an objectget_polyhaven_status: Check if PolyHaven integration is enabled
Prerequisites
- Node.js 16.x or later
- Blender with the MCP addon installed and running
- npm or yarn package manager
Installation
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build
Usage
Start the server:
# Using default ports npm start # Using custom ports via environment variables PORT=8000 CONNECTOR_PORT=9000 npm start # Using custom ports via command line arguments npm start -- --port=8000 --connector-port=9000The server will start with the configured ports based on the priority order mentioned above.
Using PolyHaven Tools:
- Ensure that the PolyHaven integration is enabled.
- Use the provided tools to interact with PolyHaven assets as needed.
- PolyHaven Integration: Ensure that the PolyHaven integration is enabled if you plan to use these features.
Development
To run the server in development mode with automatic recompilation:
npm run devEnvironment Variables
CONNECTOR_PORT: The port number for Blender connection (default: 9025)
Connection Details
The server uses two configurable ports:
- MCP Server Port: Listens for client connections (default: 7451)
- Blender Connector Port: Connects to Blender (default: 9025)
These ports can be configured through:
- Environment variables (
MCP_PORT,CONNECTOR_PORT) - Command line arguments (
--port=<number>,--connector-port=<number>) - Default values if neither is specified
Priority order: Environment Variables > Command Line Arguments > Default Values
Architecture
The server consists of three main components:
BlenderConnection: Handles socket communication with Blender, connecting tolocalhoston the configured connector port (default: 9025).BlenderMcpServer: Implements the MCP server with SSE support on the configured MCP port (default: 7451), providing tools for scene information and code execution.- Main Entry Point (
index.ts): Initializes the server components with configurable ports through environment variables or command line arguments, following a priority-based configuration system.
Acknowledgments
This project is based on the original work by Siddharth Ahuja, as found on GitHub. We appreciate their contributions to the development of the Blender MCP server.
License
MIT
