mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
* 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. * feat: improve docs search --------- Co-authored-by: Abhishek Kumar <abhishek@a6k.me> |
||
|---|---|---|
| .. | ||
| dto_fixtures | ||
| integrations | ||
| support | ||
| telephony/telnyx | ||
| __init__.py | ||
| conftest.py | ||
| test_add_call_disposition_code.py | ||
| test_aggregation_fix.py | ||
| test_camb_tts_integration.py | ||
| test_campaign_call_dispatcher.py | ||
| test_campaign_tasks.py | ||
| test_circuit_breaker.py | ||
| test_cost_calculator.py | ||
| test_custom_tools.py | ||
| test_custom_tools_context_integration.py | ||
| test_display_options_evaluator.py | ||
| test_dograh_sdk.py | ||
| test_dograh_sdk_typed.py | ||
| test_dto.py | ||
| test_from_number_pool_isolation.py | ||
| test_gemini_live_reconnect_tool_results.py | ||
| test_get_backend_endpoints.py | ||
| test_is_private_ip_candidate.py | ||
| test_json_parser.py | ||
| test_layout.py | ||
| test_masked_key_rejection.py | ||
| test_mcp_auth.py | ||
| test_mcp_custom_tool_manager.py | ||
| test_mcp_docs_search.py | ||
| test_mcp_integration.py | ||
| test_mcp_save_workflow.py | ||
| test_mcp_tool_definition.py | ||
| test_mcp_tool_route.py | ||
| test_mcp_tool_session.py | ||
| test_node_specs.py | ||
| test_openai_realtime_initial_context.py | ||
| test_pipecat_engine_context_update.py | ||
| test_pipecat_engine_end_call.py | ||
| test_pipecat_engine_node_switch_with_user_speech.py | ||
| test_pipecat_engine_tool_calls.py | ||
| test_pipecat_engine_transition_mute.py | ||
| test_pipecat_engine_variable_extraction.py | ||
| test_pipeline_cancellation.py | ||
| test_realtime_message_append.py | ||
| test_recording_router_processor.py | ||
| test_resolve_effective_config.py | ||
| test_run_pipeline_realtime_turn_config.py | ||
| test_sdk_sync.py | ||
| test_speaches_service_factory.py | ||
| test_telephony_factory.py | ||
| test_text_and_audio_playback.py | ||
| test_ts_bridge.py | ||
| test_tts_endframe_with_audio_write_failure.py | ||
| test_unregistered_function_call.py | ||
| test_user_idle_handler.py | ||
| test_user_muting_during_bot_speech.py | ||
| test_voicemail_detector.py | ||
| test_workflow_graph_constraints.py | ||
| test_workflow_qa_masking.py | ||
| test_workflow_versioning.py | ||