Skip to content

Commit 797e14f

Browse files
committed
Bump version: 0.1.24 → 0.1.25
1 parent 6f48f00 commit 797e14f

File tree

6 files changed

+75
-49
lines changed

6 files changed

+75
-49
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.1.24
2+
current_version = 0.1.25
33
commit = True
44
tag = True
55

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ ENV HOST=${HOST} \
5454
RUN apt-get update \
5555
&& apt-get install -y ripgrep tree fd-find curl nano \
5656
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
57-
&& uv pip install --system --upgrade --verbose --no-cache --break-system-packages --prerelease=allow documentdb-mcp[all]>=0.1.24
57+
&& uv pip install --system --upgrade --verbose --no-cache --break-system-packages --prerelease=allow documentdb-mcp[all]>=0.1.25
5858

5959
CMD ["documentdb-mcp"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
![PyPI - Wheel](https://img.shields.io/pypi/wheel/documentdb-mcp)
2222
![PyPI - Implementation](https://img.shields.io/pypi/implementation/documentdb-mcp)
2323

24-
*Version: 0.1.24*
24+
*Version: 0.1.25*
2525

2626
## Overview
2727

documentdb_mcp/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
load_identity,
1212
)
1313

14-
__version__ = "0.1.24"
14+
__version__ = "0.1.25"
1515

1616
logging.basicConfig(
1717
level=logging.INFO,

documentdb_mcp/mcp.py

Lines changed: 65 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/python
22
# coding: utf-8
33

4+
from dotenv import load_dotenv, find_dotenv
5+
from agent_utilities.base_utilities import to_boolean
46
import os
57
import sys
68
import logging
@@ -32,7 +34,7 @@
3234
JWTClaimsLoggingMiddleware,
3335
)
3436

35-
__version__ = "0.1.24"
37+
__version__ = "0.1.25"
3638

3739
logger = get_logger(name="TokenMiddleware")
3840
logger.setLevel(logging.DEBUG)
@@ -84,11 +86,12 @@ def serialize_oid(data: Any) -> Any:
8486
return data
8587

8688

87-
def register_tools(mcp: FastMCP):
88-
@mcp.custom_route("/health", methods=["GET"])
89+
def register_misc_tools(mcp: FastMCP):
8990
async def health_check(request: Request) -> JSONResponse:
9091
return JSONResponse({"status": "OK"})
9192

93+
94+
def register_system_tools(mcp: FastMCP):
9295
@mcp.tool(tags={"system"})
9396
def binary_version() -> str:
9497
"""Get the binary version of the server (using buildInfo)."""
@@ -114,6 +117,8 @@ def run_command(database_name: str, command: Dict[str, Any]) -> Dict[str, Any]:
114117
result = db.command(cmd)
115118
return serialize_oid(result)
116119

120+
121+
def register_collections_tools(mcp: FastMCP):
117122
@mcp.tool(tags={"collections"})
118123
def list_collections(database_name: str) -> List[str]:
119124
"""List all collections in a specific database."""
@@ -179,6 +184,8 @@ def rename_collection(database_name: str, old_name: str, new_name: str) -> str:
179184
except PyMongoError as e:
180185
return f"Error renaming collection: {str(e)}"
181186

187+
188+
def register_users_tools(mcp: FastMCP):
182189
@mcp.tool(tags={"users"})
183190
def create_user(
184191
database_name: str, username: str, password: str, roles: List[Any]
@@ -240,6 +247,8 @@ def users_info(database_name: str, username: str) -> Dict[str, Any]:
240247
except PyMongoError as e:
241248
return {"error": str(e)}
242249

250+
251+
def register_crud_tools(mcp: FastMCP):
243252
@mcp.tool(tags={"crud"})
244253
def insert_one(
245254
database_name: str, collection_name: str, document: Dict[str, Any]
@@ -425,38 +434,6 @@ def count_documents(
425434
logger.error(f"Error counting documents: {e}")
426435
return -1
427436

428-
@mcp.tool(tags={"analysis"})
429-
def distinct(
430-
database_name: str, collection_name: str, key: str, filter: Dict[str, Any]
431-
) -> List[Any]:
432-
"""Find distinct values for a key."""
433-
client = get_client()
434-
db = client[database_name]
435-
col = db[collection_name]
436-
query = parse_json_arg(filter)
437-
try:
438-
return col.distinct(key, query)
439-
except PyMongoError as e:
440-
return [f"Error getting distinct values: {str(e)}"]
441-
442-
@mcp.tool(tags={"analysis"})
443-
def aggregate(
444-
database_name: str, collection_name: str, pipeline: List[Dict[str, Any]]
445-
) -> List[Dict[str, Any]]:
446-
"""Run an aggregation pipeline."""
447-
client = get_client()
448-
db = client[database_name]
449-
col = db[collection_name]
450-
pipe = parse_json_arg(pipeline)
451-
try:
452-
cursor = col.aggregate(pipe)
453-
results = []
454-
for doc in cursor:
455-
results.append(serialize_oid(doc))
456-
return results
457-
except PyMongoError as e:
458-
return [{"error": str(e)}]
459-
460437
@mcp.tool(tags={"crud"})
461438
def find_one_and_update(
462439
database_name: str,
@@ -529,6 +506,40 @@ def find_one_and_delete(
529506
return {"error": str(e)}
530507

531508

509+
def register_analysis_tools(mcp: FastMCP):
510+
@mcp.tool(tags={"analysis"})
511+
def distinct(
512+
database_name: str, collection_name: str, key: str, filter: Dict[str, Any]
513+
) -> List[Any]:
514+
"""Find distinct values for a key."""
515+
client = get_client()
516+
db = client[database_name]
517+
col = db[collection_name]
518+
query = parse_json_arg(filter)
519+
try:
520+
return col.distinct(key, query)
521+
except PyMongoError as e:
522+
return [f"Error getting distinct values: {str(e)}"]
523+
524+
@mcp.tool(tags={"analysis"})
525+
def aggregate(
526+
database_name: str, collection_name: str, pipeline: List[Dict[str, Any]]
527+
) -> List[Dict[str, Any]]:
528+
"""Run an aggregation pipeline."""
529+
client = get_client()
530+
db = client[database_name]
531+
col = db[collection_name]
532+
pipe = parse_json_arg(pipeline)
533+
try:
534+
cursor = col.aggregate(pipe)
535+
results = []
536+
for doc in cursor:
537+
results.append(serialize_oid(doc))
538+
return results
539+
except PyMongoError as e:
540+
return [{"error": str(e)}]
541+
542+
532543
def register_prompts(mcp: FastMCP):
533544
print(f"documentdb_mcp v{__version__}")
534545

@@ -541,6 +552,7 @@ def create_user_prompt(user: str) -> str:
541552

542553

543554
def mcp_server():
555+
load_dotenv(find_dotenv())
544556
parser = create_mcp_parser()
545557
parser.description = "DocumentDB MCP Server"
546558
args = parser.parse_args()
@@ -843,7 +855,24 @@ def mcp_server():
843855
sys.exit(1)
844856

845857
mcp = FastMCP("DocumentDB", auth=auth)
846-
register_tools(mcp)
858+
DEFAULT_MISCTOOL = to_boolean(os.getenv("MISCTOOL", "True"))
859+
if DEFAULT_MISCTOOL:
860+
register_misc_tools(mcp)
861+
DEFAULT_SYSTEMTOOL = to_boolean(os.getenv("SYSTEMTOOL", "True"))
862+
if DEFAULT_SYSTEMTOOL:
863+
register_system_tools(mcp)
864+
DEFAULT_COLLECTIONSTOOL = to_boolean(os.getenv("COLLECTIONSTOOL", "True"))
865+
if DEFAULT_COLLECTIONSTOOL:
866+
register_collections_tools(mcp)
867+
DEFAULT_USERSTOOL = to_boolean(os.getenv("USERSTOOL", "True"))
868+
if DEFAULT_USERSTOOL:
869+
register_users_tools(mcp)
870+
DEFAULT_CRUDTOOL = to_boolean(os.getenv("CRUDTOOL", "True"))
871+
if DEFAULT_CRUDTOOL:
872+
register_crud_tools(mcp)
873+
DEFAULT_ANALYSISTOOL = to_boolean(os.getenv("ANALYSISTOOL", "True"))
874+
if DEFAULT_ANALYSISTOOL:
875+
register_analysis_tools(mcp)
847876
register_prompts(mcp)
848877

849878
for mw in middlewares:

pyproject.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "documentdb-mcp"
7-
version = "0.1.24"
7+
version = "0.1.25"
88
description = "DocumentDB MCP Server & A2A Server. DocumentDB is a MongoDB compatible open source document database built on PostgreSQL."
99
readme = "README.md"
1010
authors = [{ name = "Audel Rouhi", email = "knucklessg1@gmail.com" }]
@@ -14,29 +14,26 @@ classifiers = [
1414
"License :: Public Domain",
1515
"Environment :: Console",
1616
"Operating System :: POSIX :: Linux",
17-
"Programming Language :: Python :: 3",
18-
]
17+
"Programming Language :: Python :: 3"]
1918
requires-python = ">=3.10"
2019
dependencies = [
21-
"agent-utilities[mcp]>=0.2.11",
20+
"agent-utilities[mcp]>=0.2.12",
2221
"pymongo>=4.0"
2322
]
2423

2524
[project.optional-dependencies]
2625
agent = [
27-
"agent-utilities[agent,logfire]>=0.2.11",
28-
]
26+
"agent-utilities[agent,logfire]>=0.2.12"]
2927

3028
all = [
31-
"agent-utilities[mcp,agent,logfire]>=0.2.11",
32-
]
29+
"agent-utilities[mcp,agent,logfire]>=0.2.12"]
3330

3431
[project.scripts]
3532
documentdb-mcp = "documentdb_mcp.mcp:mcp_server"
3633
documentdb-agent = "documentdb_mcp.agent:agent_server"
3734

3835
[tool.setuptools.package-data]
39-
documentdb_mcp = [ "mcp_config.json", "skills/**", "agent/**",]
36+
documentdb_mcp = [ "mcp_config.json", "agent/**"]
4037

4138
[tool.setuptools.packages.find]
4239
where = ["."]

0 commit comments

Comments
 (0)