Skip to content

Commit 078dc67

Browse files
authored
[RELEASE] 0.2.5 (#39)
1 parent 0aaaa13 commit 078dc67

File tree

5 files changed

+687
-198
lines changed

5 files changed

+687
-198
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.5] - 06/18/2025
9+
10+
- Update chromadb to 1.0.13
11+
- Simplify configuration instantiation
12+
- Clarify list_collection success with no collections
13+
- Remove Optional parameters, replace with | None
14+
815
## [0.2.4] - 05/21/2025
916

1017
### Changed

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "chroma-mcp"
3-
version = "0.2.4"
3+
version = "0.2.5"
44
description = "Chroma MCP Server - Vector Database Integration for LLM Applications"
55
readme = "README.md"
66
requires-python = ">=3.10"
@@ -16,7 +16,7 @@ classifiers = [
1616
"Topic :: Software Development :: Libraries :: Python Modules"
1717
]
1818
dependencies = [
19-
"chromadb>=1.0.10",
19+
"chromadb>=1.0.13",
2020
"cohere>=5.14.2",
2121
"httpx>=0.28.1",
2222
"mcp[cli]>=1.2.1",
@@ -41,6 +41,9 @@ build-backend = "hatchling.build"
4141
[project.scripts]
4242
chroma-mcp = "chroma_mcp:main"
4343

44+
[project.optional-dependencies]
45+
sentence-transformers = ["sentence-transformers>=4.1.0"]
46+
4447
[tool.pytest.ini_options]
4548
testpaths = ["tests"]
4649
python_files = ["test_*.py"]

src/chroma_mcp/server.py

Lines changed: 2 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
from chromadb.api.collection_configuration import (
17-
CreateCollectionConfiguration, CreateHNSWConfiguration, UpdateHNSWConfiguration, UpdateCollectionConfiguration
17+
CreateCollectionConfiguration
1818
)
1919
from chromadb.api import EmbeddingFunction
2020
from chromadb.utils.embedding_functions import (
@@ -80,7 +80,6 @@ def get_chroma_client(args=None):
8080

8181
# Load environment variables from .env file if it exists
8282
load_dotenv(dotenv_path=args.dotenv_path)
83-
print(args.dotenv_path)
8483
if args.client_type == 'http':
8584
if not args.host:
8685
raise ValueError("Host must be provided via --host flag or CHROMA_HOST environment variable when using HTTP client")
@@ -182,57 +181,19 @@ async def chroma_create_collection(
182181
collection_name: str,
183182
embedding_function_name: str = "default",
184183
metadata: Dict | None = None,
185-
space: str | None = None,
186-
ef_construction: int | None = None,
187-
ef_search: int | None = None,
188-
max_neighbors: int | None = None,
189-
num_threads: int | None = None,
190-
batch_size: int | None = None,
191-
sync_threshold: int | None = None,
192-
resize_factor: float | None = None,
193184
) -> str:
194185
"""Create a new Chroma collection with configurable HNSW parameters.
195186
196187
Args:
197188
collection_name: Name of the collection to create
198-
space: Distance function used in HNSW index. Options: 'l2', 'ip', 'cosine'
199-
ef_construction: Size of the dynamic candidate list for constructing the HNSW graph
200-
ef_search: Size of the dynamic candidate list for searching the HNSW graph
201-
max_neighbors: Maximum number of neighbors to consider during HNSW graph construction
202-
num_threads: Number of threads to use during HNSW construction
203-
batch_size: Number of elements to batch together during index construction
204-
sync_threshold: Number of elements to process before syncing index to disk
205-
resize_factor: Factor to resize the index by when it's full
206189
embedding_function_name: Name of the embedding function to use. Options: 'default', 'cohere', 'openai', 'jina', 'voyageai', 'ollama', 'roboflow'
207190
metadata: Optional metadata dict to add to the collection
208191
"""
209192
client = get_chroma_client()
210-
211193

212194
embedding_function = mcp_known_embedding_functions[embedding_function_name]
213195

214-
hnsw_config = CreateHNSWConfiguration()
215-
if space:
216-
hnsw_config["space"] = space
217-
if ef_construction:
218-
hnsw_config["ef_construction"] = ef_construction
219-
if ef_search:
220-
hnsw_config["ef_search"] = ef_search
221-
if max_neighbors:
222-
hnsw_config["max_neighbors"] = max_neighbors
223-
if num_threads:
224-
hnsw_config["num_threads"] = num_threads
225-
if batch_size:
226-
hnsw_config["batch_size"] = batch_size
227-
if sync_threshold:
228-
hnsw_config["sync_threshold"] = sync_threshold
229-
if resize_factor:
230-
hnsw_config["resize_factor"] = resize_factor
231-
232-
233-
234196
configuration=CreateCollectionConfiguration(
235-
hnsw=hnsw_config,
236197
embedding_function=embedding_function()
237198
)
238199

@@ -310,52 +271,24 @@ async def chroma_modify_collection(
310271
collection_name: str,
311272
new_name: str | None = None,
312273
new_metadata: Dict | None = None,
313-
ef_search: int | None = None,
314-
num_threads: int | None = None,
315-
batch_size: int | None = None,
316-
sync_threshold: int | None = None,
317-
resize_factor: float | None = None,
318274
) -> str:
319275
"""Modify a Chroma collection's name or metadata.
320276
321277
Args:
322278
collection_name: Name of the collection to modify
323279
new_name: Optional new name for the collection
324280
new_metadata: Optional new metadata for the collection
325-
ef_search: Size of the dynamic candidate list for searching the HNSW graph
326-
num_threads: Number of threads to use during HNSW construction
327-
batch_size: Number of elements to batch together during index construction
328-
sync_threshold: Number of elements to process before syncing index to disk
329-
resize_factor: Factor to resize the index by when it's full
330281
"""
331282
client = get_chroma_client()
332283
try:
333284
collection = client.get_collection(collection_name)
334-
335-
hnsw_config = UpdateHNSWConfiguration()
336-
if ef_search:
337-
hnsw_config["ef_search"] = ef_search
338-
if num_threads:
339-
hnsw_config["num_threads"] = num_threads
340-
if batch_size:
341-
hnsw_config["batch_size"] = batch_size
342-
if sync_threshold:
343-
hnsw_config["sync_threshold"] = sync_threshold
344-
if resize_factor:
345-
hnsw_config["resize_factor"] = resize_factor
346-
347-
configuration = UpdateCollectionConfiguration(
348-
hnsw=hnsw_config
349-
)
350-
collection.modify(name=new_name, configuration=configuration, metadata=new_metadata)
285+
collection.modify(name=new_name, metadata=new_metadata)
351286

352287
modified_aspects = []
353288
if new_name:
354289
modified_aspects.append("name")
355290
if new_metadata:
356291
modified_aspects.append("metadata")
357-
if ef_search or num_threads or batch_size or sync_threshold or resize_factor:
358-
modified_aspects.append("hnsw")
359292

360293
return f"Successfully modified collection {collection_name}: updated {' and '.join(modified_aspects)}"
361294
except Exception as e:
@@ -662,30 +595,6 @@ def validate_thought_data(input_data: Dict) -> Dict:
662595
"branchId": input_data.get("branchId"),
663596
"needsMoreThoughts": input_data.get("needsMoreThoughts"),
664597
}
665-
666-
def process_thought(input_data: Dict) -> Dict:
667-
"""Process a new thought."""
668-
try:
669-
# Validate input data
670-
validated_input = validate_thought_data(input_data)
671-
672-
# Adjust total thoughts if needed
673-
if validated_input["thoughtNumber"] > validated_input["totalThoughts"]:
674-
validated_input["totalThoughts"] = validated_input["thoughtNumber"]
675-
676-
# Return response
677-
return {
678-
"sessionId": validated_input["sessionId"],
679-
"thoughtNumber": validated_input["thoughtNumber"],
680-
"totalThoughts": validated_input["totalThoughts"],
681-
"nextThoughtNeeded": validated_input["nextThoughtNeeded"],
682-
}
683-
684-
except Exception as e:
685-
return {
686-
"error": str(e),
687-
"status": "failed"
688-
}
689598

690599
def main():
691600
"""Entry point for the Chroma MCP server."""

tests/test_server.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -564,18 +564,9 @@ async def test_create_collection_success():
564564
hnsw_collection = "test_hnsw_collection"
565565
hnsw_params = {
566566
"collection_name": hnsw_collection,
567-
"space": "cosine",
568-
"ef_construction": 100,
569-
"ef_search": 50,
570-
"max_neighbors": 16 # Assuming M corresponds to max_neighbors
571567
}
572568
hnsw_result = await mcp.call_tool("chroma_create_collection", hnsw_params)
573569
assert "Successfully created collection" in hnsw_result[0].text
574-
# Check if the specific config values are in the output string
575-
assert "'space': 'cosine'" in hnsw_result[0].text
576-
assert "'ef_construction': 100" in hnsw_result[0].text
577-
assert "'ef_search': 50" in hnsw_result[0].text
578-
assert "'max_neighbors': 16" in hnsw_result[0].text
579570

580571
finally:
581572
# Cleanup: delete the collections if they exist

0 commit comments

Comments
 (0)