Spaces:
Running
Running
bigwolfe
commited on
Commit
·
69f247d
1
Parent(s):
2e58792
security
Browse files- .gitignore +7 -0
- CLAUDE.md +3 -3
- LICENSE +22 -0
- README.md +1 -1
- ai-notes/documentation-audit-2025-11-27.md +492 -0
- ai-notes/hf-deployment-complete.md +4 -4
- ai-notes/ui-fix-required.md +1 -1
- backend/pyproject.toml +4 -2
- backend/src/services/seed.py +1 -1
- frontend/package.json +4 -2
- scripts/test_mcp_tools.py +1 -1
.gitignore
CHANGED
|
@@ -54,6 +54,12 @@ reproduce_auth_500.py
|
|
| 54 |
debug_list_notes.py
|
| 55 |
DEPLOY_TO_HF.md
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
# Documentation
|
| 58 |
docs/fastmcp/
|
| 59 |
|
|
@@ -62,3 +68,4 @@ docs/fastmcp/
|
|
| 62 |
*.jpg
|
| 63 |
*.jpeg
|
| 64 |
*.gif
|
|
|
|
|
|
| 54 |
debug_list_notes.py
|
| 55 |
DEPLOY_TO_HF.md
|
| 56 |
|
| 57 |
+
# Debug and inspection scripts
|
| 58 |
+
debug_*.py
|
| 59 |
+
inspect_*.py
|
| 60 |
+
test_remote_mcp.py
|
| 61 |
+
generate_jwt_token.py
|
| 62 |
+
|
| 63 |
# Documentation
|
| 64 |
docs/fastmcp/
|
| 65 |
|
|
|
|
| 68 |
*.jpg
|
| 69 |
*.jpeg
|
| 70 |
*.gif
|
| 71 |
+
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().
|
| 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 (
|
| 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 (17 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 |
|
LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2025 Document-MCP Contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
| 22 |
+
|
README.md
CHANGED
|
@@ -98,7 +98,7 @@ Want persistent storage and full control? Deploy your own instance:
|
|
| 98 |
3. Configure environment variables
|
| 99 |
4. Deploy to HF Spaces or any Docker host
|
| 100 |
|
| 101 |
-
See [DEPLOYMENT.md](
|
| 102 |
|
| 103 |
## 🔒 Privacy & Data
|
| 104 |
|
|
|
|
| 98 |
3. Configure environment variables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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Documentation Audit Report - Document-MCP
|
| 2 |
+
**Date**: 2025-11-27
|
| 3 |
+
**Purpose**: Pre-release audit for accuracy, completeness, and professionalism
|
| 4 |
+
|
| 5 |
+
## Executive Summary
|
| 6 |
+
|
| 7 |
+
The Document-MCP project documentation is **generally accurate and comprehensive**, but requires several critical fixes before public release:
|
| 8 |
+
|
| 9 |
+
### Critical Issues (MUST FIX)
|
| 10 |
+
1. ❌ **Personal information exposed** in DEPLOY_TO_HF.md (username: YOUR_USERNAME)
|
| 11 |
+
2. ❌ **Placeholder URLs** not replaced (YOUR_REPO, YOUR_USERNAME)
|
| 12 |
+
3. ❌ **Missing LICENSE file** (mentioned in README but doesn't exist)
|
| 13 |
+
4. ❌ **Inaccurate route count** in CLAUDE.md (claims 11 routes, actual is 18)
|
| 14 |
+
5. ❌ **Incomplete .env.example** (missing several required variables)
|
| 15 |
+
|
| 16 |
+
### Minor Issues (SHOULD FIX)
|
| 17 |
+
1. ⚠️ **Outdated frontend README** (generic Vite template)
|
| 18 |
+
2. ⚠️ **Empty backend README** (only 1 line)
|
| 19 |
+
3. ⚠️ **GEMINI.md is auto-generated** and out of sync
|
| 20 |
+
4. ⚠️ **Inconsistent command format** in CLAUDE.md (uses `main:app` but file is at `src.api.main:app`)
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## Detailed Findings
|
| 25 |
+
|
| 26 |
+
### 1. README.md (Root)
|
| 27 |
+
**Location**: `$PROJECT_ROOT/README.md`
|
| 28 |
+
|
| 29 |
+
**Status**: ✅ Mostly Good
|
| 30 |
+
|
| 31 |
+
**Strengths**:
|
| 32 |
+
- Clear project description
|
| 33 |
+
- Good feature list
|
| 34 |
+
- Well-structured sections
|
| 35 |
+
- Includes demo mode warning
|
| 36 |
+
|
| 37 |
+
**Issues**:
|
| 38 |
+
1. **Line 101**: `https://github.com/YOUR_REPO/Document-MCP/blob/main/DEPLOYMENT.md` - placeholder URL not replaced
|
| 39 |
+
2. **Line 112**: References LICENSE file that doesn't exist
|
| 40 |
+
3. Missing repository URL in frontmatter (lines 1-9)
|
| 41 |
+
|
| 42 |
+
**Recommendations**:
|
| 43 |
+
- Replace `YOUR_REPO` with actual GitHub username/org
|
| 44 |
+
- Create LICENSE file (MIT as stated)
|
| 45 |
+
- Add actual repository URL to YAML frontmatter
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
### 2. CLAUDE.md
|
| 50 |
+
**Location**: `$PROJECT_ROOT/CLAUDE.md`
|
| 51 |
+
|
| 52 |
+
**Status**: ⚠️ Needs Updates
|
| 53 |
+
|
| 54 |
+
**Strengths**:
|
| 55 |
+
- Comprehensive technical documentation
|
| 56 |
+
- Excellent architecture descriptions
|
| 57 |
+
- Detailed command examples
|
| 58 |
+
- Good MCP configuration examples
|
| 59 |
+
|
| 60 |
+
**Inaccuracies Found**:
|
| 61 |
+
|
| 62 |
+
#### Line 34: Incorrect uvicorn command
|
| 63 |
+
```bash
|
| 64 |
+
# CLAUDE.md says:
|
| 65 |
+
uv run uvicorn main:app --reload --host 0.0.0.0 --port 8000
|
| 66 |
+
|
| 67 |
+
# Should be (verified against backend/main.py):
|
| 68 |
+
uv run uvicorn src.api.main:app --reload --host 0.0.0.0 --port 8000
|
| 69 |
+
# OR simply:
|
| 70 |
+
cd backend && uv run python main.py
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
#### Line 110: Incorrect route count
|
| 74 |
+
```
|
| 75 |
+
# Claims:
|
| 76 |
+
11 routes: auth, notes CRUD, search, backlinks, tags, index health/rebuild
|
| 77 |
+
|
| 78 |
+
# Actual count: 18 routes across 7 files
|
| 79 |
+
- auth.py: 4 routes
|
| 80 |
+
- notes.py: 5 routes
|
| 81 |
+
- search.py: 3 routes
|
| 82 |
+
- index.py: 2 routes
|
| 83 |
+
- graph.py: 1 route
|
| 84 |
+
- demo.py: 1 route
|
| 85 |
+
- system.py: 2 routes
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
#### Lines 88-93: Missing models
|
| 89 |
+
**Claims these models exist**:
|
| 90 |
+
- `note.py` ✅ EXISTS
|
| 91 |
+
- `user.py` ✅ EXISTS
|
| 92 |
+
- `search.py` ✅ EXISTS
|
| 93 |
+
- `index.py` ✅ EXISTS
|
| 94 |
+
- `auth.py` ✅ EXISTS
|
| 95 |
+
- `graph.py` ✅ EXISTS (not mentioned but exists)
|
| 96 |
+
|
| 97 |
+
**Recommendation**: Add `graph.py` to the list.
|
| 98 |
+
|
| 99 |
+
#### Line 112: Missing route files
|
| 100 |
+
**Claims**: "7 tools: list, read, write, delete, search, backlinks, tags"
|
| 101 |
+
|
| 102 |
+
**Actual MCP tools**: Should verify this count against actual MCP server implementation.
|
| 103 |
+
|
| 104 |
+
#### Line 79: Database init command inaccuracy
|
| 105 |
+
```bash
|
| 106 |
+
# Claims:
|
| 107 |
+
uv run python -c "from src.services.database import DatabaseService; DatabaseService().init_schema()"
|
| 108 |
+
|
| 109 |
+
# Actual method is:
|
| 110 |
+
DatabaseService().initialize()
|
| 111 |
+
# NOT init_schema()
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
**Verified from `$PROJECT_ROOT/backend/src/services/database.py`**:
|
| 115 |
+
- Line 92: Method is `def initialize(self, statements: Iterable[str] | None = None)`
|
| 116 |
+
- No `init_schema()` method exists
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
### 3. DEPLOYMENT.md
|
| 121 |
+
**Location**: `$PROJECT_ROOT/DEPLOYMENT.md`
|
| 122 |
+
|
| 123 |
+
**Status**: ✅ Good, Minor Placeholders
|
| 124 |
+
|
| 125 |
+
**Issues**:
|
| 126 |
+
1. Multiple instances of `YOUR_USERNAME` placeholder (appropriate for public doc)
|
| 127 |
+
2. All technical instructions verified as accurate
|
| 128 |
+
|
| 129 |
+
**Recommendations**:
|
| 130 |
+
- Keep `YOUR_USERNAME` as placeholder (this is correct for public docs)
|
| 131 |
+
- Maybe add a note at the top: "Replace YOUR_USERNAME with your HuggingFace username"
|
| 132 |
+
|
| 133 |
+
---
|
| 134 |
+
|
| 135 |
+
### 4. DEPLOY_TO_HF.md ⚠️ CRITICAL
|
| 136 |
+
**Location**: `$PROJECT_ROOT/DEPLOY_TO_HF.md`
|
| 137 |
+
|
| 138 |
+
**Status**: ❌ Contains Personal Information
|
| 139 |
+
|
| 140 |
+
**CRITICAL ISSUES**:
|
| 141 |
+
1. **Line 6**: `hf-space` → `https://huggingface.co/spaces/YOUR_USERNAME/Document-MCP`
|
| 142 |
+
2. **Line 12**: `git config credential.helper '!f() { echo "username=YOUR_USERNAME"; ...`
|
| 143 |
+
3. **Line 32**: `huggingface-cli upload YOUR_USERNAME/Document-MCP`
|
| 144 |
+
4. **Line 40**: `git clone https://huggingface.co/spaces/YOUR_USERNAME/Document-MCP`
|
| 145 |
+
|
| 146 |
+
**Recommendation**:
|
| 147 |
+
- **DELETE this file** before public release (it's personal deployment notes)
|
| 148 |
+
- OR replace all instances of `YOUR_USERNAME` with `YOUR_USERNAME`
|
| 149 |
+
|
| 150 |
+
---
|
| 151 |
+
|
| 152 |
+
### 5. .env.example
|
| 153 |
+
**Location**: `$PROJECT_ROOT/.env.example`
|
| 154 |
+
|
| 155 |
+
**Status**: ❌ Incomplete
|
| 156 |
+
|
| 157 |
+
**Current Contents** (only 4 variables):
|
| 158 |
+
```env
|
| 159 |
+
JWT_SECRET_KEY=change-me
|
| 160 |
+
HF_OAUTH_CLIENT_ID=your-hf-client-id
|
| 161 |
+
HF_OAUTH_CLIENT_SECRET=your-hf-client-secret
|
| 162 |
+
VAULT_BASE_PATH=./data/vaults
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
**Missing Variables** (referenced in CLAUDE.md and code):
|
| 166 |
+
- `MODE` (local or space)
|
| 167 |
+
- `DB_PATH` (SQLite database location)
|
| 168 |
+
- `LOCAL_USER_ID` (default user for local mode)
|
| 169 |
+
- `HF_SPACE_HOST` (for HF Space deployments)
|
| 170 |
+
|
| 171 |
+
**Recommendation**: Add comprehensive .env.example with all variables documented.
|
| 172 |
+
|
| 173 |
+
---
|
| 174 |
+
|
| 175 |
+
### 6. backend/README.md
|
| 176 |
+
**Location**: `$PROJECT_ROOT/backend/README.md`
|
| 177 |
+
|
| 178 |
+
**Status**: ❌ Nearly Empty (1 line)
|
| 179 |
+
|
| 180 |
+
**Current State**: File exists but has no meaningful content.
|
| 181 |
+
|
| 182 |
+
**Recommendation**: Add backend-specific documentation:
|
| 183 |
+
- Installation instructions
|
| 184 |
+
- Development setup
|
| 185 |
+
- Testing guide
|
| 186 |
+
- Service architecture overview
|
| 187 |
+
|
| 188 |
+
---
|
| 189 |
+
|
| 190 |
+
### 7. frontend/README.md
|
| 191 |
+
**Location**: `$PROJECT_ROOT/frontend/README.md`
|
| 192 |
+
|
| 193 |
+
**Status**: ⚠️ Generic Vite Template
|
| 194 |
+
|
| 195 |
+
**Current State**: Still contains the default Vite + React template README.
|
| 196 |
+
|
| 197 |
+
**Recommendation**: Replace with project-specific frontend documentation:
|
| 198 |
+
- Component architecture
|
| 199 |
+
- Development workflow
|
| 200 |
+
- Build instructions
|
| 201 |
+
- UI/UX guidelines
|
| 202 |
+
|
| 203 |
+
---
|
| 204 |
+
|
| 205 |
+
### 8. GEMINI.md
|
| 206 |
+
**Location**: `$PROJECT_ROOT/GEMINI.md`
|
| 207 |
+
|
| 208 |
+
**Status**: ⚠️ Auto-generated, Out of Sync
|
| 209 |
+
|
| 210 |
+
**Issues**:
|
| 211 |
+
- Clearly auto-generated from SpecKit
|
| 212 |
+
- Contains malformed commands (e.g., "cd src [ONLY COMMANDS FOR ACTIVE TECHNOLOGIES]")
|
| 213 |
+
- Last updated 2025-11-25 (2 days old)
|
| 214 |
+
- Doesn't match actual project structure
|
| 215 |
+
|
| 216 |
+
**Recommendation**:
|
| 217 |
+
- **DELETE** or move to `.specify/` internal folder
|
| 218 |
+
- Not useful for public documentation
|
| 219 |
+
|
| 220 |
+
---
|
| 221 |
+
|
| 222 |
+
### 9. LICENSE File
|
| 223 |
+
**Status**: ❌ MISSING
|
| 224 |
+
|
| 225 |
+
**Referenced in**:
|
| 226 |
+
- README.md line 112: "MIT License - See LICENSE file for details"
|
| 227 |
+
- README.md line 8: `license: mit`
|
| 228 |
+
|
| 229 |
+
**Recommendation**: Create LICENSE file with MIT license text.
|
| 230 |
+
|
| 231 |
+
---
|
| 232 |
+
|
| 233 |
+
### 10. Package Metadata
|
| 234 |
+
|
| 235 |
+
#### backend/pyproject.toml
|
| 236 |
+
**Location**: `$PROJECT_ROOT/backend/pyproject.toml`
|
| 237 |
+
|
| 238 |
+
**Status**: ⚠️ Incomplete Metadata
|
| 239 |
+
|
| 240 |
+
**Issues**:
|
| 241 |
+
- Line 1: `name = "Documentation-MCP"` (inconsistent with project name "Document-MCP")
|
| 242 |
+
- Line 4: `description = "Add your description here"` (placeholder)
|
| 243 |
+
- Line 5: `readme = "README.md"` (points to empty README)
|
| 244 |
+
|
| 245 |
+
**Recommendations**:
|
| 246 |
+
- Fix name to `"document-mcp"`
|
| 247 |
+
- Add proper description
|
| 248 |
+
- Add author, repository URL, keywords
|
| 249 |
+
|
| 250 |
+
#### frontend/package.json
|
| 251 |
+
**Location**: `$PROJECT_ROOT/frontend/package.json`
|
| 252 |
+
|
| 253 |
+
**Status**: ⚠️ Generic Template
|
| 254 |
+
|
| 255 |
+
**Issues**:
|
| 256 |
+
- Line 2: `"name": "frontend"` (too generic)
|
| 257 |
+
- Line 3: `"private": true` (correct for non-published packages)
|
| 258 |
+
- Line 5: `"version": "0.0.0"` (should match backend version)
|
| 259 |
+
- Missing description, author, repository fields
|
| 260 |
+
|
| 261 |
+
**Recommendations**:
|
| 262 |
+
- Change name to `"document-mcp-frontend"`
|
| 263 |
+
- Add proper metadata matching backend
|
| 264 |
+
|
| 265 |
+
---
|
| 266 |
+
|
| 267 |
+
## File Structure Verification
|
| 268 |
+
|
| 269 |
+
### Backend Structure ✅
|
| 270 |
+
Verified actual structure matches CLAUDE.md claims:
|
| 271 |
+
|
| 272 |
+
```
|
| 273 |
+
backend/src/
|
| 274 |
+
├── models/ ✅ (7 files: auth, graph, index, note, search, user, __init__)
|
| 275 |
+
├── services/ ✅ (7 files: auth, config, database, indexer, seed, vault, __init__)
|
| 276 |
+
├── api/
|
| 277 |
+
│ ├── routes/ ✅ (8 files: auth, demo, graph, index, notes, search, system, __init__)
|
| 278 |
+
│ └── middleware/ ✅
|
| 279 |
+
└── mcp/
|
| 280 |
+
└── server.py ✅
|
| 281 |
+
```
|
| 282 |
+
|
| 283 |
+
### Frontend Structure ✅
|
| 284 |
+
```
|
| 285 |
+
frontend/src/
|
| 286 |
+
├── components/ ✅ (GraphView, NoteViewer, NoteEditor, DirectoryTree, etc.)
|
| 287 |
+
├── lib/ ✅
|
| 288 |
+
├── services/ ✅
|
| 289 |
+
└── types/ ✅
|
| 290 |
+
```
|
| 291 |
+
|
| 292 |
+
---
|
| 293 |
+
|
| 294 |
+
## Command Verification
|
| 295 |
+
|
| 296 |
+
### Backend Commands (from CLAUDE.md)
|
| 297 |
+
|
| 298 |
+
| Command | Line | Status | Notes |
|
| 299 |
+
|---------|------|--------|-------|
|
| 300 |
+
| `uv venv` | 26 | ✅ Works | Verified |
|
| 301 |
+
| `uv pip install -e .` | 28 | ✅ Works | Verified |
|
| 302 |
+
| `uv run uvicorn main:app` | 34 | ❌ Wrong | Should be `src.api.main:app` |
|
| 303 |
+
| `uv run python src/mcp/server.py` | 37 | ✅ Works | Verified |
|
| 304 |
+
| `uv run pytest` | 43 | ✅ Works | Requires dev deps |
|
| 305 |
+
|
| 306 |
+
### Frontend Commands
|
| 307 |
+
|
| 308 |
+
| Command | Line | Status |
|
| 309 |
+
|---------|------|--------|
|
| 310 |
+
| `npm install` | 57 | ✅ Works |
|
| 311 |
+
| `npm run dev` | 60 | ✅ Works |
|
| 312 |
+
| `npm run build` | 63 | ✅ Works |
|
| 313 |
+
| `npm run lint` | 66 | ✅ Works |
|
| 314 |
+
|
| 315 |
+
---
|
| 316 |
+
|
| 317 |
+
## Architecture Verification
|
| 318 |
+
|
| 319 |
+
### SQLite Schema ✅
|
| 320 |
+
Verified against `$PROJECT_ROOT/backend/src/services/database.py`:
|
| 321 |
+
|
| 322 |
+
**CLAUDE.md claims 5 tables**:
|
| 323 |
+
1. `note_metadata` ✅ (lines 15-26)
|
| 324 |
+
2. `note_fts` ✅ (lines 33-41)
|
| 325 |
+
3. `note_tags` ✅ (lines 43-49)
|
| 326 |
+
4. `note_links` ✅ (lines 53-61)
|
| 327 |
+
5. `index_health` ✅ (lines 66-72)
|
| 328 |
+
|
| 329 |
+
**All verified as accurate!**
|
| 330 |
+
|
| 331 |
+
### API Routes Count ❌
|
| 332 |
+
**CLAUDE.md Line 110 claims**: "11 routes: auth, notes CRUD, search, backlinks, tags, index health/rebuild"
|
| 333 |
+
|
| 334 |
+
**Actual count**: 18 routes across 7 router files
|
| 335 |
+
- Not technically wrong (may be counting logical endpoints vs. HTTP routes)
|
| 336 |
+
- But confusing and should be clarified
|
| 337 |
+
|
| 338 |
+
---
|
| 339 |
+
|
| 340 |
+
## Links Audit
|
| 341 |
+
|
| 342 |
+
### Internal Links
|
| 343 |
+
All internal file references in CLAUDE.md verified:
|
| 344 |
+
- ✅ `backend/src/models/`
|
| 345 |
+
- ✅ `backend/src/services/`
|
| 346 |
+
- ✅ `backend/src/api/routes/`
|
| 347 |
+
- ✅ `.env.example`
|
| 348 |
+
|
| 349 |
+
### External Links
|
| 350 |
+
No broken external links found in:
|
| 351 |
+
- README.md
|
| 352 |
+
- DEPLOYMENT.md
|
| 353 |
+
- CLAUDE.md
|
| 354 |
+
|
| 355 |
+
### Placeholder Links ❌
|
| 356 |
+
- `https://github.com/YOUR_REPO/Document-MCP` (README.md)
|
| 357 |
+
- Multiple `YOUR_USERNAME` placeholders (appropriate for templates)
|
| 358 |
+
|
| 359 |
+
---
|
| 360 |
+
|
| 361 |
+
## Recommendations by Priority
|
| 362 |
+
|
| 363 |
+
### 🔴 CRITICAL (Must fix before public release)
|
| 364 |
+
|
| 365 |
+
1. **Create LICENSE file** (MIT as stated)
|
| 366 |
+
```bash
|
| 367 |
+
# Add MIT license text to LICENSE file
|
| 368 |
+
```
|
| 369 |
+
|
| 370 |
+
2. **Remove/anonymize DEPLOY_TO_HF.md**
|
| 371 |
+
- Delete entirely OR
|
| 372 |
+
- Replace `YOUR_USERNAME` with `YOUR_USERNAME`
|
| 373 |
+
|
| 374 |
+
3. **Fix placeholder URLs in README.md**
|
| 375 |
+
- Replace `YOUR_REPO` with actual GitHub username/org
|
| 376 |
+
|
| 377 |
+
4. **Fix .env.example**
|
| 378 |
+
- Add all missing environment variables
|
| 379 |
+
- Add comments explaining each variable
|
| 380 |
+
|
| 381 |
+
5. **Fix CLAUDE.md inaccuracies**:
|
| 382 |
+
- Line 34: Correct uvicorn command
|
| 383 |
+
- Line 79: Fix `init_schema()` → `initialize()`
|
| 384 |
+
- Line 110: Clarify route count or update to 18
|
| 385 |
+
|
| 386 |
+
### 🟡 IMPORTANT (Should fix)
|
| 387 |
+
|
| 388 |
+
6. **Update backend/pyproject.toml**
|
| 389 |
+
- Fix name: `Documentation-MCP` → `document-mcp`
|
| 390 |
+
- Add proper description
|
| 391 |
+
- Add author, repository, keywords
|
| 392 |
+
|
| 393 |
+
7. **Replace frontend/README.md**
|
| 394 |
+
- Remove Vite template content
|
| 395 |
+
- Add project-specific frontend docs
|
| 396 |
+
|
| 397 |
+
8. **Create backend/README.md**
|
| 398 |
+
- Installation guide
|
| 399 |
+
- Testing instructions
|
| 400 |
+
- Architecture overview
|
| 401 |
+
|
| 402 |
+
9. **Delete or hide GEMINI.md**
|
| 403 |
+
- Auto-generated, not useful publicly
|
| 404 |
+
- Move to `.specify/` if needed internally
|
| 405 |
+
|
| 406 |
+
### 🟢 NICE TO HAVE (Optional improvements)
|
| 407 |
+
|
| 408 |
+
10. **Add CONTRIBUTING.md**
|
| 409 |
+
- Contribution guidelines
|
| 410 |
+
- Code style requirements
|
| 411 |
+
- PR process
|
| 412 |
+
|
| 413 |
+
11. **Add CHANGELOG.md**
|
| 414 |
+
- Version history
|
| 415 |
+
- Breaking changes
|
| 416 |
+
- Migration guides
|
| 417 |
+
|
| 418 |
+
12. **Expand docs/ folder**
|
| 419 |
+
- Architecture diagrams
|
| 420 |
+
- API reference
|
| 421 |
+
- Deployment guides per platform
|
| 422 |
+
|
| 423 |
+
---
|
| 424 |
+
|
| 425 |
+
## Code Quality Cross-Check
|
| 426 |
+
|
| 427 |
+
### Python Code ✅
|
| 428 |
+
- All imports in CLAUDE.md verified working
|
| 429 |
+
- Service layer structure matches documentation
|
| 430 |
+
- Database schema matches DDL statements
|
| 431 |
+
|
| 432 |
+
### TypeScript/React Code ✅
|
| 433 |
+
- Component hierarchy matches CLAUDE.md
|
| 434 |
+
- Dependencies in package.json match documentation
|
| 435 |
+
|
| 436 |
+
### MCP Integration ✅
|
| 437 |
+
- Server file exists at documented location
|
| 438 |
+
- Transport modes (STDIO/HTTP) documented correctly
|
| 439 |
+
- Configuration examples are accurate
|
| 440 |
+
|
| 441 |
+
---
|
| 442 |
+
|
| 443 |
+
## Security & Privacy Check
|
| 444 |
+
|
| 445 |
+
### Exposed Information ❌
|
| 446 |
+
- **DEPLOY_TO_HF.md**: Contains username `YOUR_USERNAME`
|
| 447 |
+
- No API keys or secrets exposed ✅
|
| 448 |
+
- No real JWT tokens in examples ✅
|
| 449 |
+
|
| 450 |
+
### Placeholder Patterns ✅
|
| 451 |
+
- Appropriate use of `YOUR_USERNAME` in public docs
|
| 452 |
+
- Example tokens are clearly fake
|
| 453 |
+
- Environment variables use placeholder values
|
| 454 |
+
|
| 455 |
+
---
|
| 456 |
+
|
| 457 |
+
## Conclusion
|
| 458 |
+
|
| 459 |
+
The Document-MCP documentation is **well-written and comprehensive** but needs **critical fixes before public release**:
|
| 460 |
+
|
| 461 |
+
### Must-Fix Checklist
|
| 462 |
+
- [ ] Create LICENSE file
|
| 463 |
+
- [ ] Remove/anonymize DEPLOY_TO_HF.md
|
| 464 |
+
- [ ] Replace `YOUR_REPO` placeholder in README.md
|
| 465 |
+
- [ ] Expand .env.example with all variables
|
| 466 |
+
- [ ] Fix CLAUDE.md command inaccuracies
|
| 467 |
+
- [ ] Update backend/pyproject.toml metadata
|
| 468 |
+
- [ ] Replace generic frontend/README.md
|
| 469 |
+
- [ ] Delete or move GEMINI.md
|
| 470 |
+
|
| 471 |
+
### Quality Score: 7.5/10
|
| 472 |
+
**Breakdown**:
|
| 473 |
+
- Technical accuracy: 8/10 (few minor inaccuracies)
|
| 474 |
+
- Completeness: 7/10 (missing LICENSE, sparse READMEs)
|
| 475 |
+
- Professionalism: 6/10 (personal info, placeholders)
|
| 476 |
+
- Usability: 9/10 (clear, well-organized)
|
| 477 |
+
|
| 478 |
+
**Estimated time to fix**: 2-3 hours
|
| 479 |
+
|
| 480 |
+
---
|
| 481 |
+
|
| 482 |
+
## Confidence Assessment
|
| 483 |
+
|
| 484 |
+
**Confidence Level**: 9/10
|
| 485 |
+
|
| 486 |
+
**Reasoning**:
|
| 487 |
+
- Manually verified file structure against documentation
|
| 488 |
+
- Tested import paths and commands
|
| 489 |
+
- Cross-referenced schema definitions
|
| 490 |
+
- Counted actual routes in codebase
|
| 491 |
+
- Found both critical and minor issues
|
| 492 |
+
- Some uncertainty remains on MCP tool count (need to verify against actual MCP server implementation)
|
ai-notes/hf-deployment-complete.md
CHANGED
|
@@ -75,14 +75,14 @@ You'll need to add these secrets in HF Space settings:
|
|
| 75 |
JWT_SECRET_KEY=<generate with: openssl rand -hex 32>
|
| 76 |
HF_OAUTH_CLIENT_ID=<from your OAuth app>
|
| 77 |
HF_OAUTH_CLIENT_SECRET=<from your OAuth app>
|
| 78 |
-
HF_SPACE_URL=https://huggingface.co/spaces/
|
| 79 |
```
|
| 80 |
|
| 81 |
### 2. Push to HF Space
|
| 82 |
|
| 83 |
```bash
|
| 84 |
# Clone your HF Space repo
|
| 85 |
-
git clone https://huggingface.co/spaces/
|
| 86 |
cd Document-MCP
|
| 87 |
|
| 88 |
# Copy project files
|
|
@@ -100,7 +100,7 @@ git push
|
|
| 100 |
### 3. Test the Deployment
|
| 101 |
|
| 102 |
1. Wait for HF Spaces to build (5-10 minutes)
|
| 103 |
-
2. Visit: `https://
|
| 104 |
3. Click "Sign in with Hugging Face"
|
| 105 |
4. Browse the demo notes
|
| 106 |
5. Go to Settings to get your API token
|
|
@@ -111,7 +111,7 @@ git push
|
|
| 111 |
After deployment, test MCP access:
|
| 112 |
|
| 113 |
```bash
|
| 114 |
-
curl -X POST "https://
|
| 115 |
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
|
| 116 |
-H "Content-Type: application/json"
|
| 117 |
```
|
|
|
|
| 75 |
JWT_SECRET_KEY=<generate with: openssl rand -hex 32>
|
| 76 |
HF_OAUTH_CLIENT_ID=<from your OAuth app>
|
| 77 |
HF_OAUTH_CLIENT_SECRET=<from your OAuth app>
|
| 78 |
+
HF_SPACE_URL=https://huggingface.co/spaces/YOUR_USERNAME/Document-MCP
|
| 79 |
```
|
| 80 |
|
| 81 |
### 2. Push to HF Space
|
| 82 |
|
| 83 |
```bash
|
| 84 |
# Clone your HF Space repo
|
| 85 |
+
git clone https://huggingface.co/spaces/YOUR_USERNAME/Document-MCP
|
| 86 |
cd Document-MCP
|
| 87 |
|
| 88 |
# Copy project files
|
|
|
|
| 100 |
### 3. Test the Deployment
|
| 101 |
|
| 102 |
1. Wait for HF Spaces to build (5-10 minutes)
|
| 103 |
+
2. Visit: `https://YOUR_USERNAME-document-mcp.hf.space` (or your actual URL)
|
| 104 |
3. Click "Sign in with Hugging Face"
|
| 105 |
4. Browse the demo notes
|
| 106 |
5. Go to Settings to get your API token
|
|
|
|
| 111 |
After deployment, test MCP access:
|
| 112 |
|
| 113 |
```bash
|
| 114 |
+
curl -X POST "https://YOUR_USERNAME-document-mcp.hf.space/mcp/list_notes" \
|
| 115 |
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
|
| 116 |
-H "Content-Type: application/json"
|
| 117 |
```
|
ai-notes/ui-fix-required.md
CHANGED
|
@@ -9,7 +9,7 @@ PostCSS is still loading cached Tailwind CSS v4 modules even though we've downgr
|
|
| 9 |
```bash
|
| 10 |
# Stop the current dev server (Ctrl+C)
|
| 11 |
# Then restart:
|
| 12 |
-
cd /
|
| 13 |
npm run dev
|
| 14 |
```
|
| 15 |
|
|
|
|
| 9 |
```bash
|
| 10 |
# Stop the current dev server (Ctrl+C)
|
| 11 |
# Then restart:
|
| 12 |
+
cd $PROJECT_ROOT/frontend
|
| 13 |
npm run dev
|
| 14 |
```
|
| 15 |
|
backend/pyproject.toml
CHANGED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
[project]
|
| 2 |
-
name = "
|
| 3 |
version = "0.1.0"
|
| 4 |
-
description = "
|
| 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/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/
|
| 274 |
"headers": {
|
| 275 |
"Authorization": "Bearer YOUR_JWT_TOKEN"
|
| 276 |
}
|
|
|
|
| 270 |
{
|
| 271 |
"mcpServers": {
|
| 272 |
"obsidian-docs": {
|
| 273 |
+
"url": "https://huggingface.co/spaces/YOUR_USERNAME/Document-MCP/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.
|
| 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",
|
scripts/test_mcp_tools.py
CHANGED
|
@@ -19,7 +19,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
| 19 |
parser = argparse.ArgumentParser(description="Test MCP HTTP tools end-to-end")
|
| 20 |
parser.add_argument(
|
| 21 |
"--url",
|
| 22 |
-
default=os.environ.get("MCP_URL", "https://
|
| 23 |
help="Hosted MCP endpoint base URL",
|
| 24 |
)
|
| 25 |
parser.add_argument(
|
|
|
|
| 19 |
parser = argparse.ArgumentParser(description="Test MCP HTTP tools end-to-end")
|
| 20 |
parser.add_argument(
|
| 21 |
"--url",
|
| 22 |
+
default=os.environ.get("MCP_URL", "https://YOUR_USERNAME-document-mcp.hf.space/mcp"),
|
| 23 |
help="Hosted MCP endpoint base URL",
|
| 24 |
)
|
| 25 |
parser.add_argument(
|