Getting started#
This section explains how to install PyAnsys Geometry-MCP in user mode. If you are interested in contributing to PyAnsys Geometry-MCP, see Contribute for information on installing in developer mode.
Installation#
PyAnsys Geometry-MCP requires Python 3.12 or later. Install it into a dedicated virtual environment so that its dependencies do not conflict with other Python packages on your system.
To create and activate a virtual environment, run these commands:
python -m venv .venv
.venv\Scripts\activate
python -m venv .venv
source .venv/bin/activate
With the virtual environment activated, use pip to install PyAnsys Geometry-MCP by running this command:
pip install ansys-geometry-mcp
Alternatively, to install the current development version from this library’s GitHub repository, run these commands:
git clone https://github.com/ansys/pyansys-geometry-mcp
cd pyansys-geometry-mcp
pip install .
Client setup (Copilot and Gemini)#
PyAnsys Geometry-MCP supports two transports for communicating with your MCP client:
stdio (default): Your MCP client starts the server as a child process and communicates with it through standard input and output. This is the simplest option for local use.
HTTP: You start the server yourself, and your MCP client connects to it through a URL.
Startup options#
Both transports accept the same startup options, such as --mode to choose
the geometry backend or --log-level to control logging. To see all available
startup options and their defaults, run this command using the Python
interpreter where you installed the package:
python -m ansys.geometry.mcp --help
Stdio transport#
With the stdio transport, configure your MCP client to start the server with this command:
python -m ansys.geometry.mcp
GitHub Copilot (Visual Studio Code) with stdio#
Open or create
.vscode/mcp.jsonin your workspace. Alternatively, you can use a.mcp.jsonfile at the root of your workspace, which uses a different format. For an example, see the end of this section.Add a server entry for
pyansys-geometry-mcp.Set
typeto"stdio".Set
commandto the path to the Python interpreter where you installed the package. If you installed it in the virtual environment described in Installation, this path looks like.venv\Scripts\python.exeon Windows or.venv/bin/pythonon Linux and macOS.Set
argsto["-m", "ansys.geometry.mcp"]. To customize startup, append more options to this list, such as"--mode", "discovery". For all available options, see Startup options.
Example (.vscode/mcp.json):
{
"servers": {
"pyansys-geometry-mcp": {
"type": "stdio",
"command": "<path-to-python>",
"args": ["-m", "ansys.geometry.mcp"]
}
},
"inputs": []
}
If you use a .mcp.json file at the root of your workspace instead, put the
server entry under mcpServers and omit inputs:
Example (.mcp.json):
{
"mcpServers": {
"pyansys-geometry-mcp": {
"type": "stdio",
"command": "<path-to-python>",
"args": ["-m", "ansys.geometry.mcp"]
}
}
}
Gemini with stdio#
Open or create
.gemini/settings.json.Add an MCP server entry named
pyansys-geometry-mcp.Set
commandandargsas described for GitHub Copilot.
Example:
{
"mcpServers": {
"pyansys-geometry-mcp": {
"command": "<path-to-python>",
"args": ["-m", "ansys.geometry.mcp"],
"trust": true
}
}
}
HTTP transport#
With the HTTP transport, you start the server yourself and then point your MCP client at its URL.
Start the server#
Using the Python interpreter where you installed the package, run this command:
python -m ansys.geometry.mcp --transport http
By default, the server listens on http://127.0.0.1:8080/mcp. You can change
the address with these options:
--http-host: Host address to bind to. The default is127.0.0.1.--http-port: Port number. The default is8080.--http-path: URL path. The default is/mcp.--cors-origins: Comma-separated list of allowed CORS origins. The default is none.
You can combine these with any other startup options. For example:
python -m ansys.geometry.mcp --transport http --http-port 9000 --mode discovery
Keep the terminal open while you use the server. To stop it, press Ctrl+C.
Warning
The HTTP server does not provide authentication. By default, it binds to
127.0.0.1 so that only your local machine can reach it. If you set
--http-host to an address reachable from other machines, anyone who can
reach that address can call the server’s tools, including tools that run
arbitrary Python code.
GitHub Copilot (Visual Studio Code) with HTTP#
Open or create
.vscode/mcp.jsonin your workspace. Alternatively, you can use a.mcp.jsonfile at the root of your workspace, which uses a different format. For an example, see the end of this section.Add a server entry for
pyansys-geometry-mcp.Set
typeto"http".Set
urlto the address the server is listening on. If you changed--http-host,--http-port, or--http-path, update the URL to match.
Example (.vscode/mcp.json):
{
"servers": {
"pyansys-geometry-mcp": {
"type": "http",
"url": "http://127.0.0.1:8080/mcp"
}
},
"inputs": []
}
If you use a .mcp.json file at the root of your workspace instead, put the
server entry under mcpServers and omit inputs:
Example (.mcp.json):
{
"mcpServers": {
"pyansys-geometry-mcp": {
"type": "http",
"url": "http://127.0.0.1:8080/mcp"
}
}
}
Gemini with HTTP#
Open or create
.gemini/settings.json.Add an MCP server entry named
pyansys-geometry-mcp.Set
httpUrlto the address the server is listening on.
Example:
{
"mcpServers": {
"pyansys-geometry-mcp": {
"httpUrl": "http://127.0.0.1:8080/mcp",
"trust": true
}
}
}
Verification#
After configuration, start a chat in your client and ask it to call one of the available tools. If you use the HTTP transport, make sure the server is running first. If the product backend is still starting, wait a few seconds and then ask your client to call the tool again.