civil3d-mcp 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. civil3d_mcp-1.2.0/.gitattributes +4 -0
  2. civil3d_mcp-1.2.0/.github/ISSUE_TEMPLATE/00_bug.md +23 -0
  3. civil3d_mcp-1.2.0/.github/ISSUE_TEMPLATE/01_feature_request.md +14 -0
  4. civil3d_mcp-1.2.0/.github/ISSUE_TEMPLATE/02_test_script.md +11 -0
  5. civil3d_mcp-1.2.0/.github/ISSUE_TEMPLATE/03_documentation.md +11 -0
  6. civil3d_mcp-1.2.0/.github/ISSUE_TEMPLATE/04_compliance.md +15 -0
  7. civil3d_mcp-1.2.0/.github/ISSUE_TEMPLATE/05_external_api_changes.md +20 -0
  8. civil3d_mcp-1.2.0/.github/ISSUE_TEMPLATE/06_question.md +11 -0
  9. civil3d_mcp-1.2.0/.github/PULL_REQUEST_TEMPLATE.md +27 -0
  10. civil3d_mcp-1.2.0/.gitignore +7 -0
  11. civil3d_mcp-1.2.0/LICENSE +165 -0
  12. civil3d_mcp-1.2.0/PKG-INFO +182 -0
  13. civil3d_mcp-1.2.0/README.md +169 -0
  14. civil3d_mcp-1.2.0/plugin-source/c3ddrain/JobRunner.cs +1204 -0
  15. civil3d_mcp-1.2.0/plugin-source/c3ddrain/c3ddrain.csproj +33 -0
  16. civil3d_mcp-1.2.0/plugin-source/c3dplot/Dtos.cs +164 -0
  17. civil3d_mcp-1.2.0/plugin-source/c3dplot/MasterplanServer.cs +503 -0
  18. civil3d_mcp-1.2.0/plugin-source/c3dplot/PlotReader.cs +794 -0
  19. civil3d_mcp-1.2.0/plugin-source/c3dplot/PlotWriter.cs +126 -0
  20. civil3d_mcp-1.2.0/plugin-source/c3dplot/SurfaceWriter.cs +191 -0
  21. civil3d_mcp-1.2.0/plugin-source/c3dplot/c3dplot.csproj +33 -0
  22. civil3d_mcp-1.2.0/plugin-source/c3dplugin/Commands.cs +174 -0
  23. civil3d_mcp-1.2.0/plugin-source/c3dplugin/c3dplugin.csproj +33 -0
  24. civil3d_mcp-1.2.0/pyproject.toml +22 -0
  25. civil3d_mcp-1.2.0/src/civil3d_mcp/__init__.py +8 -0
  26. civil3d_mcp-1.2.0/src/civil3d_mcp/cli.py +137 -0
  27. civil3d_mcp-1.2.0/src/civil3d_mcp/drainage.py +837 -0
  28. civil3d_mcp-1.2.0/src/civil3d_mcp/plugin/MCPCivil3D.bundle/Contents/c3ddrain.deps.json +23 -0
  29. civil3d_mcp-1.2.0/src/civil3d_mcp/plugin/MCPCivil3D.bundle/Contents/c3ddrain.dll +0 -0
  30. civil3d_mcp-1.2.0/src/civil3d_mcp/plugin/MCPCivil3D.bundle/Contents/c3dplot.deps.json +23 -0
  31. civil3d_mcp-1.2.0/src/civil3d_mcp/plugin/MCPCivil3D.bundle/Contents/c3dplot.dll +0 -0
  32. civil3d_mcp-1.2.0/src/civil3d_mcp/plugin/MCPCivil3D.bundle/Contents/c3dplugin.deps.json +23 -0
  33. civil3d_mcp-1.2.0/src/civil3d_mcp/plugin/MCPCivil3D.bundle/Contents/c3dplugin.dll +0 -0
  34. civil3d_mcp-1.2.0/src/civil3d_mcp/plugin/MCPCivil3D.bundle/PackageContents.xml +35 -0
  35. civil3d_mcp-1.2.0/src/civil3d_mcp/server.py +783 -0
  36. civil3d_mcp-1.2.0/sync.ps1 +24 -0
