Skip to main content
Glama

MCP-Blender

by shdann
test_connection.py3.33 kB
#!/usr/bin/env python3 """ Test script to verify Blender MCP server connection """ import asyncio import json import socket import sys async def test_blender_connection(host="localhost", port=9876): """Test connection to Blender addon.""" try: print(f"Testing connection to Blender addon at {host}:{port}...") # Create socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(5) # 5 second timeout # Try to connect result = sock.connect_ex((host, port)) sock.close() if result == 0: print("[PASS] Successfully connected to Blender addon!") return True else: print("[FAIL] Could not connect to Blender addon.") print("Make sure:") print("1. Blender is running") print("2. The Blender MCP addon is installed and activated") print("3. The addon server is started (check the BlenderMCP panel)") return False except Exception as e: print(f"[FAIL] Connection test failed: {e}") return False def test_mcp_server_command(): """Test that blender-mcp command is available.""" try: import subprocess result = subprocess.run(["blender-mcp", "--help"], capture_output=True, text=True, timeout=10) if result.returncode == 0: print("[PASS] blender-mcp command is available") return True else: print("[FAIL] blender-mcp command failed") return False except Exception as e: print(f"[FAIL] blender-mcp command test failed: {e}") return False async def main(): """Main test function.""" print("=== Blender MCP Setup Test ===\n") # Test 1: MCP server command print("1. Testing MCP server command...") cmd_ok = test_mcp_server_command() print() # Test 2: Blender connection print("2. Testing Blender addon connection...") conn_ok = await test_blender_connection() print() # Summary print("=== Test Summary ===") print(f"MCP Server Command: {'[PASS]' if cmd_ok else '[FAIL]'}") print(f"Blender Connection: {'[PASS]' if conn_ok else '[FAIL]'}") print() if cmd_ok and conn_ok: print("SUCCESS: All tests passed! The Blender MCP setup is ready.") print("\nNext steps:") print("1. Restart Claude Code to pick up the MCP server configuration") print("2. In Claude Code, you should see 'blender' in the MCP servers list") print("3. You can now use Blender tools through Claude Code!") else: print("WARNING: Some tests failed. Please check the setup instructions.") if not cmd_ok: print("\nTo fix MCP server command:") print("cd mcp-blend && pip install -e .") if not conn_ok: print("\nTo fix Blender connection:") print("1. Open Blender") print("2. Go to Edit > Preferences > Add-ons") print("3. Install and enable the blender_addon.py") print("4. In the 3D viewport, press N to open sidebar") print("5. Go to BlenderMCP tab and click 'Connect to MCP server'") if __name__ == "__main__": asyncio.run(main())

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shdann/mcp-blend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server