Skip to content

Commit 2f1d811

Browse files
committed
🚀 v0.2.0: Add debug APIs, docs site, and restructure project
1 parent 04c7b6b commit 2f1d811

File tree

19 files changed

+546
-23
lines changed

19 files changed

+546
-23
lines changed

.github/workflows/docs.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 📘 Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: ⬇️ Checkout
12+
uses: actions/checkout@v3
13+
14+
- name: 📦 Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.11"
18+
19+
- name: 📚 Install mkdocs
20+
run: |
21+
pip install mkdocs mkdocs-material
22+
23+
- name: 🚀 Build and deploy
24+
run: |
25+
mkdocs gh-deploy --force

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [v0.2.0] - 2025-06-12
6+
7+
### ✨ Added
8+
- `/debug/info`, `/debug/tables`, `/debug/sql` demo endpoints (gated via `--demo-mode` or `MCP_DEMO_MODE`)
9+
- `docs/api.md` with full HTTP API reference
10+
- GitHub Actions CI badge and deployment workflows
11+
- `mkdocs.yml` and Pages-ready docs site
12+
- CLI options: `--demo-mode`, `--log-level`
13+
- ASCII banner on startup
14+
15+
### 🛠 Changed
16+
- Merged `app/` into `cockroachdb_mcp_server/` for cleaner structure
17+
- All SQLAlchemy connections now resolve correct dialect (CockroachDB vs PostgreSQL)
18+
- Improved error handling and schema initialization
19+
20+
### 🧪 Fixed
21+
- Incorrect usage of `uvicorn.run(..., env=...)` removed
22+
- Redirects and validation issues in `/debug/sql` fixed
23+
- Typo in health check route (`/healtz``/healthz`)
24+
525
---
626

727
## [v0.1.0] - 2025-06-11

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ export CRDB_URL="cockroachdb://root@localhost:26257/defaultdb?sslmode=disable"
9898
| PUT | `/contexts/{id}` | Update context |
9999
| DELETE | `/contexts/{id}` | Delete context |
100100

101+
📘 [View full API reference →](docs/api.md)
102+
103+
📘 [View hosted API Docs](https://viragtripathi.github.io/cockroachdb-mcp-server/)
104+
101105
---
102106

103107
## 🧱 Schema Auto-Bootstrap

app/__init__.py

Whitespace-only changes.

app/main.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

cockroachdb_mcp_server/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ def serve(
4444
log_level: str = typer.Option(
4545
"INFO", "--log-level", help="Logging level (DEBUG, INFO, WARN, etc.)"
4646
),
47+
demo_mode: bool = typer.Option(False, "--demo-mode", help="Enable demo/debug endpoints")
4748
):
4849
"""Start the MCP server."""
49-
from cockroachdb_mcp_server.logging_config import setup_logging
5050

5151
setup_logging(log_level)
5252

5353
if init_schema or os.getenv("MCP_AUTO_INIT_SCHEMA") == "true":
5454
typer.echo("Initializing schema...")
5555
run_schema_init(resolve_crdb_url())
5656

57-
start_server(host, port, reload)
57+
start_server(host, port, reload, demo_mode=demo_mode)
5858

5959

6060
def show_banner():
File renamed without changes.

cockroachdb_mcp_server/main.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
from fastapi import FastAPI
3+
from cockroachdb_mcp_server.routes import contexts, health, debug
4+
from cockroachdb_mcp_server import __version__
5+
6+
app = FastAPI(
7+
title="CockroachDB MCP Server",
8+
version=__version__
9+
)
10+
11+
app.include_router(health.router)
12+
app.include_router(contexts.router, prefix="/contexts")
13+
14+
# Optional debug/demo endpoints
15+
if os.getenv("MCP_DEMO_MODE") == "true":
16+
print("[debug] Mounting /debug routes")
17+
app.include_router(debug.router, prefix="/debug")
18+
19+
print(f"[debug] MCP_DEMO_MODE = {os.getenv('MCP_DEMO_MODE')}")
20+
21+
print("[debug] Registered paths:")
22+
for route in app.routes:
23+
print(f" - {route.path}")
24+
25+
@app.get("/")
26+
def root():
27+
return {"message": "MCP Server is running"}
File renamed without changes.

app/routes/contexts.py renamed to cockroachdb_mcp_server/routes/contexts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from fastapi import APIRouter, HTTPException
2-
from app.models.context import ContextRequest
2+
from cockroachdb_mcp_server.models.context import ContextRequest
33
from sqlalchemy import text
4-
from app.db.db_connection import get_sqlalchemy_engine
4+
from cockroachdb_mcp_server.db.db_connection import get_sqlalchemy_engine
55
from uuid import UUID
66
import json
77

0 commit comments

Comments
 (0)