Files
SERVtomaste/docs/SIEMENS-DOCS-SERVER.md

249 lines
6.6 KiB
Markdown
Raw Normal View History

# Siemens Documentation Server on Dalidou
**Updated:** 2025-12-05
**Server:** dalidou (ThinkPad W520)
**Status:** OPERATIONAL
---
## Overview
This setup provides authenticated access to Siemens Support Center documentation (NX Open, Simcenter, Teamcenter) through an MCP server that can be used by Claude in Atomizer.
### Components
1. **Siemens Documentation Proxy** (port 5000) - Official Siemens proxy for documentation access
2. **Puppeteer Authentication** - Headless browser that handles Siemens SSO login
3. **MCP Server Tools** - Exposed via the dalidou-assistant MCP server
---
## Quick Start
### For Claude/Atomizer
The Siemens docs tools are automatically available through the MCP server. Use these tools:
| Tool | Description |
|------|-------------|
| `siemens_docs_search` | Search NX Open, Simcenter docs for a topic |
| `siemens_docs_fetch` | Fetch a specific documentation page by URL |
| `siemens_auth_status` | Check if authentication session is active |
| `siemens_login` | Re-login if session expired |
| `siemens_docs_list` | List available documentation categories |
### Example Usage
```
# Search for NX Open Session class
siemens_docs_search(query="NXOpen Session", product="nx")
# Fetch a specific page
siemens_docs_fetch(url="https://support.sw.siemens.com/en-US/knowledge-base/...")
# Check auth status
siemens_auth_status()
```
---
## Server Configuration
### Documentation Proxy Service
```bash
# Service status
ssh root@dalidou "systemctl status siemensdocumentationproxyserver"
# Restart if needed
ssh root@dalidou "systemctl restart siemensdocumentationproxyserver"
# View logs
ssh root@dalidou "cat /srv/siemens-docs/proxy/logs/*.log | tail -50"
```
**Location:** `/srv/siemens-docs/proxy/`
**Port:** 5000 (HTTP, bound to 0.0.0.0)
**API Key:** siemens-docs-2024
### MCP Server
```bash
# Files location
/srv/claude-assistant/
├── mcp-server/
│ └── server.js # Main MCP server (v1.2.0)
├── tools/
│ ├── siemens-auth.js # Puppeteer authentication
│ ├── siemens-docs.js # Documentation fetching
│ ├── weather.js # Weather tools
│ └── gitea.js # Gitea tools
└── vault/
├── siemens-creds.json # Siemens login credentials (secured)
└── siemens-cookies.json # Session cookies
```
---
## Authentication
The system uses Puppeteer (headless Chrome) to:
1. Navigate to `https://customer.sw.siemens.com`
2. Accept cookie consent
3. Click "Log In" → redirects to `login.siemens.com`
4. Enter email/username and password
5. Save session cookies for reuse
### Credentials Storage
Credentials are stored securely on Dalidou:
```bash
/srv/claude-assistant/vault/siemens-creds.json # chmod 600
```
### Session Management
- Cookies are saved after successful login
- Session typically lasts several hours
- The tools auto-detect expired sessions and re-login
---
## Troubleshooting
### "Session expired" or auth errors
```bash
# Force re-login
ssh root@dalidou "cd /srv/claude-assistant && node -e \"import docs from './tools/siemens-docs.js'; await docs.performLogin(); await docs.closeBrowser();\""
```
### "Page not found" errors
The Siemens documentation structure changes. Some URLs may be outdated. Use the search function to find current documentation.
### Browser issues
```bash
# Kill any stuck Chrome processes
ssh root@dalidou "pkill -f chrome"
# Clear cookies and re-login
ssh root@dalidou "rm /srv/claude-assistant/vault/siemens-cookies.json"
```
### Check all services
```bash
# Documentation Proxy
ssh root@dalidou "systemctl status siemensdocumentationproxyserver"
# Test proxy connectivity
ssh root@dalidou "curl -s http://localhost:5000/ | head -5"
# Test authentication
ssh root@dalidou "cd /srv/claude-assistant && node -e \"import docs from './tools/siemens-docs.js'; const r = await docs.checkAuthStatus(); console.log(r); await docs.closeBrowser();\""
```
---
## Updating Credentials
If your Siemens password changes:
```bash
ssh root@dalidou "cat > /srv/claude-assistant/vault/siemens-creds.json << EOF
{
\"username\": \"your.email@example.com\",
\"password\": \"your-new-password\"
}
EOF
chmod 600 /srv/claude-assistant/vault/siemens-creds.json"
```
---
## Technical Details
### Why Puppeteer Instead of Direct API?
Siemens Support Center uses:
- Single Sign-On (SSO) via `login.siemens.com`
- JavaScript-heavy SPA architecture
- Cookie-based session management
- No public API for documentation access
Puppeteer provides:
- Full browser rendering for SPA content
- Automatic SSO flow handling
- Cookie persistence for session reuse
### Documentation Proxy Purpose
The Siemens Documentation Proxy (`DocumentationProxy.3.3.1.aol`) is designed for:
- Serving documentation in air-gapped/offline environments
- Caching documentation locally
- Providing documentation access without individual logins
However, it still requires valid Siemens credentials for initial setup.
---
## NX Open Python Reference - Validated Access
**Status: FULLY OPERATIONAL** (Tested 2025-12-05)
### Base URL
```
https://docs.sw.siemens.com/documentation/external/PL20200522120320484/en-US/nx_open_python_ref/nx/1980/nx_open_python_ref/en-US/nxopen_python_ref/
```
### Verified Working Pages
| Page | URL | Status |
|------|-----|--------|
| Main Index | `index.html` | ✅ |
| Class Index | `classes.html` | ✅ |
| Class List | `annotated.html` | ✅ |
| Class Hierarchy | `hierarchy.html` | ✅ |
| Functions Index | `functions.html` | ✅ |
| **NXOpen.Session** | `a03318.html` | ✅ |
| **NXOpen.Part** | `a02434.html` | ✅ |
| **NXOpen.BasePart** | `a00266.html` | ✅ |
| NXOpen.PDM.PdmSession | `a50542.html` | ✅ |
| NXOpen.CAE.CaeSession | `a10510.html` | ✅ |
### Key Classes Quick Reference
```python
# Main entry points
NXOpen.Session # a03318.html - Main NX session object
NXOpen.Part # a02434.html - Part file object
NXOpen.BasePart # a00266.html - Base part class
# CAE/CAM
NXOpen.CAE.CaeSession # a10510.html - CAE session
NXOpen.CAM.CAMSession # Via Session.CAMSession()
# PDM/Teamcenter
NXOpen.PDM.PdmSession # a50542.html - PDM session
```
### URL Pattern Notes
- Class pages use format: `aXXXXX.html` (5-digit ID)
- Function pages: `functions.html`, `functions_a.html` through `functions_z.html`
- Namespace pages may return "Access Denied" when accessed directly
- Navigate through Class List (`annotated.html`) for best results
---
## Version History
| Date | Version | Changes |
|------|---------|---------|
| 2025-12-05 | 1.2.1 | Validated full NX Open Python Reference access |
| 2025-12-05 | 1.2.0 | Added Puppeteer-based authentication |
| 2025-12-05 | 1.1.0 | Installed Documentation Proxy, initial setup |