Skip to content

Commit dbde847

Browse files
committed
fix: condition the application tools to env variables
The application tools 'export_docling_document_to_vector_db' and 'search_documents' are imported in 'server.py' depending on the environmental variables. Signed-off-by: Cesar Berrospi Ramis <75900930+ceberam@users.noreply.github.com>
1 parent 5449451 commit dbde847

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docling_mcp/server.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
"""This module initializes and runs the Docling MCP server."""
22

3+
import os
4+
35
from docling_mcp.logger import setup_logger
46
from docling_mcp.shared import mcp
5-
from docling_mcp.tools.applications import (
6-
export_docling_document_to_vector_db,
7-
search_documents,
8-
)
97
from docling_mcp.tools.conversion import (
108
convert_pdf_document_into_json_docling_document_from_uri_path,
119
is_document_in_local_cache,
@@ -22,6 +20,16 @@
2220
save_docling_document,
2321
)
2422

23+
if (
24+
os.getenv("RAG_ENABLED") == "true"
25+
and os.getenv("OLLAMA_MODEL") != ""
26+
and os.getenv("EMBEDDING_MODEL") != ""
27+
):
28+
from docling_mcp.tools.applications import (
29+
export_docling_document_to_vector_db,
30+
search_documents,
31+
)
32+
2533

2634
def main() -> None:
2735
"""Initialize and run the Docling MCP server."""

0 commit comments

Comments
 (0)