bigwolfe commited on
Commit
14701ee
·
1 Parent(s): 468eaec

Update project metadata, improve logging, and enhance API routes

Browse files

- Change project name to "document-mcp" and update description in pyproject.toml
- Add license and keywords to pyproject.toml
- Update FastAPI server path in CLAUDE.md
- Improve error handling by replacing print statements with logging in index.py
- Remove debug print statement in mcp/server.py
- Update seed.py with a placeholder URL for mcp server
- Rename frontend package to "document-mcp-frontend" and update version and description in package.json
- Add BACKEND_AUDIT_REPORT.md to .gitignore

.gitignore CHANGED
@@ -69,3 +69,4 @@ Ai-notes/
69
 
70
  # Generated reports
71
  AUDIT_REPORT.md
 
 
69
 
70
  # Generated reports
71
  AUDIT_REPORT.md
72
+ BACKEND_AUDIT_REPORT.md
CLAUDE.md CHANGED
@@ -31,7 +31,7 @@ uv pip install -e .
31
  uv pip install -e ".[dev]"
32
 
33
  # Run FastAPI HTTP server (for UI)
34
- uv run uvicorn main:app --reload --host 0.0.0.0 --port 8000
35
 
36
  # Run MCP STDIO server (for Claude Desktop/Code)
37
  uv run python src/mcp/server.py
@@ -76,7 +76,7 @@ npm run preview # Serve dist/ (after npm run build)
76
  # Manual reset (WARNING: destroys all data)
77
  cd backend
78
  rm -f ../data/index.db
79
- uv run python -c "from src.services.database import DatabaseService; DatabaseService().init_schema()"
80
  ```
81
 
82
  ## Architecture Deep Dive
@@ -107,7 +107,7 @@ uv run python -c "from src.services.database import DatabaseService; DatabaseSer
107
  - `database.py`: SQLite connection manager + schema DDL
108
 
109
  3. **API/MCP** (`backend/src/api/` and `backend/src/mcp/`):
110
- - `api/routes/`: FastAPI endpoints (11 routes: auth, notes CRUD, search, backlinks, tags, index health/rebuild)
111
  - `api/middleware/auth_middleware.py`: JWT Bearer token validation
112
  - `mcp/server.py`: FastMCP tools (7 tools: list, read, write, delete, search, backlinks, tags)
113
 
 
31
  uv pip install -e ".[dev]"
32
 
33
  # Run FastAPI HTTP server (for UI)
34
+ uv run uvicorn src.api.main:app --reload --host 0.0.0.0 --port 8000
35
 
36
  # Run MCP STDIO server (for Claude Desktop/Code)
37
  uv run python src/mcp/server.py
 
76
  # Manual reset (WARNING: destroys all data)
77
  cd backend
78
  rm -f ../data/index.db
79
+ uv run python -c "from src.services.database import DatabaseService; DatabaseService().initialize()"
80
  ```
81
 
82
  ## Architecture Deep Dive
 
107
  - `database.py`: SQLite connection manager + schema DDL
108
 
109
  3. **API/MCP** (`backend/src/api/` and `backend/src/mcp/`):
110
+ - `api/routes/`: FastAPI endpoints (18 routes: auth, notes CRUD, search, backlinks, tags, index health/rebuild, graph, demo, system)
111
  - `api/middleware/auth_middleware.py`: JWT Bearer token validation
112
  - `mcp/server.py`: FastMCP tools (7 tools: list, read, write, delete, search, backlinks, tags)
113
 
backend/pyproject.toml CHANGED
@@ -1,9 +1,11 @@
1
  [project]
2
- name = "Documentation-MCP"
3
  version = "0.1.0"
4
- description = "Add your description here"
5
  readme = "README.md"
6
  requires-python = ">=3.11"
 
 
