Files
claudetools/.claude/agents/DATABASE_CONNECTION_INFO.md
Mike Swanson 6c316aa701 Add VPN configuration tools and agent documentation
Created comprehensive VPN setup tooling for Peaceful Spirit L2TP/IPsec connection
and enhanced agent documentation framework.

VPN Configuration (PST-NW-VPN):
- Setup-PST-L2TP-VPN.ps1: Automated L2TP/IPsec setup with split-tunnel and DNS
- Connect-PST-VPN.ps1: Connection helper with PPP adapter detection, DNS (192.168.0.2), and route config (192.168.0.0/24)
- Connect-PST-VPN-Standalone.ps1: Self-contained connection script for remote deployment
- Fix-PST-VPN-Auth.ps1: Authentication troubleshooting for CHAP/MSChapv2
- Diagnose-VPN-Interface.ps1: Comprehensive VPN interface and routing diagnostic
- Quick-Test-VPN.ps1: Fast connectivity verification (DNS/router/routes)
- Add-PST-VPN-Route-Manual.ps1: Manual route configuration helper
- vpn-connect.bat, vpn-disconnect.bat: Simple batch file shortcuts
- OpenVPN config files (Windows-compatible, abandoned for L2TP)

Key VPN Implementation Details:
- L2TP creates PPP adapter with connection name as interface description
- UniFi auto-configures DNS (192.168.0.2) but requires manual route to 192.168.0.0/24
- Split-tunnel enabled (only remote traffic through VPN)
- All-user connection for pre-login auto-connect via scheduled task
- Authentication: CHAP + MSChapv2 for UniFi compatibility

Agent Documentation:
- AGENT_QUICK_REFERENCE.md: Quick reference for all specialized agents
- documentation-squire.md: Documentation and task management specialist agent
- Updated all agent markdown files with standardized formatting

Project Organization:
- Moved conversation logs to dedicated directories (guru-connect-conversation-logs, guru-rmm-conversation-logs)
- Cleaned up old session JSONL files from projects/msp-tools/
- Added guru-connect infrastructure (agent, dashboard, proto, scripts, .gitea workflows)
- Added guru-rmm server components and deployment configs

Technical Notes:
- VPN IP pool: 192.168.4.x (client gets 192.168.4.6)
- Remote network: 192.168.0.0/24 (router at 192.168.0.10)
- PSK: rrClvnmUeXEFo90Ol+z7tfsAZHeSK6w7
- Credentials: pst-admin / 24Hearts$

Files: 15 VPN scripts, 2 agent docs, conversation log reorganization,
guru-connect/guru-rmm infrastructure additions

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-18 11:51:47 -07:00

261 lines
6.0 KiB
Markdown

