dograh/api
supermario_leo 6d3c18975f feat(mcp): add search_docs tool over Mintlify docs corpus
Closes #295. The docs at https://docs.dograh.com promise "Search the
Dograh docs for how to configure a TURN server" as an MCP example
prompt, but no search_docs tool exists in the MCP server — agents can
list workspace resources but cannot search the documentation.

This adds a dependency-free, in-process keyword search over the
`docs/` tree shipped into the API image (`COPY ./docs ./docs`):

- New `api/mcp_server/tools/docs_search.py` — async `search_docs(query,
  limit=10)` with weighted scoring (path > title > body), a 25-result
  hard cap, snippet extraction around the first term hit, and graceful
  empty-list degradation when docs aren't on disk. `DOGRAH_DOCS_PATH`
  env var overrides location discovery for non-Docker layouts.

- Registered in `api/mcp_server/server.py` alongside the other tools,
  keeping the existing list-alphabetical convention.

- `api/tests/test_mcp_docs_search.py` — 18 unit tests covering the
  pure helpers (tokenizer, frontmatter stripping, title extraction,
  scoring weights, URL building) and end-to-end ranking, limit
  clamping, empty-corpus degradation, and input-validation errors.
  Mocks `authenticate_mcp_request` to avoid the DB dependency,
  mirroring `test_mcp_save_workflow.py`.

Implementation notes:
- The docs corpus is ~100 files / ~140k LoC, so a per-call scan runs
  well under 50 ms; avoiding a vector index / embedding backend keeps
  the tool zero-dependency and works for fully offline self-hosted
  deployments.
- Authentication is required for consistency with the other MCP tools
  (and to route through the existing rate-limit middleware), even
  though docs are not org-scoped data.
- Title/path matches deliberately outweigh body matches so a page
  whose subject IS the query term outranks one that merely mentions
  it incidentally.
2026-05-19 09:59:24 +08:00
..
alembic chore: remove looptalk (#299) 2026-05-16 17:45:12 +05:30
assets feat: telephony call transfer (#155) 2026-02-16 14:33:33 +05:30
db chore: remove looptalk (#299) 2026-05-16 17:45:12 +05:30
errors Feat/inbound telephony (#113) 2026-01-12 10:10:30 +05:30
mcp_server feat(mcp): add search_docs tool over Mintlify docs corpus 2026-05-19 09:59:24 +08:00
native/rnnoise Initial Commit 🚀 🚀 2025-09-09 14:37:32 +05:30
routes feat: add openai realtime models (#298) 2026-05-16 18:05:23 +05:30
schemas feat: agent stream for cloudonix OPBX (#261) 2026-05-02 15:53:58 +05:30
services fix: force FORCE_TURN_RELAY for local IPs in setup 2026-05-16 18:37:38 +05:30
tasks chore: add campaign id in render context for webhook 2026-05-12 19:32:41 +05:30
tests feat(mcp): add search_docs tool over Mintlify docs corpus 2026-05-19 09:59:24 +08:00
utils feat: add workflow graph constraints fixtures 2026-05-08 16:02:51 +05:30
.cursorignore Initial Commit 🚀 🚀 2025-09-09 14:37:32 +05:30
.dockerignore Initial Commit 🚀 🚀 2025-09-09 14:37:32 +05:30
.env.example fix: number pool initialization in multi telephony setup 2026-05-08 14:48:53 +05:30
.gitignore Initial Commit 🚀 🚀 2025-09-09 14:37:32 +05:30
__init__.py Initial Commit 🚀 🚀 2025-09-09 14:37:32 +05:30
AGENTS.md feat: refactor telephony to support multiple telephony configurations (#251) 2026-04-29 11:39:57 +05:30
alembic.ini chore: bump pipecat version and fix tests (#263) 2026-05-04 21:35:37 +05:30
app.py feat: refactor node spec and add mcp tools (#244) 2026-04-21 07:56:16 +05:30
CLAUDE.md Chore/add setup and contributing docs (#90) 2025-12-27 09:25:20 +05:30
conftest.py chore: bump pipecat version and fix tests (#263) 2026-05-04 21:35:37 +05:30
constants.py feat: verify telnyx webhook signature optionally (#279) 2026-05-12 19:47:28 +05:30
Dockerfile chore: update dev scripts and documentation 2026-05-12 13:54:33 +05:30
enums.py feat: add Plivo telephony provider support (#245) 2026-04-25 20:41:46 +05:30
logging_config.py feat: add headless mode, redesign floating widget, refactor lifecycle callbacks (#268) 2026-05-07 12:23:41 +05:30
pyproject.toml chore(main): release dograh 1.30.1 (#304) 2026-05-17 20:48:55 +05:30
pytest.ini feat: refactor node spec and add mcp tools (#244) 2026-04-21 07:56:16 +05:30
requirements.dev.txt feat: add headless mode, redesign floating widget, refactor lifecycle callbacks (#268) 2026-05-07 12:23:41 +05:30
requirements.txt Verify Telnyx webhook signatures (#271) 2026-05-12 18:37:31 +05:30
sdk_expose.py feat: refactor node spec and add mcp tools (#244) 2026-04-21 07:56:16 +05:30