Content
# CATIA MCP Server
A REST API service for CATIA automation based on [pycatia](https://github.com/evereux/pycatia).
It supports modular modeling, AI/knowledge-driven modeling, API layering, asynchronous tasks, permission control, Swagger documentation, automated testing, and CI.
## Directory Structure
```
catia_mcp_service/
app.py # Main program entry
service.py # CATIA service foundation
di.py # Service factory/dependency injection
api_utils.py # API exception/log decorator
permissions.py # Permission control
schemas.py # pydantic parameter validation
swagger.py # Swagger/OpenAPI integration
i18n.py # Internationalization
features/ # Various functional modules
sketch.py # Sketch modeling
feature3d.py # 3D features
object_ops.py # Object operations
export.py # Export/pictures
batch.py # Batch operations
param_ops.py # Parameters/attributes/measurements
assembly.py # Assembly
template.py # Intelligent template modeling
advanced.py # Complex features
history.py # Modeling history/undo
ai_suggester.py # AI/knowledge-driven modeling
api_sketch.py # API layering example
api_ai.py # AI modeling API
async_tasks.py # Asynchronous task queue
examples/
tests/
.github/workflows/ci.yml # CI configuration
requirements.txt
dev-requirements.txt
README.md
```
## Installation
1. Clone the repository
```bash
git clone <repo-url>
cd mcp-catia_
```
2. Install dependencies
```bash
pip install -r requirements.txt
pip install -r dev-requirements.txt # Optional, for development/testing
```
## Quick Start
```bash
python -m catia_mcp_service.app
```
## Dependencies
See requirements.txt and dev-requirements.txt.
# Key Features
- Complete CATIA modeling and assembly API (sketch, 3D features, assembly, parameters, measurements, export, etc.)
- Intelligent parametric modeling templates (e.g., one-click flange modeling)
- Complex features (shell, rib,筋, draft, sweep, loft, etc.)
- AI/knowledge-driven modeling (natural language to modeling, standard part library automatic modeling)
- API layering, dependency injection, unified exception, and log
- JWT permission control, fine-grained role management
- Asynchronous task queue, batch modeling
- Swagger/OpenAPI automatic documentation and online debugging
- pydantic parameter validation, type hint
- Internationalization and multi-language support
- Unit testing/integration testing, CI automation
## Typical API
- /api/sketch/create Create sketch
- /api/feature3d/pad Create pad feature
- /api/assembly/add_part Add part to assembly
- /api/template/flange Intelligent flange modeling
- /api/ai/modeling AI natural language modeling
- /api/ai/knowledge Standard part library modeling
- /api/image/capture View screenshot
- /api/batch/set_parameters Batch parameter setting
See more APIs in the features/ directory and Swagger documentation.
## Examples
See examples/ directory or tests/ unit tests.
## Frontend/SDK Invocation
See README at the end for "API Routing and Invocation Examples" or refer to api_ai.py, api_sketch.py.
## Contribution
Welcome issues and PRs! Suggest reading CONTRIBUTING.md first.
## License
MIT
---
## API Routing and Invocation Examples
### Python SDK
```python
import requests
token = 'your-jwt-token'
base_url = 'http://localhost:5000'
headers = {'Authorization': f'Bearer {token}'}
params = {'outer_diameter': 100, 'inner_diameter': 50, 'thickness': 10, 'hole_count': 8, 'hole_diameter': 10, 'hole_circle_diameter': 80}
resp = requests.post(f'{base_url}/api/template/flange', json=params, headers=headers)
print(resp.json())
```
### Frontend fetch
```js
fetch('/api/template/flange', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token
},
body: JSON.stringify({
outer_diameter: 100,
inner_diameter: 50,
thickness: 10,
hole_count: 8,
hole_diameter: 10,
hole_circle_diameter: 80
})
}).then(res => res.json()).then(console.log)
```
### 8. Analysis Operations
- Mass analysis
- Interference checking
### 9. Drawing Operations
- Create view
- Add dimensions
### 10. System Operations
- Get system information
## Installation Requirements
- Python 3.8+
- CATIA V5/V6
- pycatia 0.8.2+
- Other dependencies see requirements.txt
## Installation Steps
1. Clone repository:
```bash
git clone [repository_url]
cd catia-mcp-service
```
2. Create virtual environment:
```bash
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
venv\Scripts\activate # Windows
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
4. Configure environment variables:
- Copy `.env.example` to `.env`
- Modify configuration parameters
## Run Service
```bash
python catia_mcp_service.py
```
Service will start at http://localhost:5000
## API Usage Examples
### 1. Connect CATIA
```python
import requests
# Get JWT token
response = requests.post('http://localhost:5000/api/catia/connect',
headers={'Authorization': f'Bearer {token}'})
```
### 2. Create New Document
```python
response = requests.post('http://localhost:5000/api/catia/document',
json={
'operation': 'create',
'doc_type': 'Part'
},
headers={'Authorization': f'Bearer {token}'})
```
### 3. Create Geometry
```python
# Create point
response = requests.post('http://localhost:5000/api/catia/geometry',
json={
'operation': 'point',
'x': 0,
'y': 0,
'z': 0
},
headers={'Authorization': f'Bearer {token}'})
```
## API Documentation
### Authentication
All API requests must include JWT token in the header:
```
Authorization: Bearer <token>
```
### Main Endpoints
1. Connect CATIA
- POST `/api/catia/connect`
2. Document Operations
- POST `/api/catia/document`
- operation: open/save/create/close
3. Parameter Operations
- GET `/api/catia/parameters`
- POST `/api/catia/parameters`
4. Geometry Operations
- POST `/api/catia/geometry`
- operation: point/line/plane
5. Sketch Operations
- POST `/api/catia/sketch`
- operation: create/add_line/add_circle
6. Feature Operations
- POST `/api/catia/feature`
- operation: pad/pocket/revolution
7. Assembly Operations
- POST `/api/catia/assembly`
- operation: add_component/create_constraint
8. Measure Operations
- POST `/api/catia/measure`
- operation: distance/angle/area/volume
9. Analysis Operations
- POST `/api/catia/analysis`
- operation: mass/interference
10. Drawing Operations
- POST `/api/catia/drawing`
- operation: create_view/add_dimension
11. System Operations
- GET `/api/catia/system`
## Error Handling
All API responses follow this format:
```json
{
"status": "success/error",
"message": "Operation result description",
"data": {} // Optional, data returned on success
}
```
## Logs
Service running logs are saved in `catia_mcp.log` file, including:
- Timestamp
- Log level
- Module name
- Message content
## Precautions
1. Ensure CATIA is correctly installed and running
2. Get JWT token before use
3. All API calls must include authentication information
4. Handle API returned error information
## Contribution Guide
1. Fork project
2. Create feature branch
3. Submit changes
4. Push to branch
5. Create Pull Request
## License
MIT License
## Contact
For questions, please submit an Issue or contact the maintainer.
Connection Info
You Might Also Like
everything-claude-code
Complete Claude Code configuration collection - agents, skills, hooks,...
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
servers
Model Context Protocol Servers
servers
Model Context Protocol Servers
cc-switch
All-in-One Assistant for Claude Code, Codex & Gemini CLI across platforms.
Time
A Model Context Protocol server for time and timezone conversions.