autocad-site-mcp
Headless CAD engine & MCP server for 2D/3D drafting, solids, DXF/SVG export, and automation.
我該用這個嗎
品質與安全性
根據工具定義與協定合規性的自動化分析。
上下文成本
這是每次將伺服器的工具載入模型上下文時所消耗的約略 token 數量。數量越高,可用於其他工作的注意力就越少。
安裝
一鍵安裝
將以下內容加入你的 `claude_desktop_config.json` 檔案:
{
"mcpServers": {
"autocad-site-mcp": {
"command": "npx",
"args": [
"autocad-site-mcp"
]
}
}
}可執行的套件
0.2.1stdio遠端端點
https://acad-qlae.onrender.com/mcpstreamable-http它能做什麼
工具清單
工具(19)
⚪cad_new_drawing(name)
Initializes a fresh CAD drawing space, clearing existing entities and resetting layers.
輸入結構描述
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Drawing filename, e.g. \"Structural_Frame.dxf\""
}
}
}🟡cad_add_layers(layers)
Creates or configures CAD layers with custom colors (hex), linetypes (Continuous, Hidden, Center, Phantom), and lineweights (0.18, 0.25, 0.35, 0.50, etc.).
輸入結構描述
{
"type": "object",
"properties": {
"layers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"color": {
"type": "string",
"description": "Hex color or ACI index e.g. \"#ff0000\" or \"#00ffff\""
},
"linetype": {
"type": "string",
"description": "Continuous, Hidden, Center, Phantom"
},
"lineweight": {
"type": "string",
"description": "e.g. \"0.25\", \"0.50\""
}
},
"required": [
"name"
]
},
"description": "List of layer definitions to create"
}
},
"required": [
"layers"
]
}🟡cad_batch_add_entities(entities)
Fast batch insertion of multiple CAD entities (LINE, LWPOLYLINE, CIRCLE, ARC, ELLIPSE, XLINE, RAY, DONUT, SOLID, TRACE, WIPEOUT, SPLINE, ARRAY (associative rect/polar/path), MLINE (multiline), TABLE (title, header and data cells), IMAGE (picture embedded in the drawing), TEXT, MTEXT, DIMENSION, TOLERANCE, LEADER, HATCH (pattern or gradient), POINT, INSERT, POLYLINE3D). LINE, POINT and POLYLINE3D points take z.
輸入結構描述
{
"type": "object",
"properties": {
"entities": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "LINE, LWPOLYLINE, CIRCLE, ARC, ELLIPSE, XLINE, RAY, DONUT, SOLID, TRACE, WIPEOUT, SPLINE, ARRAY, MLINE, TABLE, IMAGE, TEXT, MTEXT, DIMENSION, TOLERANCE, LEADER, HATCH, POINT, INSERT, POLYLINE3D"
},
"kind": {
"type": "string",
"description": "ARRAY: rect (rows, cols, rowSpacing, colSpacing), polar (center, count, fill, rotateItems) or path (path, method divide|measure, count|spacing, rows, rowSpacing, align)"
},
"sources": {
"type": "array",
"items": {
"type": "object"
},
"description": "ARRAY: entity definitions that are arrayed"
},
"fitPoints": {
"type": "array",
"items": {
"type": "object"
},
"description": "SPLINE through these points (with optional startTangent, endTangent, knotMethod chord|sqrt|uniform, closed)"
},
"controlPoints": {
"type": "array",
"items": {
"type": "object"
},
"description": "SPLINE control vertices (with degree, optional weights, closed)"
},
"gradient": {
"type": "object",
"description": "HATCH gradient fill: { name: LINEAR|CYLINDER|INVCYLINDER|SPHERICAL|INVSPHERICAL|HEMISPHERICAL|INVHEMISPHERICAL|CURVED|INVCURVED, color1, color2, angle (radians), centered }. Saved to DXF as a solid fill of color1 (AutoCAD 2000 has no gradients)."
},
"leaderStyle": {
"type": "string",
"description": "LEADER: multileader style name"
},
"textSize": {
"type": "number",
"description": "DIMENSION: text height in drawing units (e.g. 120 for a plan in mm); with arrowSize and precision (decimals)"
},
"arrowSize": {
"type": "number",
"description": "DIMENSION: arrowhead size in drawing units"
},
"justification": {
"type": "string",
"description": "TEXT: Left, Center, Right, TL, TC, TR, ML, MC, MR, BL, BC, BR. MLINE: top, zero or bottom"
},
"file": {
"type": "string",
"description": "IMAGE: path of a PNG, JPEG, GIF, BMP or WebP file inside the server folder (embedded in the drawing); or dataUrl / base64 with name; with position, width (default: pixel width) and rotation"
},
"dataUrl": {
"type": "string",
"description": "IMAGE: data:image/...;base64,... picture"
},
"title": {
"type": "string",
"description": "TABLE: title row text"
},
"header": {
"type": "array",
"items": {
"type": "string"
},
"description": "TABLE: header row cells"
},
"data": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
},
"description": "TABLE: data rows (arrays of cell text; MTEXT codes such as \\P allowed)"
},
"columnWidths": {
"type": "array",
"items": {
"type": "number"
},
"description": "TABLE: width of each column (or columns + columnWidth, default 63.5)"
},
"tableStyle": {
"type": "string",
"description": "TABLE: table style name (default Standard); with position, rowLines and rotation"
},
"mlineStyle": {
"type": "string",
"description": "MLINE: multiline style name (default Standard); with points, closed and scale (default 20)"
},
"layer": {
"type": "string"
},
"color": {
"type": "string"
},
"p1": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
}
},
"p2": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
}
},
"points": {
"type": "array",
"items": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"bulge": {
"type": "number"
}
}
}
},
"closed": {
"type": "boolean"
},
"width": {
"type": "number",
"description": "LWPOLYLINE constant width"
},
"base": {
"type": "object",
"description": "XLINE / RAY start point",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
}
},
"dir": {
"type": "object",
"description": "XLINE / RAY direction (or give through: {x,y} or angle in radians)",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
}
},
"inside": {
"type": "number",
"description": "DONUT inside diameter (0 = filled disc)"
},
"outside": {
"type": "number",
"description": "DONUT outside diameter"
},
"center": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
}
},
"radius": {
"type": "number"
},
"startAngle": {
"type": "number"
},
"endAngle": {
"type": "number"
},
"text": {
"type": "string"
},
"height": {
"type": "number"
},
"dimType": {
"type": "string",
"description": "linear, aligned, radius, diameter, jogged, angular, ordinate, arclength. Optional: textPoint, textAngle and obliqueAngle (radians), jogLine; jogged: centerOverride, jogPoint"
},
"characteristic": {
"type": "string",
"description": "TOLERANCE: position, concentricity, symmetry, parallelism, perpendicularity, angularity, cylindricity, flatness, circularity, straightness, surfaceprofile, lineprofile, runout, totalrunout"
},
"tolerance": {
"type": "string",
"description": "TOLERANCE value, e.g. \"0.1\", \"d0.05M\" (d = diameter, M/L/S = material condition)"
},
"datums": {
"type": "array",
"items": {
"type": "string"
},
"description": "TOLERANCE datum references, e.g. [\"A\", \"B(M)\", \"C\"]"
},
"vertices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"z": {
"type": "number"
}
}
}
},
"z": {
"type": "number",
"description": "Z or elevation"
},
"normal": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"z": {
"type": "number"
}
},
"description": "Plane normal [x,y,z]"
}
},
"required": [
"type"
]
},
"description": "Array of CAD entity definition objects"
}
},
"required": [
"entities"
]
}🟡cad_create_block(name, entities, basePoint, attributes)
Defines a reusable Block containing geometric entities and optional attribute definitions (ATTDEF).
輸入結構描述
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Block name, e.g. \"DOOR_900\", \"TITLE_BLOCK\""
},
"entities": {
"type": "array",
"description": "Array of entity definition objects comprising the block"
},
"basePoint": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
},
"description": "Insertion base point"
},
"attributes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"tag": {
"type": "string"
},
"prompt": {
"type": "string"
},
"defaultValue": {
"type": "string"
},
"insertionPoint": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
}
},
"height": {
"type": "number"
},
"invisible": {
"type": "boolean"
},
"constant": {
"type": "boolean"
}
},
"required": [
"tag"
]
},
"description": "Optional block attribute definitions"
}
},
"required": [
"name",
"entities"
]
}🟡cad_insert_block(name, position, scale, rotationDeg, attributes)
Places an instance (INSERT) of a block into the drawing with transform scale, rotation, and attribute values.
輸入結構描述
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the block to insert"
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
},
"description": "Insertion coordinate"
},
"scale": {
"type": "number",
"description": "Uniform scale factor (defaults to 1)"
},
"rotationDeg": {
"type": "number",
"description": "Rotation in degrees CCW"
},
"attributes": {
"type": "object",
"description": "Key-value map of attribute values for ATTDEF tags"
}
},
"required": [
"name",
"position"
]
}⚪cad_generate_parametric(type, params)
Generates complex parametric structures: "structural_grid", "truss", "mechanical_flange", "gear", or "architectural_floorplan".
輸入結構描述
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"structural_grid",
"truss",
"mechanical_flange",
"gear",
"architectural_floorplan"
],
"description": "Type of parametric structure to generate"
},
"params": {
"type": "object",
"description": "Parameters specific to the structure (e.g. baysX, baysY, spacingX, span, height, teeth, module, rooms, etc.)"
}
},
"required": [
"type"
]
}🟢cad_run_commands(commands, select)
Runs AutoCAD command-line input in the current drawing, exactly as typed in the app. Statements are separated by ";" or newlines; inside a statement tokens are separated by spaces and the statement ends with Enter. Example: "LINE 0,0 100,0 100,50; CIRCLE 50,25 10; CHPROP ALL; C red; LAYMRG N DOORS; N WALLS Y; DRAWORDER ALL; F". Every statement ends with Enter, so keep the follow-up answers of one command step in the same statement ("CHPROP ALL; LA WALLS C red"; a question asked after Enter goes in the next statement: "LAYDEL N TEMP; Y"). Objects are selected with ALL or P (previous). Returns the command log and any problems. 3D: points x,y,z; 3DPOLY, ELEV, VIEW (Top, Front, SWiso ...), UCS. 3D solids: BOX, CYL, SPHERE, EXTRUDE, REVOLVE, UNION, SUBTRACT, INTERSECT, MASSPROP. Use cad_list_commands to see every command.
輸入結構描述
{
"type": "object",
"properties": {
"commands": {
"type": "string",
"description": "Command script"
},
"select": {
"type": "object",
"description": "Optional Quick Select filter applied before the script; the commands then act on it (pre-selection, or P for previous). Example: { \"type\": \"CIRCLE\", \"property\": \"radius\", \"op\": \"<\", \"value\": 5 }. Properties: color, layer, linetype, lineweight, length, radius, area, text, height, blockname, measurement. Operators: =, <>, >, <, * (any). Text values accept * and ? wildcards. exclude: true inverts the filter.",
"properties": {
"type": {
"type": "string"
},
"property": {
"type": "string"
},
"op": {
"type": "string"
},
"value": {},
"exclude": {
"type": "boolean"
}
}
}
},
"required": [
"commands"
]
}🟢cad_list_commands(filter)
Lists every implemented AutoCAD command with its aliases and description. Optional filter matches the name, an alias or words in the description (for example "layer" or "dim").
輸入結構描述
{
"type": "object",
"properties": {
"filter": {
"type": "string"
}
}
}🟡cad_execute_script(script)
Executes JavaScript to generate large or procedural geometry (loops, patterns, algorithms) without spending context tokens. Runs in a separate Node process that cannot write files, start programs or read anything outside the CAD sources; 30 s limit. Variables: CAD, M (CADMath), G (CADGeometry), E (CADEntities), S (CADState), D (CADDXF), L (CADLayouts), parametric, solid(recipe) (adds a 3D solid), console. Changes to the drawing are kept.
輸入結構描述
{
"type": "object",
"properties": {
"script": {
"type": "string",
"description": "JavaScript code to execute. Can call S.addEntity(), parametric.*, M.*, E.*, etc."
}
},
"required": [
"script"
]
}🟢cad_open_dxf(filePath)
Opens an existing ASCII DXF file (AutoCAD R12 to 2018+) in place of the current drawing, so it can be edited with cad_run_commands and saved with cad_export_dxf. Returns counts, what was converted, and a warning listing objects that cannot be read (they would be missing from a saved file).
輸入結構描述
{
"type": "object",
"properties": {
"filePath": {
"type": "string",
"description": "Path of the .dxf file inside the server folder (CAD_MCP_OUTPUT_DIR, default: the server working directory), e.g. \"plans/level1.dxf\""
}
},
"required": [
"filePath"
]
}⚪cad_export_dxf(filePath)
Exports the current drawing to a standard AutoCAD 2000 (AC1015) ASCII DXF file compatible with AutoCAD, Civil 3D, SolidWorks, and LibreCAD.
輸入結構描述
{
"type": "object",
"properties": {
"filePath": {
"type": "string",
"description": "Path of the .dxf file inside the output folder (CAD_MCP_OUTPUT_DIR, default: the server working directory), e.g. \"plans/level1.dxf\""
}
},
"required": [
"filePath"
]
}⚪cad_export_svg(filePath, background)
Renders the drawing or paper space layout to an SVG vector file for instant preview and inspection.
輸入結構描述
{
"type": "object",
"properties": {
"filePath": {
"type": "string",
"description": "Path of the .svg file inside the output folder (CAD_MCP_OUTPUT_DIR, default: the server working directory)"
},
"background": {
"type": "string",
"description": "Background color, e.g. \"#ffffff\" (default) or \"#1e1e1e\""
}
},
"required": [
"filePath"
]
}⚪cad_export_stl(filePath, binary, ids, scale)
Exports the closed 3D solids to a binary or ASCII STL file for 3D printing.
輸入結構描述
{
"type": "object",
"properties": {
"filePath": {
"type": "string",
"description": "Path of the .stl file inside the output folder"
},
"binary": {
"type": "boolean",
"description": "Default true; false writes ASCII"
},
"ids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Solid ids; default all solids"
},
"scale": {
"type": "number",
"description": "Multiplier on the drawing units (default 1)"
}
},
"required": [
"filePath"
]
}🟢cad_solids(action, ids, limit, from)
Inspects 3D solids: list (id, op, volume, bounds), measure (volume, area, centroid) or check (closed, curve error).
輸入結構描述
{
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"list",
"measure",
"check"
],
"description": "Default list"
},
"ids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Solid ids; default all"
},
"limit": {
"type": "integer",
"description": "Solids per reply, 1 to 50 (default: as many as fit in 900 bytes)"
},
"from": {
"type": "integer",
"description": "Start index; use the reply's next to page"
}
}
}🟢cad_get_stats
Returns comprehensive statistics of the current drawing: entity count, breakdown by type, layers, bounding box extents, blocks, and layouts.
輸入結構描述
{
"type": "object",
"properties": {}
}🟡cad_share_drawing(name, expiresDays, apiUrl)
Shares the current drawing online via Cloudflare D1 storage (autocad.site). Returns view and edit URLs that can be shared with users or other agents.
輸入結構描述
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Optional drawing name (defaults to current drawing name)"
},
"expiresDays": {
"type": "number",
"description": "Expiration in days (e.g. 1, 7, 30; omit or 0 for never)"
},
"apiUrl": {
"type": "string",
"description": "Optional sharing API endpoint (default: \"https://autocad.site\")"
}
}
}⚪cad_open_shared(id, editToken, apiUrl)
Opens a shared drawing from Cloudflare D1 storage into the current CAD session by its share ID or URL.
輸入結構描述
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Share ID (22 chars) or full URL, e.g. \"https://autocad.site/?share=k7Qx...\""
},
"editToken": {
"type": "string",
"description": "Optional edit token if not included in the URL fragment"
},
"apiUrl": {
"type": "string",
"description": "Optional sharing API endpoint (default: \"https://autocad.site\")"
}
},
"required": [
"id"
]
}🟡cad_update_shared(id, editToken, apiUrl)
Uploads and updates the current CAD session drawing to an existing shared drawing using its editToken.
輸入結構描述
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Share ID or full share URL"
},
"editToken": {
"type": "string",
"description": "Edit token"
},
"apiUrl": {
"type": "string",
"description": "Optional sharing API endpoint"
}
},
"required": [
"id",
"editToken"
]
}⚪cad_revoke_shared(id, ownerToken, apiUrl)
Revokes and deletes a shared drawing from Cloudflare D1 storage using its ownerToken.
輸入結構描述
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Share ID or full share URL"
},
"ownerToken": {
"type": "string",
"description": "Owner token received when creating the share"
},
"apiUrl": {
"type": "string",
"description": "Optional sharing API endpoint"
}
},
"required": [
"id",
"ownerToken"
]
}社群
證據