Skip to content

Commit 48e701e

Browse files
Merge pull request #7 from appwrite/feat-improvements
fix: update appwrite SDK and add CLI args
2 parents 9ad5646 + 77223b6 commit 48e701e

File tree

3 files changed

+86
-16
lines changed

3 files changed

+86
-16
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
22
name = "mcp-server-appwrite"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
description = "MCP (Model Context Protocol) server for Appwrite"
55
readme = "README.md"
66
requires-python = ">=3.12"
77
dependencies = [
8-
"appwrite>=7.1.0",
8+
"appwrite>=9.0.2",
99
"mcp[cli]>=1.3.0",
1010
]
1111

src/mcp_server_appwrite/server.py

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
from __future__ import annotations
2+
from typing import List
13
import asyncio
24
import os
5+
import argparse
36
import mcp.server.stdio
47
import mcp.types as types
58
from mcp.server import NotificationOptions, Server
@@ -19,6 +22,19 @@
1922
from .tool_manager import ToolManager
2023
from .service import Service
2124

25+
def parse_args():
26+
parser = argparse.ArgumentParser(description='Appwrite MCP Server')
27+
parser.add_argument('--databases', action='store_true', help='Enable Databases service')
28+
parser.add_argument('--users', action='store_true', help='Enable Users service')
29+
parser.add_argument('--teams', action='store_true', help='Enable Teams service')
30+
parser.add_argument('--storage', action='store_true', help='Enable Storage service')
31+
parser.add_argument('--functions', action='store_true', help='Enable Functions service')
32+
parser.add_argument('--messaging', action='store_true', help='Enable Messaging service')
33+
parser.add_argument('--locale', action='store_true', help='Enable Locale service')
34+
parser.add_argument('--avatars', action='store_true', help='Enable Avatars service')
35+
parser.add_argument('--all', action='store_true', help='Enable all services')
36+
return parser.parse_args()
37+
2238
# Load environment variables from .env file
2339
load_dotenv()
2440

@@ -36,14 +52,37 @@
3652
client.set_project(project_id)
3753
client.set_key(api_key)
3854

39-
# Initialize tools manager and register services
55+
# Initialize tools manager
4056
tools_manager = ToolManager()
41-
tools_manager.register_service(Service(Users(client), "users"))
42-
# tools_manager.register_service(Service(Teams(client), "teams"))
43-
tools_manager.register_service(Service(Databases(client), "databases"))
44-
# tools_manager.register_service(Service(Storage(client), "storage"))
45-
# tools_manager.register_service(Service(Functions(client), "functions"))
46-
# tools_manager.register_service(Service(Messaging(client), "messaging"))
57+
58+
def register_services(args):
59+
# If --all is specified, enable all services
60+
if args.all:
61+
args.databases = args.users = args.teams = args.storage = True
62+
args.functions = args.messaging = args.locale = args.avatars = True
63+
64+
# Register services based on CLI arguments
65+
if args.databases:
66+
tools_manager.register_service(Service(Databases(client), "databases"))
67+
if args.users:
68+
tools_manager.register_service(Service(Users(client), "users"))
69+
if args.teams:
70+
tools_manager.register_service(Service(Teams(client), "teams"))
71+
if args.storage:
72+
tools_manager.register_service(Service(Storage(client), "storage"))
73+
if args.functions:
74+
tools_manager.register_service(Service(Functions(client), "functions"))
75+
if args.messaging:
76+
tools_manager.register_service(Service(Messaging(client), "messaging"))
77+
if args.locale:
78+
tools_manager.register_service(Service(Locale(client), "locale"))
79+
if args.avatars:
80+
tools_manager.register_service(Service(Avatars(client), "avatars"))
81+
82+
# If no services were specified, enable databases by default
83+
if not any([args.databases, args.users, args.teams, args.storage,
84+
args.functions, args.messaging, args.locale, args.avatars]):
85+
tools_manager.register_service(Service(Databases(client), "databases"))
4786

4887
async def serve() -> Server:
4988
server = Server("Appwrite MCP Server")
@@ -76,14 +115,17 @@ async def handle_call_tool(
76115
return server
77116

78117
async def _run():
118+
args = parse_args()
119+
register_services(args)
120+
79121
async with mcp.server.stdio.stdio_server() as (read_stream, write_stream):
80122
server = await serve()
81123
await server.run(
82124
read_stream,
83125
write_stream,
84126
InitializationOptions(
85127
server_name="appwrite",
86-
server_version="0.1.0",
128+
server_version="0.1.3",
87129
capabilities=server.get_capabilities(
88130
notification_options=NotificationOptions(),
89131
experimental_capabilities={},

uv.lock

Lines changed: 34 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)