Skip to content

Conversation

MH0386
Copy link

@MH0386 MH0386 commented Jul 25, 2025

By default, environment variables are parsed verbatim, so this pull request updates the QdrantSettings configuration in src/mcp_server_qdrant/settings.py to enhance environment variable parsing and improve maintainability. The key changes include importing SettingsConfigDict and adding a model_config attribute for handling None string values in environment variables.

Changes to environment variable parsing:

  • src/mcp_server_qdrant/settings.py: Added SettingsConfigDict to the imports and introduced a model_config attribute in the QdrantSettings class to ensure that the string "None" is parsed as None for environment variables.

Before:

$ QDRANT_URL="http://localhost:6333" COLLECTION_NAME="my-collection" QDRANT_LOCAL_PATH=None uv run mcp-server-qdrant --transport sse
Traceback (most recent call last):
  File "/mnt/d/Sync/Development/mcp-server-qdrant/.venv/bin/mcp-server-qdrant", line 10, in <module>
    sys.exit(main())
  File "/mnt/d/Sync/Development/mcp-server-qdrant/src/mcp_server_qdrant/main.py", line 22, in main
    from mcp_server_qdrant.server import mcp
  File "/mnt/d/Sync/Development/mcp-server-qdrant/src/mcp_server_qdrant/server.py", line 10, in <module>
    qdrant_settings=QdrantSettings(),
  File "/mnt/d/Sync/Development/mcp-server-qdrant/.venv/lib/python3.10/site-packages/pydantic_settings/main.py", line 176, in __init__
    super().__init__(
  File "/mnt/d/Sync/Development/mcp-server-qdrant/.venv/lib/python3.10/site-packages/pydantic/main.py", line 253, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for QdrantSettings
  Value error, If 'local_path' is set, 'location' and 'api_key' must be None. [type=value_error, input_value={'QDRANT_URL': 'http://lo...ANT_LOCAL_PATH': 'None'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/value_error

After

$ QDRANT_URL="http://localhost:6333" COLLECTION_NAME="my-collection" QDRANT_LOCAL_PATH=None uv run
mcp-server-qdrant --transport sse
[07/25/25 21:47:25] INFO     Starting MCP server 'mcp-server-qdrant' with transport 'sse' on http://127.0.0.1:8000/sse                               server.py:1210
INFO:FastMCP.fastmcp.server.server:Starting MCP server 'mcp-server-qdrant' with transport 'sse' on http://127.0.0.1:8000/sse
INFO:     Started server process [10725]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

Why?

I plan to add Qdrant MCP to Docker MCP Registry. The problem is that the Docker MCP Registry's server configuration file server.yaml needs to specify all environment variables (options) for that MCP (Qdrant MCP).

@MH0386 MH0386 marked this pull request as ready for review July 25, 2025 20:16
@MH0386 MH0386 changed the title Add _env_parse_none_str configuration to QdrantSettings Add env_parse_none_str configuration to QdrantSettings Jul 31, 2025
@MH0386 MH0386 changed the title Add env_parse_none_str configuration to QdrantSettings Enhance environment variable parsing Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant