feat: v1.3.1 - Multi-transport + Production deployment
- Add HTTP transport (StreamableHTTPServerTransport) - Add shared server module (src/server/) - Configure production for hub.descomplicar.pt - Add SSH tunnel script (start-tunnel.sh) - Fix connection leak in pg-client.ts - Fix atomicity bug in comments deletion - Update docs with test plan for 164 tools Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
101
CLAUDE.md
101
CLAUDE.md
@@ -6,9 +6,32 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
|
||||
MCP server for direct PostgreSQL access to Outline Wiki database. Follows patterns established by `mcp-desk-crm-sql-v3`.
|
||||
|
||||
**Architecture:** Claude Code -> MCP Outline (stdio) -> PostgreSQL (Outline DB)
|
||||
|
||||
**Version:** 1.3.1
|
||||
**Total Tools:** 164 tools across 33 modules
|
||||
**Production:** hub.descomplicar.pt (via SSH tunnel)
|
||||
|
||||
### Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────┐
|
||||
│ src/server/ │
|
||||
│ (Shared Logic) │
|
||||
└──────────┬──────────┘
|
||||
│
|
||||
┌────────────────┼────────────────┐
|
||||
│ │ │
|
||||
┌────────▼────────┐ ┌─────▼─────┐ │
|
||||
│ index.ts │ │index-http │ │
|
||||
│ (stdio) │ │ (HTTP) │ │
|
||||
└─────────────────┘ └───────────┘ │
|
||||
│ │ │
|
||||
└────────────────┴────────────────┘
|
||||
│
|
||||
┌──────────▼──────────┐
|
||||
│ PostgreSQL │
|
||||
│ (Outline DB) │
|
||||
└─────────────────────┘
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
@@ -16,24 +39,46 @@ MCP server for direct PostgreSQL access to Outline Wiki database. Follows patter
|
||||
# Build TypeScript to dist/
|
||||
npm run build
|
||||
|
||||
# Run production server
|
||||
# Run stdio server (default, for Claude Code)
|
||||
npm start
|
||||
|
||||
# Run HTTP server (for web/remote access)
|
||||
npm run start:http
|
||||
|
||||
# Development with ts-node
|
||||
npm run dev
|
||||
npm run dev:http
|
||||
|
||||
# Run tests
|
||||
npm test
|
||||
```
|
||||
|
||||
## Transports
|
||||
|
||||
| Transport | Entry Point | Port | Use Case |
|
||||
|-----------|-------------|------|----------|
|
||||
| stdio | `index.ts` | N/A | Claude Code local |
|
||||
| HTTP | `index-http.ts` | 3200 | Web/remote access |
|
||||
|
||||
### HTTP Transport Endpoints
|
||||
|
||||
- `/mcp` - MCP protocol endpoint
|
||||
- `/health` - Health check (JSON status)
|
||||
- `/stats` - Tool statistics
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
src/
|
||||
├── index.ts # MCP entry point
|
||||
├── index.ts # Stdio transport entry point
|
||||
├── index-http.ts # HTTP transport entry point
|
||||
├── pg-client.ts # PostgreSQL client wrapper
|
||||
├── config/
|
||||
│ └── database.ts # DB configuration
|
||||
├── server/
|
||||
│ ├── index.ts # Server module exports
|
||||
│ ├── create-server.ts # MCP server factory
|
||||
│ └── register-handlers.ts # Shared handler registration
|
||||
├── types/
|
||||
│ ├── index.ts
|
||||
│ ├── tools.ts # Base tool types
|
||||
@@ -125,26 +170,62 @@ src/
|
||||
|
||||
## Configuration
|
||||
|
||||
### Production (hub.descomplicar.pt)
|
||||
|
||||
**Requires SSH tunnel** - Run before starting Claude Code:
|
||||
```bash
|
||||
./start-tunnel.sh start
|
||||
```
|
||||
|
||||
Add to `~/.claude.json` under `mcpServers`:
|
||||
|
||||
```json
|
||||
{
|
||||
"outline": {
|
||||
"outline-postgresql": {
|
||||
"command": "node",
|
||||
"args": ["/home/ealmeida/mcp-servers/mcp-outline-postgresql/dist/index.js"],
|
||||
"env": {
|
||||
"DATABASE_URL": "postgres://outline:password@localhost:5432/outline"
|
||||
"DATABASE_URL": "postgres://postgres:***@localhost:5433/descomplicar",
|
||||
"LOG_LEVEL": "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Local Development
|
||||
|
||||
```json
|
||||
{
|
||||
"outline-postgresql": {
|
||||
"command": "node",
|
||||
"args": ["/home/ealmeida/mcp-servers/mcp-outline-postgresql/dist/index.js"],
|
||||
"env": {
|
||||
"DATABASE_URL": "postgres://outline:outline_dev_2026@localhost:5432/outline",
|
||||
"LOG_LEVEL": "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## SSH Tunnel Management
|
||||
|
||||
```bash
|
||||
# Start tunnel (before Claude Code)
|
||||
./start-tunnel.sh start
|
||||
|
||||
# Check status
|
||||
./start-tunnel.sh status
|
||||
|
||||
# Stop tunnel
|
||||
./start-tunnel.sh stop
|
||||
```
|
||||
|
||||
## Environment
|
||||
|
||||
Required in `.env`:
|
||||
```
|
||||
DATABASE_URL=postgres://user:password@host:port/outline
|
||||
```
|
||||
| Environment | Port | Database | Tunnel |
|
||||
|-------------|------|----------|--------|
|
||||
| Production | 5433 | descomplicar | Required |
|
||||
| Development | 5432 | outline | No |
|
||||
|
||||
## Key Patterns
|
||||
|
||||
|
||||
Reference in New Issue
Block a user