APIVault is a local FastAPI app that turns raw route code or plain-English API descriptions into full API documentation and stores the results in Notion through HuggingFace's MCP client. The UI is a vanilla HTML/CSS/JS dashboard with live search, a documentation preview, and a source-vs-generated toggle.
POST /api/setupcreates or reuses the APIVault Notion workspace:📖 API Referencedatabase🏷️ Servicesdatabase📚 API Docshub page
POST /api/document-endpointdocuments a single endpoint, stores it in Notion, and returns the generated content plus the Notion URL.POST /api/document-collectionsplits a router/controller file into multiple endpoints and documents them in parallel.POST /api/generate-readmecreates a📄 [Service] — READMEpage from the endpoints already stored in Notion.GET /api/search?q=...searches the API reference for the dashboard.GET /api/sidebarfeeds the left-side navigation tree.vault.pyreads a local file and posts it to/api/document-collection.
APIVault prefers the Notion MCP package when it is installed. In lean local environments it can fall back to supported direct Notion REST calls, so the app can still import and serve the dashboard without the MCP dependency. NOTION_TOKEN is still expected to be a Notion MCP OAuth access token for the hosted MCP path.
- Create and activate a virtual environment.
- Install dependencies:
pip install -r requirements.txt- Copy the example env file and set your values:
cp .env.example .env- Start the FastAPI app:
uvicorn app.main:app --reload- Open http://127.0.0.1:8000.
Health, static pages, cached sidebar, and cached search work without provider secrets. Generation and write endpoints return explicit configuration errors until HF_API_KEY, NOTION_TOKEN, and NOTION_PARENT_PAGE_ID are configured. /api/health reports notion_transport so MCP stdio and REST fallback are not confused.
Optional environment:
CORS_ORIGINS: comma-separated browser origins allowed to call the API. Defaults to local Uvicorn origins.APIVAULT_MAX_BODY_BYTES: request size guard for write endpoints. Defaults to220000.HF_MODEL: Hugging Face chat model used for documentation generation.
If you already have HF_TOKEN loaded locally, APIVault uses it as a fallback when HF_API_KEY is unset. Keep Notion credentials in NOTION_TOKEN and NOTION_PARENT_PAGE_ID; the REST fallback raises sanitized errors for non-2xx responses or invalid Notion JSON.
python -m pytest
python -m compileall app tests vault.py
node --check app/static/app.jspython vault.py \
--file routes/users.py \
--service UserService \
--base-url https://api.example.com- The default Notion MCP transport is
https://mcp.notion.com/ssebecause that is what this project targets, butNOTION_MCP_URLis configurable. - The app keeps a local JSON cache in
data/apivault_state.jsonto make the sidebar and search feel responsive, but Notion remains the source of truth. - Keep
.env,data/apivault_state.json, caches, and generated output out of git.