mcp-server-appwrite 0.1.3__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
1
  from __future__ import annotations
2
- from typing import List
3
2
  import asyncio
4
3
  import os
5
4
  import argparse
@@ -18,6 +17,7 @@ from appwrite.services.functions import Functions
18
17
  from appwrite.services.locale import Locale
19
18
  from appwrite.services.avatars import Avatars
20
19
  from appwrite.services.messaging import Messaging
20
+ from appwrite.services.sites import Sites
21
21
  from appwrite.exception import AppwriteException
22
22
  from .tool_manager import ToolManager
23
23
  from .service import Service
@@ -32,6 +32,7 @@ def parse_args():
32
32
  parser.add_argument('--messaging', action='store_true', help='Enable Messaging service')
33
33
  parser.add_argument('--locale', action='store_true', help='Enable Locale service')
34
34
  parser.add_argument('--avatars', action='store_true', help='Enable Avatars service')
35
+ parser.add_argument('--sites', action='store_true', help='Enable Sites service')
35
36
  parser.add_argument('--all', action='store_true', help='Enable all services')
36
37
  return parser.parse_args()
37
38
 
@@ -60,6 +61,7 @@ def register_services(args):
60
61
  if args.all:
61
62
  args.databases = args.users = args.teams = args.storage = True
62
63
  args.functions = args.messaging = args.locale = args.avatars = True
64
+ args.sites = True
63
65
 
64
66
  # Register services based on CLI arguments
65
67
  if args.databases:
@@ -78,6 +80,8 @@ def register_services(args):
78
80
  tools_manager.register_service(Service(Locale(client), "locale"))
79
81
  if args.avatars:
80
82
  tools_manager.register_service(Service(Avatars(client), "avatars"))
83
+ if args.sites:
84
+ tools_manager.register_service(Service(Sites(client), "sites"))
81
85
 
82
86
  # If no services were specified, enable databases by default
