[{"data":1,"prerenderedAt":1175},["ShallowReactive",2],{"post-how-to-use-freecad-opencode-mcp-en":3,"related-posts-how-to-use-freecad-opencode-mcp-en":1165,"related-categories-how-to-use-freecad-opencode-mcp-en":1174},{"id":4,"title":5,"author":6,"authorImageUrl":7,"authorUrl":8,"body":9,"categorySlug":1132,"categoryText":1133,"dateModified":1134,"datePublished":1134,"description":1135,"extension":1136,"faqs":1137,"image":1153,"language":1154,"meta":1155,"navigation":1156,"path":1157,"seo":1158,"sitemap":1159,"stem":1160,"tags":1161,"__hash__":1164},"blog\u002Fblog\u002Fhow-to-use-freecad-opencode-mcp.md","How to Use FreeCAD with OpenCode and MCP","Bruma","\u002Fimages\u002Fauthors\u002Fbruma.jpg","https:\u002F\u002Fbrumaombra.com",{"type":10,"value":11,"toc":1109},"minimark",[12,17,32,35,38,41,44,55,58,61,65,68,72,83,88,91,97,104,109,112,115,118,122,128,133,141,144,147,150,153,156,160,175,184,187,191,194,196,200,203,206,232,238,252,255,263,266,268,272,285,288,294,304,311,317,320,326,329,334,341,344,348,362,368,383,393,395,399,402,408,414,438,441,460,471,483,489,507,509,513,524,527,533,536,550,711,725,727,731,747,750,759,784,793,799,802,810,812,816,819,825,839,846,850,853,855,859,862,865,871,890,894,897,903,914,917,923,926,928,932,944,947,953,956,962,965,972,974,978,981,984,1001,1011,1013,1017,1024,1027,1030,1033,1035,1039,1056,1059,1062,1074,1077,1083,1096,1102,1105],[13,14,16],"h2",{"id":15},"introduction","Introduction",[18,19,20,31],"p",{},[21,22,27],"a",{"href":23,"rel":24,"target":26},"https:\u002F\u002Fwww.freecad.org\u002F",[25],"nofollow","_blank",[28,29,30],"strong",{},"FreeCAD"," is undoubtedly one of the most powerful parametric CAD applications out there, but sometimes building a model from scratch with it can involve a lot of repetitive work, searching for features online, and a bunch of undos... a lot of them!",[18,33,34],{},"You select a workbench, create a document, add sketches, apply constraints, create features, inspect the tree, and repeat the process until the result is correct. A bit cumbersome, no?",[18,36,37],{},"But what if you could describe the part you want to build and let a coding agent help you create it inside FreeCAD just like you do with code?",[18,39,40],{},"That would be extremely cool, don't you think?",[18,42,43],{},"Well, you're definitely in the right place, as this is exactly what we're going to explain in this guide.",[18,45,46,47,54],{},"That is the idea behind the ",[21,48,51],{"href":49,"rel":50,"target":26},"https:\u002F\u002Fgithub.com\u002Fneka-nat\u002Ffreecad-mcp",[25],[28,52,53],{},"FreeCAD MCP server",", an open-source project that lets you connect FreeCAD to an MCP-compatible AI client, so we can control it directly through natural-language prompts!",[18,56,57],{},"The goal is not to replace CAD knowledge or blindly accept generated geometry, but to make the human-machine interaction more conversational and programmable. We can ask the agent to create a document, generate a simple part, inspect the object tree, change a dimension, or explain why a feature failed, just like we would do with a human being!",[59,60],"hr",{},[13,62,64],{"id":63},"what-we-need","What We Need",[18,66,67],{},"First, let's start by listing everything we need for this little project:",[69,70],"blog-list",{":items":71},"[\"A recent FreeCAD installation.\",\"Python and uv installed so OpenCode can launch the MCP server.\",\"OpenCode installed and configured with an AI provider.\",\"The neka-nat FreeCAD MCP repository.\",\"A basic understanding of the FreeCAD interface and parametric modeling.\"]",[18,73,74,75,82],{},"The easiest arrangement for this project is to run FreeCAD and ",[21,76,79],{"href":77,"rel":78,"target":26},"https:\u002F\u002Fopencode.ai\u002F",[25],[28,80,81],{},"OpenCode"," on the same machine. In that setup, the MCP server can use the default local connection, and we don't need to expose FreeCAD to the network or edit complex configurations.",[84,85,87],"h3",{"id":86},"why-freecad","Why FreeCAD",[18,89,90],{},"Okay, but why FreeCAD instead of another popular 3D CAD solution?",[18,92,93,94,96],{},"I decided to use ",[28,95,30],{}," simply because it's fully open-source and completely free, without obscure licensing rules or weird company headcount policies. Do you want to create a 3D project for yourself, your family, or your million-employee company? No problem, no license needed!",[18,98,99],{},[100,101],"img",{"alt":102,"src":103},"FreeCAD open-source parametric 3D modeling features","\u002Fimages\u002Fblog\u002Ffreecad-opencode\u002Ffreecad-infos.png",[18,105,106,108],{},[28,107,30],{}," gives us all the tools we need to create precise parts, assemblies, technical drawings, and more while keeping dimensions, sketches, and relationships editable.",[18,110,111],{},"Unlike a simple drawing program, FreeCAD remembers how the model was built. If we change the length of a sketch, the position of a hole, or the thickness of a feature, the rest of the model can update according to those relationships instead of forcing us to redraw everything manually!",[18,113,114],{},"FreeCAD organizes its tools into different workbenches, so we can choose only the set of features that makes sense for the task at hand, making the creation process much easier and more streamlined.",[18,116,117],{},"Another very cool feature of FreeCAD is that its behavior can be extended through addons and scripts, making it the perfect choice for experimenting with an AI coding agent while still keeping control of the design and the files we create.",[84,119,121],{"id":120},"why-opencode","Why OpenCode",[18,123,124,125,127],{},"For the agent part, I decided to use ",[28,126,81],{},".",[18,129,130,132],{},[28,131,81],{}," is a very popular coding agent, and given its open-source nature, it fits perfectly with FreeCAD.",[18,134,135],{},[100,136],{"alt":137,"src":138,"height":139,"width":140},"OpenCode AI coding agent capabilities","\u002Fimages\u002Fblog\u002Ffreecad-opencode\u002Fopencode-infos.png",941,1672,[18,142,143],{},"With the available models, it can understand natural-language requests, plan a sequence of actions, and use connected tools to help complete a task. You can use OpenCode with your current favourite LLM or AI subscription, such as GitHub Copilot, or connect it to an external API-based platform like OpenRouter.",[18,145,146],{},"Instead of treating the terminal as a place where we must type every command perfectly, we can describe what we want to accomplish and let the agent help us choose the next steps.",[18,148,149],{},"In our specific case, OpenCode gives us a conversational way to ask FreeCAD to create documents, build models, inspect objects, and clearly explain how it accomplished those objectives.",[18,151,152],{},"We can describe the result we want in plain language, then review the agent's work and ask for a specific change when something needs correcting. OpenCode can also report tool responses back to us, which means we can ask it to check the document tree, verify dimensions, or take a screenshot before making another decision.",[18,154,155],{},"Because it is open-source, we can inspect its project, configure it locally, and connect it to tools such as the FreeCAD MCP server instead of relying only on a closed, fixed workflow.",[84,157,159],{"id":158},"why-use-an-mcp-server","Why use an MCP server?",[18,161,162,163,170,171,174],{},"The ",[21,164,167],{"href":165,"rel":166,"target":26},"https:\u002F\u002Fmodelcontextprotocol.io\u002F",[25],[28,168,169],{},"Model Context Protocol",", or ",[28,172,173],{},"MCP"," for short, gives an AI client a standard way to discover and call external tools that can provide context for LLM calls.",[18,176,177,178,180,181,183],{},"Instead of controlling FreeCAD through screen clicks and mouse movements, ",[28,179,81],{}," can call the tools exposed by the ",[28,182,53],{}," directly, enabling it to control the CAD software through an AI-friendly API.",[18,185,186],{},"The FreeCAD MCP project we'll use in this guide provides tools for tasks such as these:",[69,188],{":items":189,"variant":190},"[\"Creating and opening FreeCAD documents.\",\"Creating, editing, and deleting FreeCAD objects.\",\"Executing Python code inside FreeCAD.\",\"Inspecting objects and the document tree.\",\"Requesting a screenshot of the current view.\",\"Inserting parts from the FreeCAD parts library.\"]","circle",[18,192,193],{},"This gives the agent a useful feedback loop. It can make a change, inspect the result, and adjust its next action instead of only writing code that we have to paste manually. Pretty useful, right?",[59,195],{},[13,197,199],{"id":198},"_1-download-the-freecad-mcp","1. Download the FreeCAD MCP",[18,201,202],{},"Okay, the first thing we're going to do is download the official repository created by the amazing neka-nat.",[18,204,205],{},"To do that, open a terminal, move to a directory of your choice, and run the following command:",[207,208,213],"pre",{"className":209,"code":210,"language":211,"meta":212,"style":212},"language-bash shiki shiki-themes github-light github-dark","git clone https:\u002F\u002Fgithub.com\u002Fneka-nat\u002Ffreecad-mcp.git\n","bash","",[214,215,216],"code",{"__ignoreMap":212},[217,218,221,225,229],"span",{"class":219,"line":220},"line",1,[217,222,224],{"class":223},"sScJk","git",[217,226,228],{"class":227},"sZZnC"," clone",[217,230,231],{"class":227}," https:\u002F\u002Fgithub.com\u002Fneka-nat\u002Ffreecad-mcp.git\n",[18,233,234],{},[100,235],{"alt":236,"src":237},"FreeCAD MCP repository cloned in the Documents folder","\u002Fimages\u002Fblog\u002Ffreecad-opencode\u002Ffreecad-mcp-download.png",[18,239,240,241,244,245,248,249,251],{},"The repository contains both the ",[28,242,243],{},"Python MCP server"," and the ",[28,246,247],{},"FreeCAD addon",". Keep the repository in a stable location because ",[28,250,81],{}," will use its path when it starts the server.",[18,253,254],{},"On Windows, I suggest keeping it inside your Documents folder. For example, you could use:",[207,256,261],{"className":257,"code":259,"language":260,"meta":212},[258],"language-text","C:\\Users\\YourName\\Documents\\freecad-mcp\n","text",[214,262,259],{"__ignoreMap":212},[18,264,265],{},"If you use a different location, don't worry. We just need to replace the example path in the OpenCode configuration later in this guide.",[59,267],{},[13,269,271],{"id":270},"_2-install-the-freecad-addon","2. Install the FreeCAD addon",[18,273,162,274,277,278,280,281,284],{},[28,275,276],{},"MCP server"," also needs an addon installed in ",[28,279,30],{},". The official repository contains everything we need in the ",[214,282,283],{},"addon\u002FFreeCADMCP"," directory.",[18,286,287],{},"On Windows, FreeCAD 1.1 uses the following version-specific addon directory:",[207,289,292],{"className":290,"code":291,"language":260,"meta":212},[258],"C:\\Users\\YourName\\AppData\\Roaming\\FreeCAD\\v1-1\\Mod\\FreeCADMCP\n",[214,293,291],{"__ignoreMap":212},[18,295,296,297,300,301,127],{},"To install the addon, open the cloned repository and copy the ",[28,298,299],{},"FreeCADMCP"," folder from ",[214,302,303],{},"addon",[18,305,306,307,310],{},"Then paste it into the following FreeCAD folder. Create the ",[214,308,309],{},"Mod"," folder if it does not exist yet:",[207,312,315],{"className":313,"code":314,"language":260,"meta":212},[258],"C:\\Users\\YourName\\AppData\\Roaming\\FreeCAD\\v1-1\\Mod\n",[214,316,314],{"__ignoreMap":212},[18,318,319],{},"In short, copy the following folder:",[207,321,324],{"className":322,"code":323,"language":260,"meta":212},[258],"C:\\Users\\YourName\\Documents\\freecad-mcp\\addon\\FreeCADMCP\n",[214,325,323],{"__ignoreMap":212},[18,327,328],{},"into this folder:",[207,330,332],{"className":331,"code":314,"language":260,"meta":212},[258],[214,333,314],{"__ignoreMap":212},[18,335,336,337,340],{},"Older FreeCAD versions may use the ",[214,338,339],{},"C:\\Users\\YourName\\AppData\\Roaming\\FreeCAD\\Mod"," folder for addons. Use the directory that matches the version-specific folder created by your FreeCAD installation.",[18,342,343],{},"After copying the addon, restart FreeCAD if it was already open. The repository also documents addon locations for Linux and macOS if you're using another operating system.",[84,345,347],{"id":346},"select-the-mcp-addon-workbench","Select the MCP Addon workbench",[18,349,350,351,353,354,357,358,361],{},"After restarting ",[28,352,30],{},", open the workbench selector and choose ",[28,355,356],{},"MCP Addon",". We should now see the ",[28,359,360],{},"FreeCAD MCP"," toolbar or menu.",[18,363,364],{},[100,365],{"alt":366,"src":367},"FreeCAD MCP workbench and RPC server controls","\u002Fimages\u002Fblog\u002Ffreecad-opencode\u002Ffreecad-mcp-addon.png",[18,369,370,371,374,375,377,378,380,381,127],{},"Click ",[28,372,373],{},"Start RPC Server"," to start the local bridge. The ",[28,376,276],{}," launched by ",[28,379,81],{}," will use this bridge to communicate with ",[28,382,30],{},[18,384,385,386,388,389,392],{},"The RPC server normally needs to be started each time FreeCAD opens. If you want it to start automatically, open the ",[28,387,360],{}," menu and enable ",[28,390,391],{},"Auto-Start Server",". The setting is saved by the addon and persists across sessions.",[59,394],{},[13,396,398],{"id":397},"_3-install-opencode","3. Install OpenCode",[18,400,401],{},"The next step is to install OpenCode.",[18,403,404],{},[100,405],{"alt":406,"src":407},"OpenCode installation page","\u002Fimages\u002Fblog\u002Ffreecad-opencode\u002Fopencode-website.jpg",[18,409,410,411,413],{},"We can install ",[28,412,81],{}," using the official installer with the following Bash command:",[207,415,417],{"className":209,"code":416,"language":211,"meta":212,"style":212},"curl -fsSL https:\u002F\u002Fopencode.ai\u002Finstall | bash\n",[214,418,419],{"__ignoreMap":212},[217,420,421,424,428,431,435],{"class":219,"line":220},[217,422,423],{"class":223},"curl",[217,425,427],{"class":426},"sj4cs"," -fsSL",[217,429,430],{"class":227}," https:\u002F\u002Fopencode.ai\u002Finstall",[217,432,434],{"class":433},"szBVR"," |",[217,436,437],{"class":223}," bash\n",[18,439,440],{},"If, like me, you prefer using npm, you can use the following command instead:",[207,442,444],{"className":209,"code":443,"language":211,"meta":212,"style":212},"npm i -g opencode-ai\n",[214,445,446],{"__ignoreMap":212},[217,447,448,451,454,457],{"class":219,"line":220},[217,449,450],{"class":223},"npm",[217,452,453],{"class":227}," i",[217,455,456],{"class":426}," -g",[217,458,459],{"class":227}," opencode-ai\n",[18,461,462,463,466,467,470],{},"After the installation finishes, open a new terminal so the ",[214,464,465],{},"opencode"," command is available in your ",[214,468,469],{},"PATH",". Let's check that it works:",[207,472,474],{"className":209,"code":473,"language":211,"meta":212,"style":212},"opencode --version\n",[214,475,476],{"__ignoreMap":212},[217,477,478,480],{"class":219,"line":220},[217,479,465],{"class":223},[217,481,482],{"class":426}," --version\n",[18,484,485],{},[100,486],{"alt":487,"src":488},"OpenCode version command output","\u002Fimages\u002Fblog\u002Ffreecad-opencode\u002Fopencode-version.png",[18,490,491,492,495,496,498,499,506],{},"You will also need to configure an ",[28,493,494],{},"AI provider"," before ",[28,497,81],{}," can act as a coding agent. If this is your first OpenCode installation, follow the ",[21,500,503],{"href":501,"rel":502,"target":26},"https:\u002F\u002Fopencode.ai\u002Fdocs\u002F",[25],[28,504,505],{},"OpenCode documentation"," for the provider setup.",[59,508],{},[13,510,512],{"id":511},"_4-configure-opencode","4. Configure OpenCode",[18,514,515,516,519,520,523],{},"OpenCode reads its project configuration from an ",[214,517,518],{},"opencode.json"," or ",[214,521,522],{},"opencode.jsonc"," file. We can place this file in the root of a project or use the global OpenCode configuration if we want FreeCAD to be available everywhere.",[18,525,526],{},"On Windows, the global configuration file is usually located here:",[207,528,531],{"className":529,"code":530,"language":260,"meta":212},[258],"C:\\Users\\YourName\\.config\\opencode\\opencode.json\n",[214,532,530],{"__ignoreMap":212},[18,534,535],{},"If the directory or file does not exist yet, create it before adding the configuration.",[18,537,538,539,542,543,545,546,549],{},"Now create or edit the ",[28,540,541],{},"OpenCode configuration"," and add the ",[28,544,53],{}," under the ",[214,547,548],{},"mcp"," key as shown below:",[207,551,555],{"className":552,"code":553,"language":554,"meta":212,"style":212},"language-json shiki shiki-themes github-light github-dark","{\n    \"$schema\": \"https:\u002F\u002Fopencode.ai\u002Fconfig.json\",\n    \"mcp\": {\n        \"freecad\": {\n            \"type\": \"local\",\n            \"command\": [\n                \"uv\",\n                \"--directory\",\n                \"C:\\\\Users\\\\YourName\\\\Documents\\\\freecad-mcp\",\n                \"run\",\n                \"freecad-mcp\"\n            ],\n            \"enabled\": true\n        }\n    }\n}\n","json",[214,556,557,563,578,587,595,608,617,625,633,662,670,676,682,693,699,705],{"__ignoreMap":212},[217,558,559],{"class":219,"line":220},[217,560,562],{"class":561},"sVt8B","{\n",[217,564,566,569,572,575],{"class":219,"line":565},2,[217,567,568],{"class":426},"    \"$schema\"",[217,570,571],{"class":561},": ",[217,573,574],{"class":227},"\"https:\u002F\u002Fopencode.ai\u002Fconfig.json\"",[217,576,577],{"class":561},",\n",[217,579,581,584],{"class":219,"line":580},3,[217,582,583],{"class":426},"    \"mcp\"",[217,585,586],{"class":561},": {\n",[217,588,590,593],{"class":219,"line":589},4,[217,591,592],{"class":426},"        \"freecad\"",[217,594,586],{"class":561},[217,596,598,601,603,606],{"class":219,"line":597},5,[217,599,600],{"class":426},"            \"type\"",[217,602,571],{"class":561},[217,604,605],{"class":227},"\"local\"",[217,607,577],{"class":561},[217,609,611,614],{"class":219,"line":610},6,[217,612,613],{"class":426},"            \"command\"",[217,615,616],{"class":561},": [\n",[217,618,620,623],{"class":219,"line":619},7,[217,621,622],{"class":227},"                \"uv\"",[217,624,577],{"class":561},[217,626,628,631],{"class":219,"line":627},8,[217,629,630],{"class":227},"                \"--directory\"",[217,632,577],{"class":561},[217,634,636,639,642,645,647,650,652,655,657,660],{"class":219,"line":635},9,[217,637,638],{"class":227},"                \"C:",[217,640,641],{"class":426},"\\\\",[217,643,644],{"class":227},"Users",[217,646,641],{"class":426},[217,648,649],{"class":227},"YourName",[217,651,641],{"class":426},[217,653,654],{"class":227},"Documents",[217,656,641],{"class":426},[217,658,659],{"class":227},"freecad-mcp\"",[217,661,577],{"class":561},[217,663,665,668],{"class":219,"line":664},10,[217,666,667],{"class":227},"                \"run\"",[217,669,577],{"class":561},[217,671,673],{"class":219,"line":672},11,[217,674,675],{"class":227},"                \"freecad-mcp\"\n",[217,677,679],{"class":219,"line":678},12,[217,680,681],{"class":561},"            ],\n",[217,683,685,688,690],{"class":219,"line":684},13,[217,686,687],{"class":426},"            \"enabled\"",[217,689,571],{"class":561},[217,691,692],{"class":426},"true\n",[217,694,696],{"class":219,"line":695},14,[217,697,698],{"class":561},"        }\n",[217,700,702],{"class":219,"line":701},15,[217,703,704],{"class":561},"    }\n",[217,706,708],{"class":219,"line":707},16,[217,709,710],{"class":561},"}\n",[18,712,713,714,717,718,721,722,724],{},"Replace ",[214,715,716],{},"C:\\\\Users\\\\YourName\\\\Documents\\\\freecad-mcp"," with the actual path to your clone. JSON paths use escaped backslashes, so a Windows path such as ",[214,719,720],{},"C:\\Users\\YourName\\Documents\\freecad-mcp"," must be written as ",[214,723,716],{}," inside the JSON file.",[59,726],{},[13,728,730],{"id":729},"_5-start-opencode","5. Start OpenCode",[18,732,733,734,736,737,739,740,742,743,746],{},"Before launching ",[28,735,81],{},", let's confirm that ",[28,738,30],{}," is open, the ",[28,741,356],{}," workbench is selected, and the ",[28,744,745],{},"RPC server"," is running.",[18,748,749],{},"If everything looks good, start OpenCode from the directory containing the configuration:",[207,751,753],{"className":209,"code":752,"language":211,"meta":212,"style":212},"opencode\n",[214,754,755],{"__ignoreMap":212},[217,756,757],{"class":219,"line":220},[217,758,752],{"class":223},[18,760,761,763,764,767,768,770,771,773,774,777,778,780,781,127],{},[28,762,81],{}," should discover the ",[214,765,766],{},"freecad"," ",[28,769,276],{}," during startup. If the server does not appear, check the path in ",[214,772,518],{},", confirm that ",[214,775,776],{},"uv"," is available in your ",[214,779,469],{},", and inspect the ",[28,782,783],{},"OpenCode MCP server status",[18,785,786,787,789,790,792],{},"We can also ask ",[28,788,81],{}," whether it can access the ",[28,791,360],{}," with a simple prompt:",[207,794,797],{"className":795,"code":796,"language":260,"meta":212},[258],"Do you have access to the FreeCAD MCP?\n",[214,798,796],{"__ignoreMap":212},[18,800,801],{},"Don't begin with a complex CAD project. A small connectivity test makes it much easier to determine whether a later problem comes from OpenCode, the MCP server, or FreeCAD itself.",[18,803,804,805,807,808,127],{},"If the response is positive, congratulations! ",[28,806,81],{}," is now successfully connected to the ",[28,809,360],{},[59,811],{},[13,813,815],{"id":814},"_6-create-the-first-project","6. Create the first project",[18,817,818],{},"Okay, let's continue with a slightly more detailed request:",[207,820,823],{"className":821,"code":822,"language":260,"meta":212},[258],"Use the freecad MCP server to create a new document named AgentTest, then list the objects in the document.\n",[214,824,822],{"__ignoreMap":212},[18,826,827,828,831,832,835,836,127],{},"The agent should call ",[214,829,830],{},"create_document"," and then ",[214,833,834],{},"get_objects",". Depending on the server settings, the response may also include a screenshot of the ",[28,837,838],{},"FreeCAD view",[18,840,841,842,845],{},"If the request succeeds, you have confirmed the full ",[28,843,844],{},"connection chain",":",[69,847],{":items":848,"variant":849},"[\"OpenCode can see the configured MCP server.\",\"The MCP server can connect to the FreeCAD RPC bridge.\",\"The FreeCAD addon can receive and process a request.\",\"The agent can read a result back from FreeCAD.\"]","numbered",[18,851,852],{},"Great! At this point, save the document manually or ask the agent to save it using FreeCAD Python. Keeping this first test document is useful when troubleshooting later.",[59,854],{},[13,856,858],{"id":857},"_7-create-a-simple-parametric-part","7. Create a simple parametric part",[18,860,861],{},"Once the connection works, we can ask the agent to create a small model with explicit dimensions. A simple plate with four holes is a good first project because it has clear geometry and is easy to inspect.",[18,863,864],{},"For example, we can use a prompt like this:",[207,866,869],{"className":867,"code":868,"language":260,"meta":212},[258],"Use the freecad MCP tools to create a new document containing a parametric rectangular plate.\n\nRequirements:\n- The plate should be 100 mm long, 60 mm wide, and 8 mm thick.\n- Add four through-holes with a diameter of 6 mm.\n- Place the holes symmetrically, 10 mm from the nearest two edges.\n- Use meaningful object names.\n- Recompute the document and report the objects and final dimensions.\n- Do not overwrite any existing document.\n",[214,870,868],{"__ignoreMap":212},[18,872,873,874,877,878,881,882,885,886,889],{},"The exact implementation is up to the agent. It may create ",[28,875,876],{},"Part primitives",", use a ",[28,879,880],{},"sketch"," and a ",[28,883,884],{},"pad",", or execute ",[28,887,888],{},"FreeCAD Python"," that builds the shape. The important part is to state the dimensions, constraints, naming expectations, and safety boundaries clearly.",[84,891,893],{"id":892},"inspect-the-result","Inspect the result",[18,895,896],{},"After the model is created, let's ask the agent to inspect it instead of immediately requesting another feature:",[207,898,901],{"className":899,"code":900,"language":260,"meta":212},[258],"Inspect the current FreeCAD document with the freecad MCP tools. List every object, its type, its dimensions, and any visible errors. Take an isometric view screenshot if available.\n",[214,902,900],{"__ignoreMap":212},[18,904,905,906,909,910,913],{},"This is where the ",[28,907,908],{},"MCP workflow"," becomes more useful than one-shot code generation. We can compare the agent's report with the ",[28,911,912],{},"FreeCAD tree"," and viewport, then ask for a targeted correction.",[18,915,916],{},"For example, if the holes are not in the right place, we can say:",[207,918,921],{"className":919,"code":920,"language":260,"meta":212},[258],"The plate looks correct, but the holes are not symmetric around the center. Inspect the model and move only the hole locations so the four hole centers are 10 mm from the corresponding edges. Preserve the plate thickness and hole diameter.\n",[214,922,920],{"__ignoreMap":212},[18,924,925],{},"Use precise change requests. Asking the agent to \"make it look better\" gives it too much freedom and makes the result harder to review.",[59,927],{},[13,929,931],{"id":930},"_8-work-with-freecad-python","8. Work with FreeCAD Python",[18,933,162,934,937,938,940,941,943],{},[214,935,936],{},"execute_code"," tool lets the agent run Python inside ",[28,939,30],{},". This is a really powerful feature, because ",[28,942,30],{}," exposes much of its modeling functionality through Python, but it also means that we should review the generated code before allowing it to make important changes.",[18,945,946],{},"Let's start with a safe exploratory request:",[207,948,951],{"className":949,"code":950,"language":260,"meta":212},[258],"Use execute_code only to inspect the active document. Return the document name and a list of object names and types. Do not create, delete, or modify anything.\n",[214,952,950],{"__ignoreMap":212},[18,954,955],{},"For a controlled modeling task, ask the agent to explain the intended operations first:",[207,957,960],{"className":958,"code":959,"language":260,"meta":212},[258],"Before executing code, describe the FreeCAD objects and operations you plan to use to create the plate. Wait for confirmation before modifying the document.\n",[214,961,959],{"__ignoreMap":212},[18,963,964],{},"This extra step is useful when we're learning the API or working with a model that contains valuable design work.",[18,966,967,968,971],{},"Remember that ",[28,969,970],{},"FreeCAD operations"," can have dependencies. Deleting or changing an object may affect sketches, pads, cuts, or downstream features. A model that looks correct in one screenshot may still contain fragile or incorrect parametric relationships.",[59,973],{},[13,975,977],{"id":976},"troubleshooting","Troubleshooting",[18,979,980],{},"When something fails, here's a quick checklist to follow:",[69,982],{":items":983},"[\"If OpenCode cannot find the server, check the mcp key, server name, command array, and path in opencode.json.\",\"If uv fails to start, install uv and confirm that the command is available in the terminal used to launch OpenCode.\",\"If the server starts but FreeCAD does not respond, open FreeCAD, select the MCP Addon workbench, and start or restart the RPC server.\",\"If a tool reports a GUI dispatch problem, use get_rpc_status and wait for FreeCAD to return to a healthy state before sending another GUI request.\",\"If generated geometry is wrong, inspect the document tree and dimensions before asking the agent to make a targeted correction.\"]",[18,985,162,986,989,990,993,994,997,998,1000],{},[28,987,988],{},"FreeCAD MCP project"," warns that ",[28,991,992],{},"GUI operations"," cannot always be force-cancelled safely. If a GUI operation becomes stuck, sending more GUI requests can make the situation worse. Check the ",[28,995,996],{},"RPC status"," and restart ",[28,999,30],{}," when necessary.",[18,1002,1003,1004,1006,1007,1010],{},"If ",[214,1005,936],{}," raises an exception while creating a ",[214,1008,1009],{},"FeaturePython"," object, inspect the new object before trying to change or delete it. A partially created object may not have the expected proxy installed.",[59,1012],{},[13,1014,1016],{"id":1015},"practical-advice","Practical advice",[18,1018,1019,1020,1023],{},"An ",[28,1021,1022],{},"AI coding agent"," is most useful when we treat it as a capable collaborator whose work needs review. Give it measurable requirements, ask it to inspect the result, and keep changes small enough to undo.",[18,1025,1026],{},"For repeatable work, describe dimensions and constraints rather than only the visual appearance. \"Create a 100 mm by 60 mm plate with four 6 mm holes\" is much more useful than \"make a small mounting plate.\"",[18,1028,1029],{},"It is also a good habit to save versions of our FreeCAD files before larger edits. Parametric models can contain hidden dependencies, and an apparently small change can invalidate a later feature.",[18,1031,1032],{},"Finally, remember that generated CAD is not automatically safe to manufacture. Check the units, tolerances, wall thicknesses, fastener clearances, material assumptions, and export settings yourself. The agent can accelerate the design process, but engineering responsibility remains with the person approving the model.",[59,1034],{},[13,1036,1038],{"id":1037},"conclusion","Conclusion",[18,1040,1041,1042,1044,1045,1048,1049,1051,1052,1055],{},"We're finally at the end of this journey! ",[28,1043,360],{}," makes it possible to connect a running FreeCAD session to an ",[28,1046,1047],{},"MCP-compatible agent",". With ",[28,1050,81],{},", we can describe a modeling task in natural language, let the agent create or modify ",[28,1053,1054],{},"FreeCAD objects",", inspect the result, and iterate with targeted instructions.",[18,1057,1058],{},"Here's a quick recap of what we've done so far:",[69,1060],{":items":1061,"variant":849},"[\"Clone the FreeCAD MCP repository.\",\"Install the FreeCADMCP addon and restart FreeCAD.\",\"Start the FreeCAD RPC server.\",\"Add the FreeCAD MCP server to OpenCode's configuration.\",\"Test the connection with a new document and object listing.\",\"Create a small, measurable part and inspect it carefully.\"]",[18,1063,1064,1065,244,1069,127],{},"For more advanced examples and the latest installation details, see the ",[21,1066,1068],{"href":49,"rel":1067,"target":26},[25],"FreeCAD MCP repository",[21,1070,1073],{"href":1071,"rel":1072,"target":26},"https:\u002F\u002Fopencode.ai\u002Fdocs\u002Fmcp-servers\u002F",[25],"OpenCode MCP documentation",[18,1075,1076],{},"If your connection test worked and the agent created your first part, congratulations! You now have a conversational bridge between OpenCode and FreeCAD, and you can start experimenting with your own parametric models!",[18,1078,1079,1080,1082],{},"Remember to keep FreeCAD, the FreeCAD MCP repository, OpenCode, and ",[214,1081,776],{}," up to date so the setup continues to work reliably. Before making important changes, save a copy of your model and always review generated geometry before using it in a real project.",[18,1084,1085,1086,1090,1091,1095],{},"If you enjoy practical, open-source projects like this one, you may also want to explore our guide to ",[21,1087,1089],{"href":1088},"\u002Fblog\u002Fhow-to-configure-pi-hole-and-mullvad-on-a-raspberry-pi","setting up Pi-hole and Mullvad on a Raspberry Pi"," for a network-wide privacy setup, or our guide to ",[21,1092,1094],{"href":1093},"\u002Fblog\u002Fhow-to-setup-and-use-mullvad-vpn-mobile-app","using the Mullvad VPN mobile app"," when you want to protect individual devices while you are away from home!",[18,1097,1098],{},[100,1099],{"alt":1100,"src":1101},"Girl using FreeCAD with an AI coding agent","\u002Fimages\u002Fblog\u002Ffreecad-opencode\u002Fgirl-using-freecad.png",[18,1103,1104],{},"So, we're done for today! I hope you enjoyed this guide, and I hope to see you in another one soon!",[1106,1107,1108],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}",{"title":212,"searchDepth":565,"depth":565,"links":1110},[1111,1112,1117,1118,1121,1122,1123,1124,1125,1128,1129,1130,1131],{"id":15,"depth":565,"text":16},{"id":63,"depth":565,"text":64,"children":1113},[1114,1115,1116],{"id":86,"depth":580,"text":87},{"id":120,"depth":580,"text":121},{"id":158,"depth":580,"text":159},{"id":198,"depth":565,"text":199},{"id":270,"depth":565,"text":271,"children":1119},[1120],{"id":346,"depth":580,"text":347},{"id":397,"depth":565,"text":398},{"id":511,"depth":565,"text":512},{"id":729,"depth":565,"text":730},{"id":814,"depth":565,"text":815},{"id":857,"depth":565,"text":858,"children":1126},[1127],{"id":892,"depth":580,"text":893},{"id":930,"depth":565,"text":931},{"id":976,"depth":565,"text":977},{"id":1015,"depth":565,"text":1016},{"id":1037,"depth":565,"text":1038},"guides","Guides","2026-08-22","A practical guide to controlling FreeCAD with the FreeCAD MCP server and OpenCode, from installing the addon to creating and inspecting a parametric model with natural-language instructions.","md",[1138,1141,1144,1147,1150],{"question":1139,"answer":1140},"What is the FreeCAD MCP server?","FreeCAD MCP connects an MCP-compatible coding agent to FreeCAD. It uses the FreeCADMCP addon and a small MCP server so the agent can create documents, execute FreeCAD Python code, inspect objects, and request views of the model.",{"question":1142,"answer":1143},"Can OpenCode control FreeCAD directly?","Yes. OpenCode can start the FreeCAD MCP server as a local MCP process. The server communicates with the FreeCAD addon, which must be running in an open FreeCAD session.",{"question":1145,"answer":1146},"Do I need to know FreeCAD Python to use this setup?","No, but basic FreeCAD and Python knowledge is useful. An agent can write much of the code, while your understanding of documents, bodies, sketches, constraints, and measurements helps you review the result.",{"question":1148,"answer":1149},"Where should I run the FreeCAD MCP server?","Run it on the same computer as FreeCAD for the simplest setup. The FreeCAD MCP project also supports remote connections when the addon is configured to allow the agent computer's IP address or subnet.",{"question":1151,"answer":1152},"Can the agent create production-ready CAD models automatically?","It can create useful parametric models and accelerate repetitive work, but every generated model still needs human review. Check dimensions, constraints, topology, clearances, manufacturability, and the saved file before using it for a real project.","\u002Fimages\u002Fblog\u002Ffreecad-opencode\u002Fguy-using-freecad.png","en",{},true,"\u002Fblog\u002Fhow-to-use-freecad-opencode-mcp",{"title":5,"description":1135},{"loc":1157},"blog\u002Fhow-to-use-freecad-opencode-mcp",[30,81,173,1162,1163],"CAD","AI","V0NP9Brhdms7YoYs9ows_SbRrkmZFnkb6n56rZbvIcY",[1166,1170],{"title":1167,"description":1168,"image":1169,"categoryText":1133,"path":1093},"How to Set Up and Use the Mullvad VPN Mobile App","A practical guide to installing, configuring, and using the Mullvad VPN mobile app on Android and iOS, including account setup, server selection, kill switch behavior, and connection troubleshooting.","\u002Fimages\u002Fblog\u002Fmullvad-app\u002Fmullvad-app.png",{"title":1171,"description":1172,"image":1173,"categoryText":1133,"path":1088},"How to Use Pi-hole and the Mullvad VPN on a Raspberry Pi","A practical guide to installing Pi-hole and configuring a Raspberry Pi as a Mullvad WireGuard gateway, including DNS, forwarding, NAT, and leak troubleshooting.","\u002Fimages\u002Fblog\u002Fpi-hole-and-mullvad\u002Fraspberry-pi-network.png",[],1789897413528]