Skip to content
BadBit Documentation
Sign in Download the beta

AI through MCP

BadBit CAD speaks MCP (Model Context Protocol), the open standard AI assistants such as Claude, Cursor and VS Code use to work with programs. With it, you describe what you want in plain language ("draw a 12 × 8 m floor plan with two partitions and dimension it") and the AI draws, queries, changes, takes images of the view and saves, using the same operations as the program.

AI control exists since BadBit CAD 2027.0.0-beta.6. The single AI (MCP) switch described here applies from 2027.0.0-beta.8 on.

The two modes

ModeHow to callWhen to use
With the program open (attached)mcp --anexarYou watch the AI drawing, can undo each step and disconnect at any time. Needs AI (MCP) turned on in Options.
Without a windowmcp --sem-janela --aceito-ia 2The AI works on its own, like a console, without opening the BadBit window. --aceito-ia is your consent to the risk notice.
Automatic (the default)mcpAttaches if a BadBit is open; if not, runs without a window (needs --aceito-ia).

Both modes are the same program: everything you do on screen, the AI does the same way.

Since 2027.0.0-beta.11

Since 2027.0.0-beta.11

Watching the AI draw. With BadBit CAD open, the assistant draws in short stages you follow on screen (for example: layers and walls, then doors and windows, then dimensions and hatches), saying before each one what it is going to do. Each stage shows up little by little, as its steps are applied, and is one undo step. Between one stage and the next the assistant reads what you wrote, so you can ask or correct things along the way. If you start a command while a stage is being drawn, the stage waits for your command to finish; what you draw in the meantime goes into the same undo step as the stage. Without a window (from the terminal, or the package without BadBit open), the assistant still sends the whole project at once.

AI (MCP): turning it on and the risk notice

AI (MCP) is BadBit's only switch: it lets AI assistants (Claude, Cursor, VS Code and other MCP clients) control the program. It comes turned off.

Turning it on. In Options > AI (MCP), check Allow AI assistants to control BadBit (MCP), or click the AI button on the status bar. The Turn on AI (MCP)? window opens and says what the AI can then do:

  • Do everything you do in BadBit: draw and change the drawing, open, save, export and write files in any folder, print and change preferences.
  • Run Python and LISP code, with your user's permissions: the code can read, change or delete any of your files, access the internet and install packages.

And the caveats:

  • each action is decided by the AI assistant and by what you authorize in it: BadBit does not ask for confirmation at every step;
  • instructions hidden in a drawing or a file may try to trick the AI (prompt injection): use it with assistants and files you trust;
  • each AI request is one undo step, and before writing over a file BadBit keeps a backup copy next to it (name.ia-backup-YYYYMMDD-HHMMSS.ext).

The Turn on AI (MCP) button only works after you check I understand the risks and authorize it; Cancel leaves AI off. The profile keeps the date and the version of the notice: if the notice changes, BadBit asks again, and a profile without this consent (from an earlier version, with an old notice or edited by hand) starts with AI (MCP) off.

When it is on, Options show the banner "AI (MCP) on: the AI can do everything you do in BadBit and run code." with the See the risks link, and the AI button on the status bar turns to the alert color. With an assistant connected, the status bar shows "AI connected (name given by the client):" and its name; clicking that notice disconnects it at once. Unchecking the box turns AI off and disconnects whoever is connected. Turning AI off or disconnecting also cuts the request that is running (a long .scr script, an export, some code): what it did to the drawing is undone. What was already written to a file or sent to the printer stays (it cannot be undone).

When it is off, every request from an AI client to the open BadBit (through the badbit mcp bridge or the automatic mode) gets the error that asks to turn on AI (MCP) in Options; as soon as you turn it on, the next request works, without restarting the client. The local HTTP only opens with AI (MCP) on.

Without a window (badbit mcp --sem-janela, badbit mcp --http <port> and the automatic badbit mcp with the program closed), there is no window for the notice, so your consent goes on the command line: --aceito-ia 2 (the number is the version of the notice; the old --aceito-tudo still works). Without it, or with the number of an old notice, BadBit does not start (exit code 2) and explains why in the client's log (stderr); when it starts, it writes the short notice of what the AI can do there. In the Claude Desktop package (.mcpb), the consent is the required I understand the risks and authorize it box: without it, the extension does not start and says why.

