blender-open-mcp
AGENTS.md119 starsChanged 3 months agoMITView on GitHub
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
Flat tool signatures: Every @mcp.tool function takes explicit keyword parameters (no params: X wrapper objects).
- Very specific: line 78
Do not expose secrets: _redact_state() masks the API key.
- Very specific: line 80
Keep legacy aliases (blender_set_ollama_*) working unless intentionally deprecating them in a major release.
- Very specific: line 84
Run: .venv/Scripts/python -m pytest tests -q (Windows bash) or python -m pytest tests -q.
- Very specific: line 98
When adding an MCP prompt, mirror the pattern in prompts.py and register it there.
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Blender Open MCP — AGENTS.md
Project Overview
blender-open-mcp is a local-first MCP (Model Context Protocol) server for controlling a live Blender session, with a provider-agnostic LLM backend. The same codebase talks to Ollama, LM Studio, llama.cpp server, OpenAI, Azure AI Foundry, and any OpenAI-compatible endpoint. Providers can be set at startup (CLI/env) and switched at runtime through MCP tools.
Repository Layout
addon.py— single-file Blender add-on. Registers operators/panel, runs a TCP server (defaultlocalhost:9876) that receives newline-delimited JSON commands ({"type": ..., "params": {...}}) and dispatches to handlers inHANDLERS. Handlers cover scene info, object create/modify/delete, materials, rendering, code execution, and PolyHaven download/set-texture.src/blender_open_mcp/server.py— MCP server. Registers allblender_*tools with flat signatures, owns the Blender TCP bridge (_send_blender_command), the runtime LLM state (_llm_state), and the CLI (main()).llm.py— provider layer:PROVIDERSregistry +PROVIDER_ALIASES,resolve_provider(),chat(),list_models(),ProviderError. Add new backends here.client/— canonical async MCP client (BlenderMCPClient) + CLI.prompts.py— MCP Prompts (blender_build_scene,blender_review_scene,blender_configure_llm) registered viaregister_prompts(mcp).__init__.py— exportsmain.
client/— compat wrapper so legacyfrom client import …imports work from source; it bootstrapssrc/ontosys.pathand re-exports the canonical module.tests/— pytest suites:test_server.py,test_client.py,test_addon.py(bpy mocked).pyproject.toml— hatchling build, deps,blender-mcp/blender-mcp-clientconsole scripts, pytest config..venv/— local virtualenv used for development/testing (gitignored).
Key Design Decisions
- Flat tool signatures. Every
@mcp.toolfunction takes explicit keyword parameters (noparams: Xwrapper objects). FastMCP 4 advertises whatever the signature says, so standard MCP clients can call tools with top-level args. Never reintroduce single-wrapper-model signatures for tools. - Provider-agnostic routing.
_query_llm()inserver.pyfills missing provider fields from_llm_stateand delegates tollm.chat(). Per-call overrides (provider/base_url/model/api_key) are supported onblender_ai_prompt. - Runtime provider switching.
blender_set_llm_providermutates_llm_state;blender_get_llm_providerreports it (API key masked);blender_list_llm_modelslists models. Ollama-only aliases (blender_set_ollama_model,blender_set_ollama_url,blender_get_ollama_models) are thin wrappers for backward compatibility. - Blender bridge protocol. Server sends
{"type": "<handler>", "params": {...}}\nover TCP and reads one JSON response line:{"status":"ok","result":...}or{"status":"error","message":...}.
Conventions
- Python ≥ 3.10, type hints throughout, stdlib
typing(Dict,List,Optional) — do not rely on newer 3.11+ syntax unless guarded. - Imports for external MCP machinery:
from fastmcp import FastMCP(the project runs fastmcp 4 + mcp 2;mcp.server.fastmcpno longer exists). - Tool annotations are passed to
@mcp.tool(annotations={...})and use the keysreadOnlyHint,destructiveHint,idempotentHint,openWorldHint,title. - Provider specs go in
llm.pyPROVIDERS(style:openai,ollama,azure) plus an alias inPROVIDER_ALIASES; URL/payload/response normalization lives inllm.py, never inserver.pytool bodies. - Errors returned to agents are friendly strings starting with
Error: ...(see_handle_blender_error/_handle_provider_error); exceptions are caught inside tools, not propagated.
Safe Refactoring Rules
- Changing an MCP tool signature means updating:
- the
@mcp.toolfunction inserver.py, - any typed wrapper in
src/blender_open_mcp/client/client.py, - tests that call it.
- the
- Adding a Blender-side handler requires: new handler function in
addon.py, registration inaddon.HANDLERS, and ablender_*tool inserver.pythat calls_send_blender_command("<handler_name>", ...). - Do not expose secrets:
_redact_state()masks the API key; keep that mask when adding state-reporting tools. - Keep legacy aliases (
blender_set_ollama_*) working unless intentionally deprecating them in a major release.
Testing
- Run:
.venv/Scripts/python -m pytest tests -q(Windows bash) orpython -m pytest tests -q. - Server tests mock
httpxand exercise_query_llmfor openai / ollama / lmstudio / llamacpp, provider state switching, tool registration/annotations, and PolyHaven pagination — all without Blender. - Addon tests mock
bpyat import time (seetests/test_addon.py) and test handlers/dispatch directly; they don't start a TCP server. - Client tests mock the MCP HTTP layer.
tests/test_integration.pyproves the wiring: an in-processfastmcp.Clientagainst the server (tools + prompts), and the realaddon.pyTCP loop driven over a socket by the server bridge.- Manual end-to-end: start the add-on in Blender, run
blender-mcp --transport http, thenblender-mcp-client --host http://localhost:8000 tool blender_get_scene_info. - When adding an MCP prompt, mirror the pattern in
prompts.pyand register it there; updatetests/test_integration.pyexpectations if the prompt set is part of a contract.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

