MCP OpenCode Blender هو خادم Model Context Protocol يوفر تكاملًا قويًا بين OpenCode و Blender لإدارة وتشغيل نماذج ثلاثية الأبعاد برمجيًا.
✅ التحكم الكامل في Blender عبر API
✅ إنشاء وتعديل الأشكال ثلاثية الأبعاد
✅ تطبيق المواد والألوان
✅ تصدير النماذج بصيغ متعددة (GLB, FBX, OBJ)
✅ دعم سكريبتات Python
✅ معالجة الأخطاء المتقدمة
✅ تسجيل شامل للعمليات
- Python 3.8 أو أحدث
- Blender 3.0 أو أحدث
- pip (مدير الحزم)
git clone https://github.com/khalidSAT/mcp-opencode-blender.git
cd mcp-opencode-blender# على Linux/Mac
python3 -m venv venv
source venv/bin/activate
# على Windows
python -m venv venv
venv\Scripts\activatepip install -r requirements.txtpython server.pyالناتج المتوقع:
🚀 MCP OpenCode Blender Server Started
📍 Server running on: localhost:5000
✅ Ready to accept connections
في نافذة أخرى:
python examples/basic_usage.pyاختبار الاتصال بالخادم
response = client.send_command('ping')إنشاء شكل أولي
response = client.send_command('create_primitive', {
'type': 'cube', # cube, sphere, cylinder, plane
'name': 'my_object',
'scale': 1.0
})تعديل خصائص الكائن
response = client.send_command('set_object_property', {
'object_name': 'my_object',
'location': [0, 0, 0],
'rotation': [0, 0, 0],
'scale': [1, 1, 1]
})تطبيق مادة وألوان
response = client.send_command('apply_material', {
'object_name': 'my_object',
'color': [1, 0, 0], # RGB (أحمر)
'metallic': 0.5,
'roughness': 0.3
})تصدير المشهد
response = client.send_command('export_scene', {
'format': 'glb', # glb, fbx, obj, usdz
'filepath': './output/scene.glb'
})الحصول على معلومات المشهد
response = client.send_command('get_scene_info')عرض جميع الأوامر المتاحة
response = client.send_command('help')mcp-opencode-blender/
├── server.py # خادم MCP الرئيسي
├── client.py # عميل للاتصال بالخادم
├── requirements.txt # المكتبات المطلوبة
├── config.json # إعدادات المشروع
├── .gitignore # ملف استثناء Git
├── README.md # هذا الملف
├── LICENSE # رخصة MIT
├── examples/
│ ├── basic_usage.py # أمثلة أساسية
│ ├── advanced_usage.py # أمثلة متقدمة
│ └── blender_integration.py # التكامل مع Blender
├── tests/
│ ├── test_server.py # اختبارات الخادم
│ ├── test_commands.py # اختبارات الأوامر
│ └── test_client.py # اختبارات العميل
├── docs/
│ ├── API_REFERENCE.md # مرجع API
│ ├── TROUBLESHOOTING.md # استكشاف الأخطاء
│ └── EXAMPLES.md # أمثلة متقدمة
└── src/
├── blender_handler.py # معالج Blender
├── command_parser.py # محلل الأوامر
└── utils.py # دوال مساعدة
from client import MCPClient
client = MCPClient('localhost', 5000)
# إنشاء مكعب
client.send_command('create_primitive', {'type': 'cube', 'name': 'cube1'})
# تعديل الموقع
client.send_command('set_object_property', {
'object_name': 'cube1',
'location': [2, 0, 0]
})
# تطبيق لون أحمر
client.send_command('apply_material', {
'object_name': 'cube1',
'color': [1, 0, 0]
})# إنشاء عدة كائنات
for i in range(5):
client.send_command('create_primitive', {
'type': 'sphere',
'name': f'sphere_{i}',
'scale': 0.5 + i * 0.1
})
client.send_command('set_object_property', {
'object_name': f'sphere_{i}',
'location': [i * 3, 0, 0]
})
# تصدير النموذج
client.send_command('export_scene', {
'format': 'glb',
'filepath': './models/scene.glb'
})الحل: تأكد من تشغيل الخادم:
python server.pyالحل: تثبيت المكتبات:
pip install -r requirements.txtالحل: تعديل config.json وتحديد مسار Blender:
{
"blender_path": "/path/to/blender"
}نرحب بمساهماتك! يرجى:
- Fork المستودع
- إنشاء فرع جديد (
git checkout -b feature/amazing-feature) - Commit التغييرات (
git commit -m 'إضافة ميزة رائعة') - Push إلى الفرع (
git push origin feature/amazing-feature) - فتح Pull Request
هذا المشروع مرخص تحت MIT License - انظر الملف للتفاصيل.
- 🐙 GitHub: @khalidSAT
- 💬 Issues: GitHub Issues
صُنع بـ ❤️ بواسطة khalidSAT