---
name: "Database Connection Info"
description: "Centralized database connection configuration for all agents"
---
# Database Connection Information
**FOR ALL AGENTS - UPDATED 2026-01-17**
---
## Current Database Configuration
### Production Database (RMM Server)
- **Host:** 172.16.3.30
- **Port:** 3306
- **Database:** claudetools
- **User:** claudetools
- **Password:** CT_e8fcd5a3952030a79ed6debae6c954ed
- **Character Set:** utf8mb4
- **Tables:** 43 tables (all migrated)
### Connection String
```
mysql+pymysql://claudetools:CT_e8fcd5a3952030a79ed6debae6c954ed@172.16.3.30:3306/claudetools?charset=utf8mb4
```
### Environment Variable
```bash
DATABASE_URL=mysql+pymysql://claudetools:CT_e8fcd5a3952030a79ed6debae6c954ed@172.16.3.30:3306/claudetools?charset=utf8mb4
```
---
## ClaudeTools API
### Production API (RMM Server)
- **Base URL:** http://172.16.3.30:8001
- **Documentation:** http://172.16.3.30:8001/api/docs
- **Health Check:** http://172.16.3.30:8001/health
- **Authentication:** JWT Bearer Token (required for all endpoints)
### JWT Token Location
- **File:** `D:\ClaudeTools\.claude\context-recall-config.env`
- **Variable:** `JWT_TOKEN`
- **Expiration:** 2026-02-16 (30 days from creation)
### Authentication Header
```bash
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJpbXBvcnQtc2NyaXB0Iiwic2NvcGVzIjpbImFkbWluIiwiaW1wb3J0Il0sImV4cCI6MTc3MTI2NzQzMn0.7HddDbQahyRvaOq9o7OEk6vtn6_nmQJCTzf06g-fv5k
```
---
## Database Access Methods
### Method 1: Direct MySQL Connection (from RMM server)
```bash
# SSH to RMM server
ssh guru@172.16.3.30
# Connect to database
mysql -u claudetools -p'CT_e8fcd5a3952030a79ed6debae6c954ed' -D claudetools
# Example query
SELECT COUNT(*) FROM conversation_contexts;
```
### Method 2: Via ClaudeTools API (preferred for agents)
```bash
# Get contexts
curl -s "http://172.16.3.30:8001/api/conversation-contexts?limit=10" \
-H "Authorization: Bearer $JWT_TOKEN"
# Create context
curl -X POST "http://172.16.3.30:8001/api/conversation-contexts" \
-H "Authorization: Bearer $JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{...}'
```
### Method 3: Python with SQLAlchemy
```python
from sqlalchemy import create_engine, text
DATABASE_URL = "mysql+pymysql://claudetools:CT_e8fcd5a3952030a79ed6debae6c954ed@172.16.3.30:3306/claudetools?charset=utf8mb4"
engine = create_engine(DATABASE_URL)
with engine.connect() as conn:
result = conn.execute(text("SELECT COUNT(*) FROM conversation_contexts"))
count = result.scalar()
print(f"Contexts: {count}")
```
---
## OLD vs NEW Configuration
### ⚠️ DEPRECATED - Old Jupiter Database (DO NOT USE)
- **Host:** 172.16.3.20 (Jupiter - Docker MariaDB)
- **Status:** Deprecated, data not migrated
- **Contains:** 68 old conversation contexts (pre-2026-01-17)
### ✅ CURRENT - New RMM Database (USE THIS)
- **Host:** 172.16.3.30 (RMM - Native MariaDB)
- **Status:** Production, current
- **Contains:** 7+ contexts (as of 2026-01-17)
**Migration Date:** 2026-01-17
**Reason:** Centralized architecture - all clients connect to RMM server
---
## For Database Agent
When performing operations, use:
### Read Operations
```python
# Use API for reads
import requests
headers = {
"Authorization": f"Bearer {jwt_token}"
}
response = requests.get(
"http://172.16.3.30:8001/api/conversation-contexts",
headers=headers,
params={"limit": 10}
)
contexts = response.json()
```
### Write Operations
```python
# Use API for writes
payload = {
"context_type": "session_summary",
"title": "...",
"dense_summary": "...",
"relevance_score": 8.5,
"tags": "[\"tag1\", \"tag2\"]"
}
response = requests.post(
"http://172.16.3.30:8001/api/conversation-contexts",
headers=headers,
json=payload
)
result = response.json()
```
### Direct Database Access (if API unavailable)
```bash
# SSH to RMM server first
ssh guru@172.16.3.30
# Then query database
mysql -u claudetools -p'CT_e8fcd5a3952030a79ed6debae6c954ed' -D claudetools \
-e "SELECT id, title FROM conversation_contexts LIMIT 5;"
```
---
## Common Database Operations
### Count Records
```sql
SELECT COUNT(*) FROM conversation_contexts;
SELECT COUNT(*) FROM clients;
SELECT COUNT(*) FROM sessions;
```
### List Recent Contexts
```sql
SELECT id, title, relevance_score, created_at
FROM conversation_contexts
ORDER BY created_at DESC
LIMIT 10;
```
### Search Contexts by Tag
```bash
# Via API (preferred)
curl "http://172.16.3.30:8001/api/conversation-contexts/recall?tags=migration&limit=5" \
-H "Authorization: Bearer $JWT_TOKEN"
```
---
## Health Checks
### Check Database Connectivity
```bash
# From RMM server
mysql -u claudetools -p'CT_e8fcd5a3952030a79ed6debae6c954ed' \
-h 172.16.3.30 \
-e "SELECT 1"
```
### Check API Health
```bash
curl http://172.16.3.30:8001/health
# Expected: {"status":"healthy","database":"connected"}
```
### Check API Service Status
```bash
ssh guru@172.16.3.30 "sudo systemctl status claudetools-api"
```
---
## Troubleshooting
### Cannot Connect to Database
```bash
# Check if MariaDB is running
ssh guru@172.16.3.30 "sudo systemctl status mariadb"
# Check if port is open
curl telnet://172.16.3.30:3306
```
### API Returns 401 Unauthorized
```bash
# JWT token may be expired - regenerate
python D:\ClaudeTools\create_jwt_token.py
# Update config file
# Edit: D:\ClaudeTools\.claude\context-recall-config.env
```
### API Returns 404 Not Found
```bash
# Check if API service is running
ssh guru@172.16.3.30 "sudo systemctl status claudetools-api"
# Check API logs
ssh guru@172.16.3.30 "sudo journalctl -u claudetools-api -n 50"
```
---
## Important Notes
1. **Always use the API when possible** - Better for access control and validation
2. **JWT tokens expire** - Regenerate monthly (currently valid until 2026-02-16)
3. **Database is centralized** - All machines connect to RMM server
4. **No local database** - Don't try to connect to localhost:3306
5. **Use parameterized queries** - Prevent SQL injection
---
**Last Updated:** 2026-01-17
**Current Database:** 172.16.3.30:3306 (RMM)
**Current API:** http://172.16.3.30:8001