Fix compatibility with the previous versions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
import importlib.metadata
|
||||
from typing import Optional
|
||||
|
||||
import click
|
||||
@@ -11,6 +12,15 @@ from .embeddings.factory import create_embedding_provider
|
||||
from .qdrant import QdrantConnector
|
||||
|
||||
|
||||
def get_package_version() -> str:
|
||||
"""Get the package version using importlib.metadata."""
|
||||
try:
|
||||
return importlib.metadata.version("mcp-server-qdrant")
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
# Fall back to a default version if package is not installed
|
||||
return "0.0.0"
|
||||
|
||||
|
||||
def serve(
|
||||
qdrant_url: Optional[str],
|
||||
qdrant_api_key: Optional[str],
|
||||
@@ -140,6 +150,13 @@ def serve(
|
||||
required=True,
|
||||
help="Collection name",
|
||||
)
|
||||
@click.option(
|
||||
"--fastembed-model-name",
|
||||
envvar="FASTEMBED_MODEL_NAME",
|
||||
required=False,
|
||||
help="FastEmbed model name",
|
||||
default="sentence-transformers/all-MiniLM-L6-v2",
|
||||
)
|
||||
@click.option(
|
||||
"--embedding-provider",
|
||||
envvar="EMBEDDING_PROVIDER",
|
||||
@@ -165,6 +182,7 @@ def main(
|
||||
qdrant_url: Optional[str],
|
||||
qdrant_api_key: str,
|
||||
collection_name: Optional[str],
|
||||
fastembed_model_name: Optional[str],
|
||||
embedding_provider: str,
|
||||
embedding_model: str,
|
||||
qdrant_local_path: Optional[str],
|
||||
@@ -175,6 +193,14 @@ def main(
|
||||
"Exactly one of qdrant-url or qdrant-local-path must be provided"
|
||||
)
|
||||
|
||||
# Warn if fastembed_model_name is provided, as this is going to be deprecated
|
||||
if fastembed_model_name:
|
||||
click.echo(
|
||||
"Warning: --fastembed-model-name parameter is deprecated and will be removed in a future version. "
|
||||
"Please use --embedding-provider and --embedding-model instead",
|
||||
err=True,
|
||||
)
|
||||
|
||||
async def _run():
|
||||
async with mcp.server.stdio.stdio_server() as (read_stream, write_stream):
|
||||
server = serve(
|
||||
@@ -190,7 +216,7 @@ def main(
|
||||
write_stream,
|
||||
InitializationOptions(
|
||||
server_name="qdrant",
|
||||
server_version="0.5.1",
|
||||
server_version=get_package_version(),
|
||||
capabilities=server.get_capabilities(
|
||||
notification_options=NotificationOptions(),
|
||||
experimental_capabilities={},
|
||||
|
||||
Reference in New Issue
Block a user