Skip to content

Commit 3276337

Browse files
committed
style: auto-format code with black
1 parent 2f1d811 commit 3276337

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ install:
2525

2626
format:
2727
black cockroachdb_mcp_server
28-
black app
2928

3029
lint:
3130
ruff cockroachdb_mcp_server

cockroachdb_mcp_server/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ 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")
47+
demo_mode: bool = typer.Option(
48+
False, "--demo-mode", help="Enable demo/debug endpoints"
49+
),
4850
):
4951
"""Start the MCP server."""
5052

cockroachdb_mcp_server/main.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
from cockroachdb_mcp_server.routes import contexts, health, debug
44
from cockroachdb_mcp_server import __version__
55

6-
app = FastAPI(
7-
title="CockroachDB MCP Server",
8-
version=__version__
9-
)
6+
app = FastAPI(title="CockroachDB MCP Server", version=__version__)
107

118
app.include_router(health.router)
129
app.include_router(contexts.router, prefix="/contexts")
@@ -22,6 +19,7 @@
2219
for route in app.routes:
2320
print(f" - {route.path}")
2421

22+
2523
@app.get("/")
2624
def root():
2725
return {"message": "MCP Server is running"}

cockroachdb_mcp_server/routes/debug.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
router = APIRouter()
77

8+
89
class SQLQuery(BaseModel):
910
query: str
1011

12+
1113
@router.get("/info")
1214
def get_database_info():
1315
"""
@@ -23,6 +25,7 @@ def get_database_info():
2325
"version": version,
2426
}
2527

28+
2629
@router.post("/sql")
2730
def run_raw_sql(payload: SQLQuery):
2831
"""
@@ -40,6 +43,7 @@ def run_raw_sql(payload: SQLQuery):
4043
except Exception as e:
4144
return {"error": f"💥 Query failed: {str(e)}"}
4245

46+
4347
@router.get("/tables")
4448
def list_tables():
4549
"""
@@ -49,13 +53,17 @@ def list_tables():
4953
engine = get_sqlalchemy_engine()
5054
try:
5155
with engine.connect() as conn:
52-
result = conn.execute(text("""
56+
result = conn.execute(
57+
text(
58+
"""
5359
SELECT table_name
5460
FROM information_schema.tables
5561
WHERE table_schema = 'public'
5662
AND table_type = 'BASE TABLE'
5763
ORDER BY table_name;
58-
""")).fetchall()
64+
"""
65+
)
66+
).fetchall()
5967
return {"tables": [row[0] for row in result]}
6068
except Exception as e:
6169
return {"error": f"❌ Failed to list tables: {str(e)}"}

cockroachdb_mcp_server/server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import uvicorn
22

3+
34
def start_server(host="0.0.0.0", port=8081, reload=False, demo_mode=False):
45
uvicorn.run("cockroachdb_mcp_server.main:app", host=host, port=port, reload=reload)

0 commit comments

Comments
 (0)