7
  dependencies = [
8
  "fastapi>=0.121.2",
9
  "fastmcp>=2.13.1",
 
1
  [project]
2
+ name = "document-mcp"
3
  version = "0.1.0"
4
+ description = "Multi-tenant Obsidian-like documentation viewer with AI-first workflow via MCP"
5
  readme = "README.md"
6
  requires-python = ">=3.11"
7
+ license = {text = "MIT"}
8
+ keywords = ["mcp", "documentation", "obsidian", "ai-agents", "fastapi", "fastmcp"]
9
  dependencies = [
10
  "fastapi>=0.121.2",
11
  "fastmcp>=2.13.1",
backend/src/api/routes/index.py CHANGED
@@ -3,9 +3,12 @@
3
  from __future__ import annotations
4
 
5
  from datetime import datetime
 
6
  import time
7
 
8
  from fastapi import APIRouter, Depends, HTTPException
 
 
9
  from pydantic import BaseModel
10
 
11
  from ...models.index import IndexHealth
@@ -120,7 +123,7 @@ async def rebuild_index(auth: AuthContext = Depends(get_auth_context)):
120
  indexer_service.index_note(user_id, note_data)
121
  indexed_count += 1
122
  except Exception as e:
123
- print(f"Failed to index {note['path']}: {e}")
124
 
125
  # Update index health
126
  conn = db_service.connect()
 
3
  from __future__ import annotations
4
 
5
  from datetime import datetime
6
+ import logging
7
  import time
8
 
9
  from fastapi import APIRouter, Depends, HTTPException
10
+
11
+ logger = logging.getLogger(__name__)
12
  from pydantic import BaseModel
13
 
14
  from ...models.index import IndexHealth
 
123
  indexer_service.index_note(user_id, note_data)
124
  indexed_count += 1
125
  except Exception as e:
126
+ logger.error(f"Failed to index {note['path']}: {e}")
127
 
128
  # Update index health
129
  conn = db_service.connect()
backend/src/mcp/server.py CHANGED
@@ -172,7 +172,6 @@ def read_note(
172
  ..., description="Relative '.md' path ≤256 chars (no '..' or '\\')."
173
  ),
174
  ) -> dict:
175
- print(f"!!! READ_NOTE CALLED: {path} !!!", flush=True)
176
  start_time = time.time()
177
  user_id = _current_user_id()
178
 
 
172
  ..., description="Relative '.md' path ≤256 chars (no '..' or '\\')."
173
  ),
174
  ) -> dict:
 
175
  start_time = time.time()
176
  user_id = _current_user_id()
177
 
backend/src/services/seed.py CHANGED
@@ -270,7 +270,7 @@ For **HTTP mode** (HF Space), use:
270
  {
271
  "mcpServers": {
272
  "obsidian-docs": {
273
- "url": "https://huggingface.co/spaces/bigwolfe/Document-MCP/mcp",
274
  "headers": {
275
  "Authorization": "Bearer YOUR_JWT_TOKEN"
276
  }
 
270
  {
271
  "mcpServers": {
272
  "obsidian-docs": {
273
+ "url": "https://YOUR_USERNAME-Document-MCP.hf.space/mcp",
274
  "headers": {
275
  "Authorization": "Bearer YOUR_JWT_TOKEN"
276
  }
frontend/package.json CHANGED
@@ -1,8 +1,10 @@
1
  {
2
- "name": "frontend",
3
  "private": true,
4
- "version": "0.0.0",
5
  "type": "module",
 
 
6
  "scripts": {
7
  "dev": "vite",
8
  "build": "tsc -b && vite build",
 
1
  {
2
+ "name": "document-mcp-frontend",
3
  "private": true,
4
+ "version": "0.1.0",
5
  "type": "module",
6
+ "description": "React frontend for Document-MCP - Multi-tenant documentation viewer with AI integration",
7
+ "license": "MIT",
8
  "scripts": {
9
  "dev": "vite",
10
  "build": "tsc -b && vite build",