@@ -0,0 +1,4 @@
1
+ # The plugin bundle is compared byte-for-byte with the installed copy to decide whether
2
+ # to update it. Line-ending conversion of PackageContents.xml / *.deps.json would make
3
+ # every install look outdated, so git must store and check out these files untouched.
4
+ src/civil3d_mcp/plugin/** -text
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Bug
3
+ about: Report an error, performance issue or unexpected behaviour.
4
+ labels: "type:bug"
5
+
6
+ ---
7
+ <!-- PLEASE ENSURE YOU REVIEW THE CONTENT OF EACH ISSUE CAREFULLY, INCLUDING SUBSEQUENT COMMENTS BY YOURSELF OR OTHERS. -->
8
+ <!-- IN PARTICULAR PLEASE ENSURE THAT SENSITIVE OR INAPPROPRIATE INFORMATION IS NOT UPLOADED -->
9
+
10
+ #### Description:
11
+ <!-- Describe your issue here -->
12
+
13
+
14
+ #### Steps to reproduce:
15
+ <!-- Please tell us how to reproduce this issue -->
16
+
17
+
18
+ #### Expected behaviour:
19
+ <!-- What result would you expect from the fix? -->
20
+
21
+
22
+ #### Test file(s):
23
+ <!-- Link to test files to help reproduce the bug and validate the proposed fixes -->
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest ideas for new functionality, or enhancement of existing.
4
+ labels: "type:feature"
5
+
6
+ ---
7
+ <!-- PLEASE ENSURE YOU REVIEW THE CONTENT OF EACH ISSUE CAREFULLY, INCLUDING SUBSEQUENT COMMENTS BY YOURSELF OR OTHERS. -->
8
+ <!-- IN PARTICULAR PLEASE ENSURE THAT SENSITIVE OR INAPPROPRIATE INFORMATION IS NOT UPLOADED -->
9
+
10
+ #### Description:
11
+ <!-- Describe your idea. Including details of the intended functionality, expected behaviour and desired inputs and outputs -->
12
+
13
+
14
+
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Test Script
3
+ about: Creation of a unit test is required to check functionality, test use cases or validity of a specific part of the code.
4
+ labels: "type:test-script"
5
+
6
+ ---
7
+ <!-- PLEASE ENSURE YOU REVIEW THE CONTENT OF EACH ISSUE CAREFULLY, INCLUDING SUBSEQUENT COMMENTS BY YOURSELF OR OTHERS. -->
8
+ <!-- IN PARTICULAR PLEASE ENSURE THAT SENSITIVE OR INAPPROPRIATE INFORMATION IS NOT UPLOADED -->
9
+
10
+ #### Definition of the test :
11
+ <!-- Please describe the test, including the proposed scope and range of input parameters -->
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Documentation
3
+ about: Highlight missing or incorrect documentation in the code or in the website and wiki.
4
+ labels: "type:documentation"
5
+
6
+ ---
7
+ <!-- PLEASE ENSURE YOU REVIEW THE CONTENT OF EACH ISSUE CAREFULLY, INCLUDING SUBSEQUENT COMMENTS BY YOURSELF OR OTHERS. -->
8
+ <!-- IN PARTICULAR PLEASE ENSURE THAT SENSITIVE OR INAPPROPRIATE INFORMATION IS NOT UPLOADED -->
9
+
10
+ #### What is missing/incorrect?
11
+ <!-- Details of desired documentation -->
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: Compliance
3
+ about: Report code that doesn't follow the BHoM guidelines.
4
+ labels: "type:compliance"
5
+
6
+ ---
7
+ <!-- PLEASE ENSURE YOU REVIEW THE CONTENT OF EACH ISSUE CAREFULLY, INCLUDING SUBSEQUENT COMMENTS BY YOURSELF OR OTHERS. -->
8
+ <!-- IN PARTICULAR PLEASE ENSURE THAT SENSITIVE OR INAPPROPRIATE INFORMATION IS NOT UPLOADED -->
9
+
10
+ #### Broken rules:
11
+ <!-- Add a brief description of what is incorrect or missing -->
12
+
13
+
14
+ #### Suggestions to restore compliance:
15
+ <!-- Any guidance or suggestion on how to bring the element back to compliance -->
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: External API Changes
3
+ about: Modifications to the code are required due to changes to the API of a referenced library. This includes changes imposed from references to other BHoM projects.
4
+ labels: "type:external-api-changes"
5
+
6
+ ---
7
+ <!-- PLEASE ENSURE YOU REVIEW THE CONTENT OF EACH ISSUE CAREFULLY, INCLUDING SUBSEQUENT COMMENTS BY YOURSELF OR OTHERS. -->
8
+ <!-- IN PARTICULAR PLEASE ENSURE THAT SENSITIVE OR INAPPROPRIATE INFORMATION IS NOT UPLOADED -->
9
+
10
+ #### Parent issue(s) or Pull Request(s) causing the changes:
11
+ <!-- If appropriate please reference the URL of any other issue(s) that forces the current change-->
12
+
13
+ #
14
+
15
+ #### Description:
16
+ <!-- Add a brief description of the changes required -->
17
+
18
+
19
+ #### Test file(s):
20
+ <!-- Link to test files to validate the proposed changes -->
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Question
3
+ about: Ask a question about any aspect of the BHoM code or toolkits. Equally do feel free to reach out on Slack with queries and for wider discussions. Link and open invite can be found on https://bhom.xyz
4
+ labels: "type:question"
5
+
6
+ ---
7
+ <!-- PLEASE ENSURE YOU REVIEW THE CONTENT OF EACH ISSUE CAREFULLY, INCLUDING SUBSEQUENT COMMENTS BY YOURSELF OR OTHERS. -->
8
+ <!-- IN PARTICULAR PLEASE ENSURE THAT SENSITIVE OR INAPPROPRIATE INFORMATION IS NOT UPLOADED -->
9
+
10
+
11
+ <!-- If you would like to ask a question on Slack you can find a link and open invite on https://bhom.xyz -->
@@ -0,0 +1,27 @@
1
+ <!-- PLEASE ENSURE YOU REVIEW THE CONTENT OF EACH PR CAREFULLY, INCLUDING SUBSEQUENT COMMENTS BY YOURSELF OR OTHERS. -->
2
+ <!-- IN PARTICULAR PLEASE ENSURE THAT SENSITIVE OR INAPPROPRIATE INFORMATION IS NOT UPLOADED -->
3
+
4
+ ### NOTE: Depends on
5
+ <!-- Link to any additional PRs in other repos required for this PR to function -->
6
+ <!-- Delete if not required -->
7
+
8
+
9
+ ### Issues addressed by this PR
10
+ <!-- Add reference(s) to issue(s) solved by this PR. Please use keyword Fixes/Closes as per https://help.github.com/articles/closing-issues-using-keywords/ -->
11
+
12
+ Closes #
13
+
14
+ <!-- Add short description of what has been fixed -->
15
+
16
+
17
+ ### Test files
18
+ <!-- Link to test files to validate the proposed changes -->
19
+
20
+
21
+ ### Changelog
22
+ <!-- Text to go into changelog if applicable -->
23
+ <!-- Please see https://github.com/BHoM/documentation/wiki/changelog for guidelines -->
24
+
25
+
26
+ ### Additional comments
27
+ <!-- As required -->
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ dist/
5
+ build/
6
+ plugin-source/**/bin/
7
+ plugin-source/**/obj/
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.5
2
+ Name: civil3d-mcp
3
+ Version: 1.2.0
4
+ Summary: MCP server that reads and edits a live, open Autodesk Civil 3D drawing, and designs drainage networks (Buro Happold).
5
+ Author: Waris Mehmood (Buro Happold)
6
+ License-File: LICENSE
7
+ Classifier: Operating System :: Microsoft :: Windows
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: mcp<3,>=2.2
11
+ Requires-Dist: pywin32>=306
12
+ Description-Content-Type: text/markdown
13
+
14
+ # civil3d MCP server
15
+
16
+ Lets GitHub Copilot (VS Code agent mode or Copilot CLI) or Claude Code read and edit a
17
+ **live, already-open** Civil 3D 2026 drawing, and design and build drainage networks in
18
+ one call.
19
+
20
+ Created by Waris Mehmood (Buro Happold). Please get in touch with issues or fixes.
21
+
22
+ The server is a Python package on PyPI. Your MCP client runs it with `uvx`, which
23
+ downloads it and sets up its own isolated Python. You don't copy files, install Python or
24
+ Git, or need a GitHub account. The Civil 3D plugin it needs ships inside the package and
25
+ installs itself.
26
+
27
+ ## Setup (once, about 2 minutes)
28
+
29
+ 1. **Install uv** (it provides `uvx`). In PowerShell:
30
+
31
+ ```powershell
32
+ winget install --id=astral-sh.uv -e
33
+ ```
34
+
35
+ Then **close and reopen VS Code** (or your terminal) so it picks up the new `PATH`.
36
+ Check with `uvx --version`.
37
+
38
+ 2. **Add the server to your client.** Use one or more of these:
39
+
40
+ **VS Code (Copilot Chat agent mode).** Press Ctrl+Shift+P, choose **MCP: Open User
41
+ Configuration**, and add `civil3d` under `servers`:
42
+
43
+ ```json
44
+ {
45
+ "servers": {
46
+ "civil3d": {
47
+ "type": "stdio",
48
+ "command": "uvx",
49
+ "args": ["civil3d-mcp@latest"]
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ **Copilot CLI.** Add the following to `%USERPROFILE%\.copilot\mcp-config.json`:
56
+
57
+ ```json
58
+ {
59
+ "mcpServers": {
60
+ "civil3d": {
61
+ "type": "local",
62
+ "command": "uvx",
63
+ "args": ["civil3d-mcp@latest"],
64
+ "tools": ["*"]
65
+ }
66
+ }
67
+ }
68
+ ```
69
+
70
+ **Claude Code:**
71
+
72
+ ```powershell
73
+ claude mcp add civil3d -s user -- uvx civil3d-mcp@latest
74
+ ```
75
+
76
+ 3. **Close Civil 3D**, then start the server: in VS Code use **MCP: List Servers** →
77
+ `civil3d` → Start, or start a new chat. The first start takes about 30 seconds while uv
78
+ downloads Python and the packages. Later starts take a second or two.
79
+ On that first start the server copies the Civil 3D plugin to
80
+ `%APPDATA%\Autodesk\ApplicationPlugins\MCPCivil3D.bundle`.
81
+
82
+ 4. **Open Civil 3D** with a drawing and type `MCPPING`. It should answer on the command
83
+ line. Then ask Copilot *"What Civil 3D drawing is open?"*
84
+
85
+ If Civil 3D was open during step 3, the plugin isn't copied, because Civil 3D locks it.
86
+ Close Civil 3D and run:
87
+
88
+ ```powershell
89
+ uvx civil3d-mcp@latest install-plugin
90
+ ```
91
+
92
+ Check the state at any time with `uvx civil3d-mcp@latest status`.
93
+
94
+ ## Updates
95
+
96
+ `@latest` makes uvx check PyPI each time the server starts, so you get new releases
97
+ automatically. A restart picks them up: restart VS Code, or use **MCP: List Servers** →
98
+ `civil3d` → Restart. To stay on one version, use `civil3d-mcp==1.2.0` in place of
99
+ `civil3d-mcp@latest`.
100
+
101
+ When an update changes the plugin, it's installed the next time the server starts while
102
+ Civil 3D is closed. The old bundle is kept beside it as `MCPCivil3D.bundle.bak-<date>`.
103
+
104
+ ## Tools
105
+
106
+ **Read:** `get_document_info`, `get_civil3d_summary`, `list_layers`, `list_entities`,
107
+ `get_entity_by_handle`, `list_surfaces`, `list_alignments`, `list_pipe_networks`,
108
+ `list_pipe_slopes`
109
+
110
+ **Edit:** `create_layer`, `draw_line`, `draw_polyline`, `draw_circle`, `add_text`,
111
+ `set_entity_properties`, `move_entity`, `delete_entity`, `regen`, `run_command`
112
+
113
+ **Drainage:**
114
+ - `design_drainage_run` takes polylines (by handle or layer) and does the whole run.
115
+ It places manholes at bends, junctions and the maximum spacing. It takes rim levels
116
+ from a surface, then sets inverts from minimum cover and self-cleansing gradients. It
117
+ picks the chamber type by depth and builds the result as a Civil 3D pipe network. Use
118
+ `dry_run=true` to design without touching the drawing, and `detail=true` for full
119
+ schedules. Give it `outfall_xy`, because polyline direction says nothing about which
120
+ way the water flows. It needs a drawing made from the **BH template**, which holds the
121
+ parts lists, and it refuses to run on any other drawing.
122
+ - `drainage_parts` lists the sizes in a parts list, filtered. Indices are **not** in size order.
123
+
124
+ **Plugin commands** (typed in Civil 3D): `MCPPING` (health check), `MCPJOB` (used by
125
+ the drainage tools), `MPSERVE` / `MPSTOP` / `MPSTATUS` (the masterplan HTTP server on
126
+ `127.0.0.1:8787` that feeds Grasshopper).
127
+
128
+ ## Things that will catch you out
129
+
130
+ 1. **`uvx` not found.** VS Code was open when uv was installed. Restart VS Code. If it
131
+ still fails, put the full path in `"command"`. Find it with `(Get-Command uvx).Source`.
132
+ 2. **Server won't start.** On first start, and on each start with `@latest`, uvx needs
133
+ to reach pypi.org. Run `uvx civil3d-mcp@latest status` in a terminal to see the error.
134
+ 3. **It works on the ACTIVE drawing.** With several tabs open, Copilot edits whichever
135
+ drawing is in front. With two Civil 3D windows open, it may pick the wrong one, so
136
+ close the extra one.
137
+ 4. **Drainage call times out.** The plugin probably isn't loaded. Type `MCPPING` in Civil
138
+ 3D. Logs are in `%TEMP%` (`mcp_c3ddrain_log.txt`, `mcp_job.json`, `mcp_result.json`).
139
+ 5. **Test on a saved scratch copy, not a live ACC file.** Edits go straight into the open
140
+ drawing.
141
+ 6. **`list_entities` can time out on very large drawings** (~60k+ entities). Filter by
142
+ `layer` or `object_type`.
143
+
144
+ ## Moving from the old zip installer
145
+
146
+ The old installer copied the server to `%LOCALAPPDATA%\civil3d-mcp` and pointed your
147
+ client at a specific `python.exe`. Replace that `civil3d` entry with the one above. Then
148
+ you can delete `%LOCALAPPDATA%\civil3d-mcp`. The plugin bundle doesn't change, so it's
149
+ left alone.
150
+
151
+ ## For the maintainer
152
+
153
+ ```
154
+ pyproject.toml package definition, `civil3d-mcp` entry point
155
+ src/civil3d_mcp/cli.py entry point: serve / status / install-plugin, plugin auto-sync
156
+ src/civil3d_mcp/server.py MCP tools (synced from ..\civil3d-mcp)
157
+ src/civil3d_mcp/drainage.py design rules, pure Python (synced from ..\civil3d-mcp)
158
+ src/civil3d_mcp/plugin/ prebuilt MCPCivil3D.bundle (synced from the deployed bundle)
159
+ plugin-source/ C# source matching the shipped DLLs
160
+ sync.ps1 refresh src/ from the working copies
161
+ ```
162
+
163
+ To release:
164
+ 1. Run `sync.ps1` and copy the result into the repo clone.
165
+ 2. Bump `version` in `pyproject.toml`.
166
+ 3. Commit, tag `vX.Y.Z`, and push.
167
+ 4. Build and upload. Clear `dist\` first. The token is a PyPI API token from pypi.org → Account settings → API tokens:
168
+
169
+ ```powershell
170
+ uv build
171
+ $env:UV_PUBLISH_TOKEN = "<token>"
172
+ uv publish
173
+ ```
174
+
175
+ To try a change locally before pushing:
176
+
177
+ ```powershell
178
+ uvx --from . civil3d-mcp status
179
+ ```
180
+
181
+ On a machine where `deploy.ps1` manages the plugin, set `CIVIL3D_MCP_NO_PLUGIN_SYNC=1`
182
+ in the client's `env` so the server never replaces the deployed bundle.
@@ -0,0 +1,169 @@
1
+ # civil3d MCP server
2
+
3
+ Lets GitHub Copilot (VS Code agent mode or Copilot CLI) or Claude Code read and edit a
4
+ **live, already-open** Civil 3D 2026 drawing, and design and build drainage networks in
5
+ one call.
6
+
7
+ Created by Waris Mehmood (Buro Happold). Please get in touch with issues or fixes.
8
+
9
+ The server is a Python package on PyPI. Your MCP client runs it with `uvx`, which
10
+ downloads it and sets up its own isolated Python. You don't copy files, install Python or
11
+ Git, or need a GitHub account. The Civil 3D plugin it needs ships inside the package and
12
+ installs itself.
13
+
14
+ ## Setup (once, about 2 minutes)
15
+
16
+ 1. **Install uv** (it provides `uvx`). In PowerShell:
17
+
18
+ ```powershell
19
+ winget install --id=astral-sh.uv -e
20
+ ```
21
+
22
+ Then **close and reopen VS Code** (or your terminal) so it picks up the new `PATH`.
23
+ Check with `uvx --version`.
24
+
25
+ 2. **Add the server to your client.** Use one or more of these:
26
+
27
+ **VS Code (Copilot Chat agent mode).** Press Ctrl+Shift+P, choose **MCP: Open User
28
+ Configuration**, and add `civil3d` under `servers`:
29
+
30
+ ```json
31
+ {
32
+ "servers": {
33
+ "civil3d": {
34
+ "type": "stdio",
35
+ "command": "uvx",
36
+ "args": ["civil3d-mcp@latest"]
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ **Copilot CLI.** Add the following to `%USERPROFILE%\.copilot\mcp-config.json`:
43
+
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "civil3d": {
48
+ "type": "local",
49
+ "command": "uvx",
50
+ "args": ["civil3d-mcp@latest"],
51
+ "tools": ["*"]
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ **Claude Code:**
58
+
59
+ ```powershell
60
+ claude mcp add civil3d -s user -- uvx civil3d-mcp@latest
61
+ ```
62
+
63
+ 3. **Close Civil 3D**, then start the server: in VS Code use **MCP: List Servers** →
64
+ `civil3d` → Start, or start a new chat. The first start takes about 30 seconds while uv
65
+ downloads Python and the packages. Later starts take a second or two.
66
+ On that first start the server copies the Civil 3D plugin to
67
+ `%APPDATA%\Autodesk\ApplicationPlugins\MCPCivil3D.bundle`.
68
+
69
+ 4. **Open Civil 3D** with a drawing and type `MCPPING`. It should answer on the command
70
+ line. Then ask Copilot *"What Civil 3D drawing is open?"*
71
+
72
+ If Civil 3D was open during step 3, the plugin isn't copied, because Civil 3D locks it.
73
+ Close Civil 3D and run:
74
+
75
+ ```powershell
76
+ uvx civil3d-mcp@latest install-plugin
77
+ ```
78
+
79
+ Check the state at any time with `uvx civil3d-mcp@latest status`.
80
+
81
+ ## Updates
82
+
83
+ `@latest` makes uvx check PyPI each time the server starts, so you get new releases
84
+ automatically. A restart picks them up: restart VS Code, or use **MCP: List Servers** →
85
+ `civil3d` → Restart. To stay on one version, use `civil3d-mcp==1.2.0` in place of
86
+ `civil3d-mcp@latest`.
87
+
88
+ When an update changes the plugin, it's installed the next time the server starts while
89
+ Civil 3D is closed. The old bundle is kept beside it as `MCPCivil3D.bundle.bak-<date>`.
90
+
91
+ ## Tools
92
+
93
+ **Read:** `get_document_info`, `get_civil3d_summary`, `list_layers`, `list_entities`,
94
+ `get_entity_by_handle`, `list_surfaces`, `list_alignments`, `list_pipe_networks`,
95
+ `list_pipe_slopes`
96
+
97
+ **Edit:** `create_layer`, `draw_line`, `draw_polyline`, `draw_circle`, `add_text`,
98
+ `set_entity_properties`, `move_entity`, `delete_entity`, `regen`, `run_command`
99
+
100
+ **Drainage:**
101
+ - `design_drainage_run` takes polylines (by handle or layer) and does the whole run.
102
+ It places manholes at bends, junctions and the maximum spacing. It takes rim levels
103
+ from a surface, then sets inverts from minimum cover and self-cleansing gradients. It
104
+ picks the chamber type by depth and builds the result as a Civil 3D pipe network. Use
105
+ `dry_run=true` to design without touching the drawing, and `detail=true` for full
106
+ schedules. Give it `outfall_xy`, because polyline direction says nothing about which
107
+ way the water flows. It needs a drawing made from the **BH template**, which holds the
108
+ parts lists, and it refuses to run on any other drawing.
109
+ - `drainage_parts` lists the sizes in a parts list, filtered. Indices are **not** in size order.
110
+
111
+ **Plugin commands** (typed in Civil 3D): `MCPPING` (health check), `MCPJOB` (used by
112
+ the drainage tools), `MPSERVE` / `MPSTOP` / `MPSTATUS` (the masterplan HTTP server on
113
+ `127.0.0.1:8787` that feeds Grasshopper).
114
+
115
+ ## Things that will catch you out
116
+
117
+ 1. **`uvx` not found.** VS Code was open when uv was installed. Restart VS Code. If it
118
+ still fails, put the full path in `"command"`. Find it with `(Get-Command uvx).Source`.
119
+ 2. **Server won't start.** On first start, and on each start with `@latest`, uvx needs
120
+ to reach pypi.org. Run `uvx civil3d-mcp@latest status` in a terminal to see the error.
121
+ 3. **It works on the ACTIVE drawing.** With several tabs open, Copilot edits whichever
122
+ drawing is in front. With two Civil 3D windows open, it may pick the wrong one, so
123
+ close the extra one.
124
+ 4. **Drainage call times out.** The plugin probably isn't loaded. Type `MCPPING` in Civil
125
+ 3D. Logs are in `%TEMP%` (`mcp_c3ddrain_log.txt`, `mcp_job.json`, `mcp_result.json`).
126
+ 5. **Test on a saved scratch copy, not a live ACC file.** Edits go straight into the open
127
+ drawing.
128
+ 6. **`list_entities` can time out on very large drawings** (~60k+ entities). Filter by
129
+ `layer` or `object_type`.
130
+
131
+ ## Moving from the old zip installer
132
+
133
+ The old installer copied the server to `%LOCALAPPDATA%\civil3d-mcp` and pointed your
134
+ client at a specific `python.exe`. Replace that `civil3d` entry with the one above. Then
135
+ you can delete `%LOCALAPPDATA%\civil3d-mcp`. The plugin bundle doesn't change, so it's
136
+ left alone.
137
+
138
+ ## For the maintainer
139
+
140
+ ```
141
+ pyproject.toml package definition, `civil3d-mcp` entry point
142
+ src/civil3d_mcp/cli.py entry point: serve / status / install-plugin, plugin auto-sync
143
+ src/civil3d_mcp/server.py MCP tools (synced from ..\civil3d-mcp)
144
+ src/civil3d_mcp/drainage.py design rules, pure Python (synced from ..\civil3d-mcp)
145
+ src/civil3d_mcp/plugin/ prebuilt MCPCivil3D.bundle (synced from the deployed bundle)
146
+ plugin-source/ C# source matching the shipped DLLs
147
+ sync.ps1 refresh src/ from the working copies
148
+ ```
149
+
150
+ To release:
151
+ 1. Run `sync.ps1` and copy the result into the repo clone.
152
+ 2. Bump `version` in `pyproject.toml`.
153
+ 3. Commit, tag `vX.Y.Z`, and push.
154
+ 4. Build and upload. Clear `dist\` first. The token is a PyPI API token from pypi.org → Account settings → API tokens:
155
+
156
+ ```powershell
157
+ uv build
158
+ $env:UV_PUBLISH_TOKEN = "<token>"
159
+ uv publish
160
+ ```
161
+
162
+ To try a change locally before pushing:
163
+
164
+ ```powershell
165
+ uvx --from . civil3d-mcp status
166
+ ```
167
+
168
+ On a machine where `deploy.ps1` manages the plugin, set `CIVIL3D_MCP_NO_PLUGIN_SYNC=1`
169
+ in the client's `env` so the server never replaces the deployed bundle.