What always stays, with AI on or off: the channel belongs to your user only, with a new key each time BadBit runs; the local HTTP listens only on 127.0.0.1 and asks for the token; the texts of the drawing reach the AI marked as data, not as instructions; and the AI cannot change its own switch or your consent (the AI (MCP) section of Options and the local HTTP token stay with you).

Scripts: always available

The AI (MCP) switch is only for AI assistants. Scripts in Python and LISP (BadBit Scripts, APPLOAD, the Python on your machine with the badbit package, the VS Code extension, the console and the windowless batch) always work, with nothing to turn on: they are your own code. See the guides index.

Where the program is

Use the full path of the executable in the assistant's configuration:

SystemPath (default installation)
macOS/Applications/BadBit CAD.app/Contents/MacOS/badbit-shell
Windows%LOCALAPPDATA%\Programs\BadBit\CAD\BadBit CAD.exe (for example C:\Users\Ann\AppData\Local\Programs\BadBit\CAD\BadBit CAD.exe)
Linuxthe executable the installer registered, usually ~/.local/share/badbit/programas/cad/badbit-cad

On Windows and Linux, the path is the installation's launcher, which stays the same after updates.

Configuring the assistant

The step by step for each assistant (Claude Desktop, Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI and Zed), with the exact file on each system, how to tell it connected and the common problems, is in the guide Connecting your AI assistant to BadBit.

The easiest way is from BadBit itself: Options > AI (MCP) > Connect to an assistant. Your assistant's button shows the steps and the settings ready for this computer, with Copy and Set up automatically (it asks first, keeps a copy of the assistant's file and adds only the badbit server). Test the connection, in the same section, tells you whether the local channel answers and which assistant connected last.

In all of them, the program is the one in the table above and the arguments are mcp --aceito-ia 2: with mcp (automatic), the assistant uses the open BadBit when there is one and, with --aceito-ia 2 (your acceptance of the risks), runs without a window when the program is closed. To use only the open program, use mcp --anexar. In the most common form (the mcpServers key):

JSON
{
  "mcpServers": {
    "badbit": {
      "command": "<program>",
      "args": ["mcp", "--aceito-ia", "2"]
    }
  }
}

Local HTTP (for clients that only speak HTTP)

