# How `get_blender_connection()` Implements Connection Pooling in Blender MCP

> Discover how get_blender_connection() in Blender MCP implements connection pooling. Learn about its global instance, lightweight ping validation, and automatic socket recreation for efficient connections.

- Repository: [ahujasid/blender-mcp](https://github.com/ahujasid/blender-mcp)
- Tags: internals
- Published: 2026-04-13

---

**`get_blender_connection()` implements connection pooling by maintaining a single global `BlenderConnection` instance that is validated via a lightweight ping and reused across all MCP tool requests, automatically recreating the socket if the connection is lost.**

The **Blender MCP** server enables LLMs to control Blender through a persistent TCP socket, avoiding the overhead of spawning new processes per command. Instead of creating a fresh socket for every tool invocation, the `get_blender_connection()` function in [`src/blender_mcp/server.py`](https://github.com/ahujasid/blender-mcp/blob/main/src/blender_mcp/server.py) manages a module-level connection that all