83
87
  if not any([args.databases, args.users, args.teams, args.storage,
@@ -125,7 +129,7 @@ async def _run():
125
129
  write_stream,
126
130
  InitializationOptions(
127
131
  server_name="appwrite",
128
- server_version="0.1.3",
132
+ server_version="0.2.0",
129
133
  capabilities=server.get_capabilities(
130
134
  notification_options=NotificationOptions(),
131
135
  experimental_capabilities={},
@@ -1,6 +1,7 @@
1
- from typing import Any, get_type_hints, Dict
1
+ from typing import Any, get_type_hints, Dict, List, Optional, Union
2
2
  import inspect
3
3
  from mcp.types import Tool
4
+ from docstring_parser import parse
4
5
 
5
6
  class Service():
6
7
  """Base class for all Appwrite services"""
@@ -29,7 +30,45 @@ class Service():
29
30
  list: "array",
30
31
  dict: "object"
31
32
  }
32
- return {"type": type_mapping.get(py_type, "string")}
33
+
34
+ # Handle basic types
35
+ if py_type in type_mapping:
36
+ return {"type": type_mapping[py_type]}
37
+
38
+ # Handle Optional types (Union[type, None])
39
+ if hasattr(py_type, "__origin__") and py_type.__origin__ is Union:
40
+ args = getattr(py_type, "__args__", ())
41
+ if len(args) == 2 and args[1] is type(None):
42
+ schema = self.python_type_to_json_schema(args[0])
43
+ return schema
44
+
45
+ # Handle List, Dict, and other generic types
46
+ if hasattr(py_type, "__origin__"):
47
+ origin = py_type.__origin__
48
+ args = getattr(py_type, "__args__", ())
49
+
50
+ # Handle List[T]
51
+ if origin is list or origin is List:
52
+ if args:
53
+ item_schema = self.python_type_to_json_schema(args[0])
54
+ return {
55
+ "type": "array",
56
+ "items": item_schema
57
+ }
58
+ return {"type": "array"}
59
+
60
+ # Handle Dict[K, V]
61
+ if origin is dict or origin is Dict:
62
+ if len(args) >= 2:
63
+ value_schema = self.python_type_to_json_schema(args[1])
64
+ return {
65
+ "type": "object",
66
+ "additionalProperties": value_schema
67
+ }
68
+ return {"type": "object"}
69
+
70
+ # Default to string for unknown types
71
+ return {"type": "string"}
33
72
 
34
73
  def list_tools(self) -> Dict[str, Dict]:
35
74
  """Lists all available tools for this service"""
@@ -48,7 +87,7 @@ class Service():
48
87
  # Get the overridden name if it exists
49
88
  tool_name = self._method_name_overrides.get(name, f"{self.service_name}_{name}")
50
89
 
51
- docstring = (original_func.__doc__ or "No description available").strip()
90
+ docstring = parse(original_func.__doc__)
52
91
  signature = inspect.signature(original_func)
53
92
  type_hints = get_type_hints(original_func)
54
93
 
@@ -62,13 +101,17 @@ class Service():
62
101
  param_type = type_hints.get(param_name, str)
63
102
  properties[param_name] = self.python_type_to_json_schema(param_type)
64
103
  properties[param_name]["description"] = f"Parameter '{param_name}'"
104
+
105
+ for doc_param in docstring.params:
106
+ if doc_param.arg_name == param_name:
107
+ properties[param_name]["description"] = doc_param.description
65
108
 
66
109
  if param.default is param.empty:
67
110
  required.append(param_name)
68
111
 
69
112
  tool_definition = Tool(
70
113
  name=tool_name,
71
- description=f"{docstring}",
114
+ description=f"{docstring.short_description or "No description available"}",
72
115
  inputSchema={
73
116
  "type": "object",
74
117
  "properties": properties,
@@ -0,0 +1,246 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-server-appwrite
3
+ Version: 0.2.0
4
+ Summary: MCP (Model Context Protocol) server for Appwrite
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.12
7
+ Requires-Dist: appwrite>=11.0.0
8
+ Requires-Dist: docstring-parser>=0.16
9
+ Requires-Dist: mcp[cli]>=1.3.0
10
+ Description-Content-Type: text/markdown
11
+
12
+ # Appwrite MCP server
13
+
14
+ [![Install MCP Server](https://cursor.com/deeplink/mcp-install-light.svg)](https://cursor.com/install-mcp?name=appwrite&config=eyJjb21tYW5kIjoidXZ4IG1jcC1zZXJ2ZXItYXBwd3JpdGUgLS11c2VycyIsImVudiI6eyJBUFBXUklURV9BUElfS0VZIjoiPHlvdXItYXBpLWtleT4iLCJBUFBXUklURV9QUk9KRUNUX0lEIjoiPHlvdXItcHJvamVjdC1pZD4iLCJBUFBXUklURV9FTkRQT0lOVCI6Imh0dHBzOi8vPFJFR0lPTj4uY2xvdWQuYXBwd3JpdGUuaW8vdjEifX0%3D)
15
+
16
+ ## Overview
17
+
18
+ A Model Context Protocol server for interacting with Appwrite's API. This server provides tools to manage databases, users, functions, teams, and more within your Appwrite project.
19
+
20
+ ## Quick Links
21
+ - [Configuration](#configuration)
22
+ - [Installation](#installation)
23
+ - IDE Integration:
24
+ - [Claude Desktop](#usage-with-claude-desktop)
25
+ - [Cursor](#usage-with-cursor)
26
+ - [Windsurf Editor](#usage-with-windsurf-editor)
27
+ - [Local Development](#local-development)
28
+ - [Debugging](#debugging)
29
+
30
+ ## Configuration
31
+
32
+ > Before launching the MCP server, you must setup an [Appwrite project](https://cloud.appwrite.io/) and create an API key with the necessary scopes enabled.
33
+
34
+ Create a `.env` file in your working directory and add the following:
35
+
36
+ ```env
37
+ APPWRITE_PROJECT_ID=your-project-id
38
+ APPWRITE_API_KEY=your-api-key
39
+ APPWRITE_ENDPOINT=https://<REGION>.cloud.appwrite.io/v1
40
+ ```
41
+
42
+ Then, open your terminal and run the following command
43
+
44
+ ### Linux and MacOS
45
+
46
+ ```sh
47
+ source .env
48
+ ```
49
+
50
+ ### Windows
51
+
52
+ #### Command Prompt
53
+
54
+ ```cmd
55
+ for /f "tokens=1,2 delims==" %A in (.env) do set %A=%B
56
+ ```
57
+
58
+ #### PowerShell
59
+
60
+ ```powershell
61
+ Get-Content .\.env | ForEach-Object {
62
+ if ($_ -match '^(.*?)=(.*)$') {
63
+ [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process")
64
+ }
65
+ }
66
+ ```
67
+
68
+ ## Installation
69
+
70
+ ### Using uv (recommended)
71
+ When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
72
+ use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-appwrite*.
73
+
74
+ ```bash
75
+ uvx mcp-server-appwrite [args]
76
+ ```
77
+
78
+ ### Using pip
79
+
80
+ ```bash
81
+ pip install mcp-server-appwrite
82
+ ```
83
+ Then run the server using
84
+
85
+ ```bash
86
+ python -m mcp_server_appwrite [args]
87
+ ```
88
+
89
+ ### Command-line arguments
90
+
91
+ Both the `uv` and `pip` setup processes require certain arguments to enable MCP tools for various Appwrite APIs.
92
+
93
+ > When an MCP tool is enabled, the tool's definition is passed to the LLM, using up tokens from the model's available context window. As a result, the effective context window is reduced.
94
+ >
95
+ > The default Appwrite MCP server ships with only the Databases tools (our most commonly used API) enabled to stay within these limits. Additional tools can be enabled by using the flags below.
96
+
97
+ | Argument | Description |
98
+ | --- | --- |
99
+ | `--databases` | Enables the Databases API |
100
+ | `--users` | Enables the Users API |
101
+ | `--teams` | Enables the Teams API |
102
+ | `--storage` | Enables the Storage API |
103
+ | `--functions` | Enables the Functions API |
104
+ | `--messaging` | Enables the Messaging API |
105
+ | `--locale` | Enables the Locale API |
106
+ | `--avatars` | Enables the Avatars API |
107
+ | `--sites` | Enables the Sites API |
108
+ | `--all` | Enables all Appwrite APIs |
109
+
110
+ ## Usage with Claude Desktop
111
+
112
+ In the Claude Desktop app, open the app's **Settings** page (press `CTRL + ,` on Windows or `CMD + ,` on MacOS) and head to the **Developer** tab. Clicking on the **Edit Config** button will take you to the `claude_desktop_config.json` file, where you must add the following:
113
+
114
+ ```json
115
+ {
116
+ "mcpServers": {
117
+ "appwrite": {
118
+ "command": "uvx",
119
+ "args": [
120
+ "mcp-server-appwrite"
121
+ ],
122
+ "env": {
123
+ "APPWRITE_PROJECT_ID": "your-project-id",
124
+ "APPWRITE_API_KEY": "your-api-key",
125
+ "APPWRITE_ENDPOINT": "https://<REGION>.cloud.appwrite.io/v1" // Optional
126
+ }
127
+ }
128
+ }
129
+ }
130
+
131
+ ```
132
+
133
+ > Note: In case you see a `uvx ENOENT` error, ensure that you either add `uvx` to the `PATH` environment variable on your system or use the full path to your `uvx` installation in the config file.
134
+
135
+ Upon successful configuration, you should be able to see the server in the list of available servers in Claude Desktop.
136
+
137
+ ![Claude Desktop Config](images/claude-desktop-integration.png)
138
+
139
+ ## Usage with [Cursor](https://www.cursor.com/)
140
+
141
+ Head to Cursor `Settings > MCP` and click on **Add new MCP server**. Choose the type as `Command` and add the command below to the **Command** field.
142
+
143
+ - **MacOS**
144
+
145
+ ```bash
146
+ env APPWRITE_API_KEY=your-api-key env APPWRITE_PROJECT_ID=your-project-id uvx mcp-server-appwrite
147
+ ```
148
+
149
+ - **Windows**
150
+
151
+ ```cmd
152
+ cmd /c SET APPWRITE_PROJECT_ID=your-project-id && SET APPWRITE_API_KEY=your-api-key && uvx mcp-server-appwrite
153
+ ```
154
+
155
+ ![Cursor Settings](./images/cursor-integration.png)
156
+
157
+ ## Usage with [Windsurf Editor](https://codeium.com/windsurf)
158
+
159
+ Head to Windsurf `Settings > Cascade > Model Context Protocol (MCP) Servers` and click on **View raw config**. Update the `mcp_config.json` file to include the following:
160
+
161
+ ```json
162
+ {
163
+ "mcpServers": {
164
+ "appwrite": {
165
+ "command": "uvx",
166
+ "args": [
167
+ "mcp-server-appwrite"
168
+ ],
169
+ "env": {
170
+ "APPWRITE_PROJECT_ID": "your-project-id",
171
+ "APPWRITE_API_KEY": "your-api-key",
172
+ "APPWRITE_ENDPOINT": "https://<REGION>.cloud.appwrite.io/v1" // Optional
173
+ }
174
+ }
175
+ }
176
+ }
177
+ ```
178
+
179
+ ![Windsurf Settings](./images/windsurf-integration.png)
180
+
181
+ ## Local Development
182
+
183
+ ### Clone the repository
184
+
185
+ ```bash
186
+ git clone https://github.com/appwrite/mcp.git
187
+ ```
188
+
189
+ ### Install `uv`
190
+
191
+ - Linux or MacOS
192
+
193
+ ```bash
194
+ curl -LsSf https://astral.sh/uv/install.sh | sh
195
+ ```
196
+
197
+ - Windows (PowerShell)
198
+
199
+ ```powershell
200
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
201
+ ```
202
+
203
+ ### Prepare virtual environment
204
+
205
+ First, create a virtual environment.
206
+
207
+ ```bash
208
+ uv venv
209
+ ```
210
+
211
+ Next, activate the virtual environment.
212
+
213
+ - Linux or MacOS
214
+
215
+ ```bash
216
+ source .venv/bin/activate
217
+ ```
218
+
219
+ - Windows
220
+
221
+ ```powershell
222
+ .venv\Scripts\activate
223
+ ```
224
+
225
+ ### Run the server
226
+
227
+ ```bash
228
+ uv run -v --directory ./ mcp-server-appwrite
229
+ ```
230
+
231
+ ## Debugging
232
+
233
+ You can use the MCP inspector to debug the server.
234
+
235
+ ```bash
236
+ npx @modelcontextprotocol/inspector \
237
+ uv \
238
+ --directory . \
239
+ run mcp-server-appwrite
240
+ ```
241
+
242
+ Make sure your `.env` file is properly configured before running the inspector. You can then access the inspector at `http://localhost:5173`.
243
+
244
+ ## License
245
+
246
+ This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
@@ -0,0 +1,10 @@
1
+ mcp_server_appwrite/__init__.py,sha256=Od9oaUg_ckgJ4jIGa2HijocyauWDPjIC7cBRiV0P4s8,214
2
+ mcp_server_appwrite/__main__.py,sha256=bdaX6xMmFugzSR2QMdXJqanRx_Jh25jACJDqjE9cKEc,75
3
+ mcp_server_appwrite/server.py,sha256=BwglkHSioZljFVM64lrPZT95mSpbKNclstaeUH6O2FE,5718
4
+ mcp_server_appwrite/service.py,sha256=H_Qr8bYFyXuJVwsPsWFi1xx12-aPM75yblKj11L4V2c,4640
5
+ mcp_server_appwrite/tool_manager.py,sha256=AfRjLyMpplYjF2VJna7frXDiDUZKRN8WQu9R8j3dxPc,718
6
+ mcp_server_appwrite-0.2.0.dist-info/METADATA,sha256=vI2B1pOV2nIAS4fIIC57TwXGeUJAMCRgqBSoeSZGyBM,6799
7
+ mcp_server_appwrite-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
+ mcp_server_appwrite-0.2.0.dist-info/entry_points.txt,sha256=-FBKUOp-Qmo9FldmiT3JUyF7djSeo8lLhxljOosuHkQ,74
9
+ mcp_server_appwrite-0.2.0.dist-info/licenses/LICENSE,sha256=PXzk1HbuQMAkLdHzwnBLTBIHFmgDZM0Ez2lw2gX2UQs,1096
10
+ mcp_server_appwrite-0.2.0.dist-info/RECORD,,
@@ -1,173 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mcp-server-appwrite
3
- Version: 0.1.3
4
- Summary: MCP (Model Context Protocol) server for Appwrite
5
- License-File: LICENSE
6
- Requires-Python: >=3.12
7
- Requires-Dist: appwrite>=9.0.2
8
- Requires-Dist: mcp[cli]>=1.3.0
9
- Description-Content-Type: text/markdown
10
-
11
- # Appwrite MCP server
12
-
13
- <!-- Cover image will go here once available -->
14
-
15
- ## Overview
16
-
17
- A Model Context Protocol server for interacting with Appwrite's API. This server provides tools to manage databases, users, functions, teams, and more within your Appwrite project.
18
-
19
- ## Quick Links
20
- - [Configuration](#configuration)
21
- - [Installation](#installation)
22
- - IDE Integration:
23
- - [Claude Desktop](#usage-with-claude-desktop)
24
- - [Zed](#usage-with-zed)
25
- - [Cursor](#usage-with-cursor)
26
- - [Local Development](#local-development)
27
- - [Debugging](#debugging)
28
-
29
- Currently, the server supports the following tools:
30
-
31
- - [x] Databases
32
- - [x] Users
33
-
34
- > Please note that adding a lot of tools exceeds the context window of the LLM. As a result, we will make available a curated list of tools that are most commonly used.
35
-
36
- ## Configuration
37
-
38
- Create a `.env` file in the directory you're running the server from:
39
-
40
- ```env
41
- APPWRITE_API_KEY=your-api-key
42
- APPWRITE_PROJECT_ID=your-project-id
43
- APPWRITE_ENDPOINT=your-endpoint # Optional, defaults to https://cloud.appwrite.io/v1
44
- ```
45
- > Note: Ensure that your API Key has the necessary scopes to access the resources you want to use.
46
-
47
- ## Installation
48
-
49
- ### Using uv (recommended)
50
- When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
51
- use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-appwrite*.
52
-
53
- ```bash
54
- uvx run mcp-server-appwrite
55
- ```
56
-
57
- ### Using pip
58
-
59
- ```bash
60
- pip install mcp-server-appwrite
61
- ```
62
- Then run the server using
63
-
64
- ```bash
65
- python -m mcp_server_appwrite
66
- ```
67
-
68
- ## Usage with Claude Desktop
69
-
70
- Add this to your `claude_desktop_config.json`:
71
-
72
- ```json
73
- "mcpServers": {
74
- "appwrite": {
75
- "command": "uvx",
76
- "args": [
77
- "mcp-server-appwrite"
78
- ],
79
- "env": {
80
- "APPWRITE_PROJECT_ID": "your-project-id",
81
- "APPWRITE_API_KEY": "your-api-key",
82
- "APPWRITE_ENDPOINT": "your-endpoint" // Optional
83
- }
84
- }
85
- }
86
- ```
87
- Upon successful configuration, you should be able to see the server in the list of available servers in Claude Desktop.
88
-
89
- ![Claude Desktop Config](images/claude-desktop-integration.png)
90
-
91
- ## Usage with [Zed](https://github.com/zed-industries/zed)
92
-
93
- Add to your Zed settings.json:
94
-
95
- ```json
96
- "context_servers": {
97
- "appwrite": {
98
- "command": "uvx",
99
- "args": [
100
- "mcp-server-appwrite"
101
- ],
102
- "env": {
103
- "APPWRITE_PROJECT_ID": "your-project-id",
104
- "APPWRITE_API_KEY": "your-api-key",
105
- "APPWRITE_ENDPOINT": "your-endpoint" // Optional
106
- }
107
- }
108
- }
109
- ```
110
-
111
- ## Usage with [Cursor](https://www.cursor.com/)
112
-
113
- Head to Cursor `Settings > Features > MCP Servers` and click on **Add New MCP Server**. Choose the type as `Command` and add the command below to the **Command** field.
114
-
115
- ```bash
116
- APPWRITE_PROJECT_ID=your-project-id APPWRITE_API_KEY=your-api-key uvx mcp-server-appwrite
117
- ```
118
-
119
- ![Cursor Settings](./images/cursor-integration.png)
120
-
121
- ## Local Development
122
-
123
- Clone the repository
124
-
125
- ```bash
126
- git clone https://github.com/appwrite/mcp.git
127
- ```
128
-
129
- Install `uv`
130
-
131
- ```bash
132
- curl -LsSf https://astral.sh/uv/install.sh | sh
133
- ```
134
-
135
- Create virtual environment
136
-
137
- ```bash
138
- uv venv
139
- source .venv/bin/activate
140
- ```
141
-
142
- Run the server
143
-
144
- ```bash
145
- uv run -v --directory ./ mcp-server-appwrite
146
- ```
147
-
148
- ## Debugging
149
-
150
- You can use the MCP inspector to debug the server.
151
-
152
- ```bash
153
- npx @modelcontextprotocol/inspector \
154
- uv \
155
- --directory . \
156
- run mcp-server-appwrite
157
- ```
158
-
159
- Make sure your `.env` file is properly configured before running the inspector. You can then access the inspector at `http://localhost:5173`.
160
-
161
- ## License
162
-
163
- This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
164
-
165
- ## Todos
166
- - Add MCP server to registries
167
- - Glama
168
- - https://github.com/chatmcp/mcp-directory
169
- - https://mcp.so/
170
- - https://github.com/punkpeye/awesome-mcp-servers
171
- - https://portkey.ai/mcp-servers
172
- - https://www.claudemcp.com/servers
173
- - Add support for SSE server
@@ -1,10 +0,0 @@
1
- mcp_server_appwrite/__init__.py,sha256=Od9oaUg_ckgJ4jIGa2HijocyauWDPjIC7cBRiV0P4s8,214
2
- mcp_server_appwrite/__main__.py,sha256=bdaX6xMmFugzSR2QMdXJqanRx_Jh25jACJDqjE9cKEc,75
3
- mcp_server_appwrite/server.py,sha256=J_Ze0DiYYmL1wbHi4Z4LK7UTYhVemBij6O_j6zPvMCg,5498
4
- mcp_server_appwrite/service.py,sha256=WwKoh9o7W7ZOmhY0yg6k4R2cghQRe-yMTNbFtB6TFT8,2895
5
- mcp_server_appwrite/tool_manager.py,sha256=AfRjLyMpplYjF2VJna7frXDiDUZKRN8WQu9R8j3dxPc,718
6
- mcp_server_appwrite-0.1.3.dist-info/METADATA,sha256=CPQt1rKcgsA_0h-l-rUl6O34HvkU1HZuKqYGVPJfCzc,4297
7
- mcp_server_appwrite-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
- mcp_server_appwrite-0.1.3.dist-info/entry_points.txt,sha256=-FBKUOp-Qmo9FldmiT3JUyF7djSeo8lLhxljOosuHkQ,74
9
- mcp_server_appwrite-0.1.3.dist-info/licenses/LICENSE,sha256=PXzk1HbuQMAkLdHzwnBLTBIHFmgDZM0Ez2lw2gX2UQs,1096
10
- mcp_server_appwrite-0.1.3.dist-info/RECORD,,