Content
# Teamcenter MCP-ready FastAPI Wrapper
This project was generated from the uploaded Chinese Teamcenter REST/SOA Markdown docs.
It contains:
- `data/teamcenter_api_index.json` — extracted endpoint index from the Markdown docs.
- `app/tc_client.py` — Teamcenter HTTP client with cookie/XSRF handling.
- `app/main.py` — FastAPI wrapper endpoints.
- `mcp_server/server.py` — MCP tools that call the FastAPI wrapper.
## 1. Setup
```bash
python -m venv .venv
.venv\Scripts\activate # Windows PowerShell: .venv\Scripts\Activate.ps1
pip install -r requirements.txt
copy .env.example .env
```
Edit `.env`:
```env
TC_BASE_URL=https://your-teamcenter-host
TC_USERNAME=infodba
TC_PASSWORD=your-password
TC_VERIFY_SSL=false
```
## 2. Run FastAPI wrapper
```bash
uvicorn app.main:app --reload --port 8000
```
Open:
```text
http://127.0.0.1:8000/docs
```
## 3. Test login
```bash
curl -X POST http://127.0.0.1:8000/tc/login -H "Content-Type: application/json" -d "{}"
```
## 4. Search extracted API index
```bash
curl "http://127.0.0.1:8000/api-index?search=createItems"
```
## 5. Call any Teamcenter endpoint generically
```bash
curl -X POST http://127.0.0.1:8000/tc/raw ^
-H "Content-Type: application/json" ^
-d "{"path":"tc/JsonRestServices/Core-2007-01-Session/getTCSessionInfo","body":{}}"
```
## 6. Run MCP server
Keep FastAPI running, then in another terminal:
```bash
set FASTAPI_BASE_URL=http://127.0.0.1:8000
python mcp_server/server.py
```
## Suggested MCP tools generated from translated docs
| MCP Tool | Teamcenter API | Purpose |
|---|---|---|
| `tc_login` | `Core-2011-06-Session/login` | Login and store cookies |
| `tc_get_session_info` | `Core-2007-01-Session/getTCSessionInfo` | Read current session |
| `tc_search_items` | `Query-2012-10-Finder/performSearch` | Search items/revisions |
| `tc_get_item_from_id` | `Core-2007-01-DataManagement/getItemFromId` | Resolve item by ID |
| `tc_get_properties` | `Core-2006-03-DataManagement/getProperties` | Read object properties |
| `tc_create_item` | `Core-2006-03-DataManagement/createItems` | Create item |
| `tc_call_raw` | Any extracted endpoint | Generic endpoint execution |
## Important notes
Teamcenter REST/SOA payloads vary by Teamcenter version and site customization. The generic `/tc/raw` endpoint is intentionally included so you can paste exact request bodies from the translated Markdown docs or Postman after testing.