Some clients only connect to MCP servers over HTTP. For them, BadBit CAD has a local Streamable HTTP server, off by default:

  • With the program open: in Options > AI (MCP), with AI (MCP) on, check Local HTTP (for AI clients that only speak HTTP) and choose the port (the default is 47801). The address appears right below (http://127.0.0.1:47801/mcp), with the Copy token and Generate another token buttons. With AI (MCP) off, the local HTTP stays closed.
  • Windowless: "<program>" mcp --http 47801 --aceito-ia 2 (the consent as in the windowless mode). The program writes the address and where the token file is to the terminal, and runs until you stop it (Ctrl+C).

Configure the client with the address and the Authorization: Bearer <token> header. An example (the format changes from one client to another; what matters is the address and the header):

JSON
{
  "mcpServers": {
    "badbit": {
      "type": "http",
      "url": "http://127.0.0.1:47801/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

What the local HTTP does to protect your work:

  • it listens only on this computer (127.0.0.1), never on the network;
  • every request needs the token in the Authorization header; without it, or with another one, the answer is 401. The token never goes in the address (an address with ? is refused);
  • web pages cannot use the server: an Origin header from another site and a Host with another name are refused (403), and there is no CORS;
  • it accepts only POST (GET and DELETE get 405), one message per request, with the same size and requests-per-second limits as the open program.

There is a single token, kept in a file only your user can read, so the client configuration keeps working after you close and reopen BadBit. If it leaks, click Generate another token in Options: the old one stops working at once. With a client connected over HTTP, the status bar shows the usual notice (with the name the client reports) and Disconnect.

Change notifications

In the 2026-07-28 revision of MCP, the assistant can open a subscription (subscriptions/listen) and receive notifications when something changes, without asking again:

In the requestThe notification arrives when
resourceSubscriptions: ["badbit://cad/layers"] (or badbit://cad/blocks, badbit://cad/styles, badbit://document)the content of that resource changes: a layer, block or style created, changed or deleted; the document saved under another name
resourcesListChanged: trueanother drawing comes into view (open, new drawing, switching tabs)
toolsListChanged: truethe operations change (for example, a loaded LISP routine defines a new command)

The notifications work windowless, with the program open and over the local HTTP. Assistants on the 2025-11-25 revision keep working as before, without notifications.

What the AI can do

The most used tools appear directly to the AI:

  • document: summary of the drawing, open, save (a drawing opened from a DWG or DXF is saved over in the same format, without asking; if it does not save, the error says which file and why);
  • draw many objects at once (lines, polylines, circles, arcs, points, texts) with layer, color, linetype and lineweight by name;
  • query objects by type, layer and window, in pages;
  • change and delete objects; create and list layers;
  • batch: the whole project in one call (layers, objects, changes), as a single undo step: if one step fails, nothing is applied, not even the system variables the batch changed (LTSCALE, OSMODE...); what acts outside the drawing, such as exporting, printing or running code, goes in its own call. A batch does not start while a command is waiting for an answer, and a step that leaves a command waiting (without the final Enter) makes the batch fail. With BadBit open, the batch shows up on screen as its steps are applied (a few per frame), and the server instructions ask the assistant for short, visible stages, with one line saying what comes before each; without a window, the project goes in one batch, at once;
  • run any BadBit command, with the answers to its prompts (points, options, Enter), as on the command line. At "Select objects", an answer can be the id of an object (as the operations return it), or several separated by spaces or commas. If the command ends before the answers run out (an empty selection, for example), the request fails and nothing is applied: the leftover answers never become new commands;
  • capture the view as a PNG image, so the AI can check what it drew. With a layout on screen, the image is its sheet with the viewports (measures in paper mm); the layout parameter picks another layout or Model. Inside a layout viewport (MSPACE), the image is the part of the sheet it covers, with what it shows of the model now, and the answer has the part of the model (model_area) and the scale; viewport does the same with any layout viewport, by identifier;
  • undo.

For the rest, the AI searches for the operation, reads its description and calls it (the search, describe and call tools). The full list is in the reference. The drawing summary, the layers, the styles and the blocks are also available as resources (badbit://document, badbit://cad/layers, badbit://cad/styles, badbit://cad/blocks).

Views, layouts, plotting, files and inquiry

Views (cad.view.pan, named views cad.view.save and cad.view.restore, isolating with cad.view.isolate, the UCS with cad.ucs.set), layouts (cad.layout.create, cad.layout.mview with the Polygonal option, cad.layout.page_setup, cad.layout.vplayer), output to a file (cad.output.export: PDF, PNG or SVG, also several sheets in one PDF), files (cad.file.wblock, cad.file.purge, cad.file.audit), external references and images (cad.xref.attach, cad.xref.manage, cad.image.attach) and inquiry (cad.inquiry.area, cad.inquiry.dist, cad.inquiry.massprop) have their own operations too. Inquiry is read only and returns the numbers with the drawing unit; whatever writes a file needs an absolute path and keeps a backup copy before writing over a file. Output goes to files or to a system printer. For example:

  • cad.inquiry.area with {"points": [[0, 0], [12, 0], [12, 8], [0, 8]]} returns area 96 and perimeter 40;
  • cad.layout.mview with {"layout": "Plans", "corner1": [20, 20], "corner2": [400, 280], "scale": 50} creates the layout viewport at 1:50 (paper measurements in millimeters);
  • cad.output.export with {"path": ".../sheets.pdf", "layouts": ["Plans", "Sections"]} writes both sheets to one PDF.

Layout viewports are also read and changed by identifier, without entering them: cad.layout.get returns the page of a layout (paper, margins and printable area in mm) and each viewport with its number, box on paper, center and height of the model view and scale (scale_text, "1:100"); cad.viewport.modify with {"id": "…", "scale": "1:100", "center": [5000, 3000]} (or height, and locked) changes only that viewport, as one undo step. The viewports of a copied layout are independent of the original ones. cad.entity.query with {"layout": "Layout1"} lists the paper space objects of that layout (the border, the title block, the viewports), with their measures in mm, and {"layout": "Model"} only those of the model. The variables VIEWCTR, VIEWSIZE, CVPORT and CTAB come from suite.sysvar.get, read only.

Drawing and modify operations

Each AutoCAD drawing and modify command also has its own operation, with explicit parameters and no prompts: cad.draw.rectangle, cad.draw.polygon, cad.draw.ellipse, cad.modify.move, cad.modify.rotate, cad.modify.offset, cad.modify.trim, cad.modify.fillet, cad.modify.array and the others (the AI finds them with the search tool). They do exactly what the command does, angles in degrees, and each call is one undo step. For example:

  • cad.draw.rectangle with {"corner1": [0, 0], "corner2": [12, 8], "fillet": 0.5};
  • cad.modify.rotate with {"ids": ["…"], "base": [0, 0], "angle": 90, "copy": true};
  • cad.modify.trim with {"id": "…", "pick": [8, 0]} (the piece where pick is goes away);
  • cad.draw.hatch with {"points": [[5, 5]], "pattern": "ANSI31", "pattern_scale": 2} (the closed area around the point);
  • cad.modify.pedit with {"ids": ["…"], "action": "width", "polyline_width": 0.5} (the other PEDIT options through action, vertices by index from 0).

In the paper space of a layout, as in cad.entity.create, the coordinates and the measures (distances, radii, text heights, widths, displacements, base points) of these operations and of the annotation ones (cad.annotate.text, cad.annotate.dim_linear…) are in mm: the ones that create objects, with the layout on screen outside the viewports (PSPACE); the ones that change objects, when the objects are in paper space. Angles and scale factors do not change. For the title block of an A0 sheet, cad.draw.rectangle with {"corner1": [0, 0], "corner2": [1189, 841]} draws the frame the size of the sheet. Model and paper space objects in the same request are refused.

Text, dimensions, tables and constraints

Annotation, formatting and parametric drawing have their own operations too: cad.annotate.* (TEXT, MTEXT, dimensions, leaders, tables, fields), cad.format.* (current color and linetype, text, dimension, multileader and table styles, layer tools, layer states, RENAME) and cad.parametric.* (geometric and dimensional constraints, parameters). Text and dimensions come out in the current style, as in the command. For example:

  • cad.annotate.dim_linear with {"first_origin": [0, 0], "second_origin": [10, 0], "dim_line_point": [5, -2]} (returns the text the dimension shows: the measurement 10 in the format of the current style);
  • cad.annotate.table with {"position": [0, 0], "row_contents": [["Room", "Area"], ["Living", "18.5"]]};
  • cad.parametric.dimensional with {"constraint": "aligned", "parts": [{"id": "…"}], "dim_line_point": [5, 2], "expression": "5"}, and then cad.parametric.parameter_set with {"name": "d1", "expression": "8"} so the line measures 8.

Associative dimensions, dimension variables and details:

  • with DIMASSOC 2 (the default), the dimension from cad.annotate.dim_linear, dim_aligned and the others links each origin given exactly at an endpoint, midpoint, center or intersection of an object: when the line is moved or stretched, the dimension follows. The answer says what linked (links: the point, the object and the type, such as endpoint). A point near the object but off it does not link. cad.annotate.dim_reassociate with definition_points links an existing dimension the same way;
  • in suite.command.run, the answer {"point": [x, y]} works like a click: the running object snap (OSMODE) applies at the exact point and DIMLINEAR becomes associative. The text "x,y" stays as typed coordinates (no link), as in AutoCAD;
  • dimension variables changed with suite.sysvar.set (DIMTXT, DIMASZ, DIMZIN, DIMDEC...) stay as overrides of the current style and go into the DWG and DXF (the $DIM* header variables, as AutoCAD writes them): when the file is reopened they come back and the dimensions made before stay the same;
  • cad.entity.get (and cad.entity.query with detail) returns, for a dimension, the measurement, displayed text, definition points, style, overrides and links; for TEXT and MTEXT, the text style, the justification (or attachment) and the width factor;
  • a linetype from the standard library (DASHED, HIDDEN, CENTER...) loads into the drawing by itself when a layer (cad.layer.create) or CELTYPE asks for it; an unknown name is refused, with a hint about cad.format.linetype_list and cad.format.linetype_load;
  • a TrueType font installed while BadBit is open works in -STYLE without restarting (the font folders are searched again once); if it is still missing, the message says the font was not found.

The remaining windows

What used to have only a window is an operation too:

  • Selection by criteria (FILTER): cad.select.filter returns the objects that pass a filter (type, layer, color, measurements, texts, attributes, with the and, or, xor and not groups), and the named filters are in cad.select.filter_list, filter_save and filter_delete; the Quick Properties rows in cad.quick_properties.list and set.
  • Other drawings and files: compare with another drawing (cad.file.compare), read the import report (cad.file.import_report), import a PDF (cad.file.pdf_import) and a LandXML (cad.landxml.import), export LandXML (cad.landxml.export) and build the transmittal package (cad.file.etransmit).
  • Content and palettes: list and bring blocks, layers and styles from another drawing or from the block library (cad.content.list, cad.content.import, which also inserts the block) and use the palette tools (cad.toolpalette.list, cad.toolpalette.use).
  • Printing: cad.output.printers lists the printers and papers, and cad.output.export with {"printer": "default", "copies": 2} prints (the answer says what went to each printer). Printing leaves the computer and cannot be undone; one request prints at most 500 pages (sheets times copies).
  • Options and aliases: suite.options.get and suite.options.set (theme, on-screen lineweights, font and template folders, recent files) and cad.alias.list, set and delete.

Through the operations, the AI never changes what would give it more power: turning AI (MCP) on or off, the local HTTP and its token, the LISP and Python trusted folders, the code loading warnings, your BadBit Account and updates stay with you, in Options. But note: with AI on, it can run Python and LISP code with your user's permissions, and that code can change any file, including your profile file. The barrier holds for the operations, not for code; that is why the notice asks you to turn AI on only with assistants and files you trust.

Dynamic blocks, .scr scripts, attributes, closing and model viewports

  • Dynamic blocks without the block editor: the AI reads the dynamic part of a block (cad.block.dynamic_get) and creates or changes parameters (cad.block.parameter_add, parameter_edit), actions (cad.block.action_add, action_edit), visibility states (cad.block.visibility_state, visibility_items), the property table (cad.block.property_table) and the lookup table (cad.block.lookup_table), right in the definition. Each call is one undo step, and the existing inserts become dynamic at once. Ask, for example: "In the Door block, add a linear parameter Width from 0,0 to 900,0, in steps of 100 between 600 and 1200, with a stretch action on the right jamb".
  • .scr command scripts: suite.script.run_commands runs a .scr (the text or the file), like SCRIPT, with repetition (RSCRIPT), pauses (DELAY) and nested scripts (SCRIPTCALL); a script that stops on an error goes on with suite.script.resume (RESUME). Each command in the script goes through the same check as single commands: one that opens a file window, reads or writes outside the drawing (ATTOUT, ATTIN, the clipboard), changes preferences (OPTIONS) or uses the network (HELP) does not run, and the request fails saying the line; there are dedicated operations for that (cad.attributes.export, suite.options.set).
  • Attributes in a spreadsheet: cad.attributes.export writes the ATTOUT .txt (or returns the text) and cad.attributes.import brings the values back, like ATTIN.
  • Closing drawings: suite.document.close and suite.document.close_all (CLOSE, CLOSEALL) also close in the open program. A saved drawing closes; with changes, only if the AI says save (saves first) or discard. Nothing closes while a question of yours is open on screen.
  • Model viewports (VPORTS): cad.view.vports_set splits the screen into 2, 3 or 4 viewports, joins and restores; cad.view.vports_named keeps named configurations in the drawing.

Example requests

  • "Draw a 12 × 8 m rectangular floor plan with two inner partitions at 4 m and 8 m from the left wall, on a red Walls layer, and dimension the outer sides."
  • "Show me an image of the whole view and tell me whether any line ended up outside the plan."
  • "List the layers and how many objects each one has."
  • "Move every circle with a radius under 30 cm to the Furniture layer."
  • "Save the drawing as plan-v2.bbd in the Projects folder."

You can also ask the AI to explain each change before making it, if you prefer to check step by step.

Security, in plain words

  • Off until you turn it on, with the risk notice first; without a window, only with your consent (--aceito-ia or the box of the Claude Desktop package).
  • You decide through your assistant: BadBit asks no questions of its own; your AI assistant usually asks your permission for each tool. Each operation states its action type (reads the drawing, changes the drawing, or acts outside the drawing: files, printing, code, preferences), for information only; with the MCP annotations, it helps the assistant show what each one does.
  • Each request is one undo step (U or Ctrl+Z brings back everything that request did) and a line in the command line history.
  • Automatic backup copy: before the AI first saves over a file, BadBit keeps a copy of it as it was, next to it (name.ia-backup-YYYYMMDD-HHMMSS.ext).
  • Texts in the drawing are data: what comes from a file (texts, attributes, names of layers, blocks, styles and linetypes, the name and path of the drawing) and the output of the command line reach the AI marked as drawing content (user_content), so it does not follow instructions written in them.
  • Clear paths: the AI always gives an absolute path; network paths (\\server), Windows device paths (\\?\, \\.\, CON, NUL, COM1...), NTFS alternate streams (plan.dxf:stream) and the null character are refused. Commands that would open the file window do not run through suite.command.run: there are the file operations for that.
  • Limits: the size of requests and answers and the number of requests per second are limited.
  • The assistant name shown in the status bar is the one the assistant itself gave (that is why the notice says "name given by the client").
  • Only your own programs: the attached mode uses a channel that belongs to your user only, with a new password each time BadBit runs; the mode without a window talks only to the program that opened it.
  • Computers with several users: the local HTTP port belongs to the computer, not to your user. If another user (or another program) is already using the port, BadBit does not open the HTTP and says so in Options and on the command line; choose another port. Always check that the address your assistant uses is the one Options shows as open: a program of another user listening on that port would receive the token the assistant sends.
  • External references on a network path: opening a third-party drawing with external references, images or PDFs on a network path (\\server\...) makes the computer try to reach that server, as in AutoCAD; on Windows this may send your network user name to it. Open drawings from outside with care, with or without AI.

Common problems

  • "AI (MCP) is turned off in this BadBit": turn on AI (MCP) in Options > AI (MCP) or with the AI button on the status bar; the next request works right away. The assistant gets the message as a tool error (Error (disabled), so it can read it and explain); in other requests (reading a resource, subscribing to notifications), as a protocol error with type disabled. Code -31003 only shows up when BadBit is open but did not answer on the local channel.
  • "No BadBit CAD is open" (with --anexar): open BadBit CAD, or use the automatic mode. With BadBit still opening, the server waits a few seconds for the local channel.
  • The assistant does not connect: follow the guide Connecting your assistant and use Test the connection in Options > AI (MCP).
  • "BadBit CAD was closed (or restarted)" (code -31002): the program closed while the assistant was connected. Open BadBit again (with AI (MCP) on): the assistant's next request connects by itself, without restarting the MCP server.
  • Coming in the next version "The person disconnected this AI client" (code -31001): you clicked Disconnect for that assistant. It does not come back by itself, not even with BadBit reopened: restart the MCP server in the assistant to connect again.
  • "the local channel did not answer": check that AI (MCP) is on in Options and restart the MCP server in the assistant.
  • BadBit does not start without a window ("needs your explicit consent"): read the notice in the log and, if you authorize it, add --aceito-ia 2 (or tick the box in the Claude Desktop package). If the message says the notice changed, use the new number it shows.
  • "the --nivel and --pasta arguments no longer apply": it is only a note; they are ignored and can be removed from the configuration.
  • "is not accepted: network paths...": use an absolute path on a disk of this computer.
Search the documentation