Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ needs no credentials. The MCP dashboard lives in `appwrite-labs/monitoring` at
The server boots in a compact workflow: the client sees up to 5 tools
(`appwrite_get_context`, `appwrite_search_tools`, `appwrite_call_tool` for
reads, `appwrite_call_write_tool` for everything else, and optionally
`appwrite_search_docs`), while the full OAuth Appwrite catalog (41
`appwrite_search_docs`), while the full OAuth Appwrite catalog (43
services) stays internal and is searched at runtime. API-key stdio uses a filtered
27-service catalog. Mutating hidden tools run only through
29-service catalog. Mutating hidden tools run only through
`appwrite_call_write_tool` and require `confirm_write=true` and a one-line
`reason` (sent as `X-Appwrite-Reason`, recorded on the audit log), so each
exposed tool's annotations match every call it accepts. Deletes and paid writes
Expand Down
2 changes: 1 addition & 1 deletion docs/appwrite-mcp-flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/self-hosted.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Running your own Appwrite instance? Run the MCP server locally over `stdio` and
authenticate with a project API key instead of OAuth.

The local API-key catalog is intentionally smaller than the hosted OAuth catalog:
it exposes 724 project-key-compatible methods across 27 services. DocumentsDB,
it exposes 740 project-key-compatible methods across 29 services. DocumentsDB,
VectorsDB, and text embeddings are available, but console control-plane services
such as organizations, domains, projects, billing, migrations, dedicated
databases, usage administration, VCS administration, and WAF administration are
Expand Down
10 changes: 5 additions & 5 deletions docs/tool-surface.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ flowchart LR

subgraph CAT[Internal catalog — authentication-aware]
direction LR
K[OAuth: 41 services / 1069 tools<br/>API key: 27 services / 724 tools]
K[OAuth: 43 services / 1094 tools<br/>API key: 29 services / 740 tools]
end

CT -->|large output| R[(MCP resource<br/>preview + URI)]
Expand Down Expand Up @@ -88,12 +88,12 @@ operate on it for the rest of the session.
`context=organization`, or `context=project`. Hosted calls enforce the required
top-level `organization_id` or `project_id` before making a request.
- **Access** is still gated per-route by the scopes granted to the OAuth token.
- **Hosted OAuth** registers all 41 services and 1069 methods shipped by
`appwrite-console` 0.17.0. This adds console control-plane services including
- **Hosted OAuth** registers all 43 services and 1094 methods shipped by
`appwrite-console` 0.18.0. This adds console control-plane services including
projects, organizations, domains, migrations, dedicated databases, usage, VCS,
vectors, WAF, notifications, and regions.
- **API-key stdio** deliberately registers only the 724 project-key-compatible
methods across 27 services. It includes the new DocumentsDB, VectorsDB, and
- **API-key stdio** deliberately registers only the 740 project-key-compatible
methods across 29 services. It includes the new DocumentsDB, VectorsDB, and
text-embeddings APIs, while console administration methods remain hidden.
- **Registration** remains SDK-driven, with the authentication profile policy
applied while the internal catalog is built.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"anyio>=4.0.0",
"appwrite-console>=0.17.0,<0.18",
"appwrite-console>=0.18.0,<0.19",
"docstring-parser>=0.16",
"mcp[cli]>=2.3,<3",
"python-dotenv>=1.0.1",
Expand Down
9 changes: 9 additions & 0 deletions src/mcp_server_appwrite/catalog_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"account",
"activities",
"advisor",
"alerts",
"apps",
"avatars",
"backups",
Expand All @@ -34,6 +35,7 @@
"graphql",
"locale",
"messaging",
"monitors",
"oauth2",
"organization",
"presences",
Expand Down Expand Up @@ -100,10 +102,15 @@
"organization": frozenset(
{
"create_ephemeral_project_key",
"create_escalation",
"create_project_key",
"delete_escalation",
"delete_project_key",
"get_escalation",
"get_project_key",
"list_escalations",
"list_project_keys",
"update_escalation",
"update_project_key",
}
),
Expand Down Expand Up @@ -138,13 +145,15 @@
PROJECT_CONTEXT_SERVICES: frozenset[str] = frozenset(
{
"advisor",
"alerts",
"databases",
"documents_db",
"embeddings",
"functions",
"messaging",
"migrations",
"mongo",
"monitors",
"mysql",
"postgresql",
"sites",
Expand Down
4 changes: 4 additions & 0 deletions src/mcp_server_appwrite/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def _resolve_server_version() -> str:
"domains_create_purchase",
"domains_create_transfer_in",
"mongo_create_upgrade",
"monitors_create_dns_monitor",
"monitors_create_http_monitor",
"monitors_create_smtp_monitor",
"monitors_create_tcp_monitor",
Comment thread
ChiragAgg5k marked this conversation as resolved.
Resolved
"mysql_create_upgrade",
"organizations_add_credit",
"organizations_create_baa_addon",
Expand Down
28 changes: 28 additions & 0 deletions tests/e2e/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,34 @@ def test_deletes_wait_for_the_user_when_the_client_can_ask(self):
self.assertEqual(response["result"]["resultType"], "complete")
self.assertEqual(cloud.calls("PATCH", path), upgraded + 1)

# A synthetic monitor past the plan's included amount is billed,
# so creating one waits for approval as well.
monitored = cloud.calls("POST", "/v1/monitors/http")
status, response = client.call(
"tools/call",
{
"name": "appwrite_call_write_tool",
"arguments": {
"tool_name": "monitors_create_http_monitor",
"project_id": PROJECT,
"confirm_write": True,
"reason": "Watch the checkout API",
"arguments": {
"monitor_id": "e2e-checkout",
"name": "Checkout",
"url": "https://example.com/checkout",
},
},
},
)
self.assertEqual(response["result"]["resultType"], "input_required")
self.assertTrue(
response["result"]["inputRequests"]["confirm"]["params"][
"message"
].startswith("Allow monitors_create_http_monitor?")
)
self.assertEqual(cloud.calls("POST", "/v1/monitors/http"), monitored)

# A client that cannot show a form keeps the confirm_write flow alone.
result = self.call("appwrite_call_write_tool", delete["arguments"])
self.assertFalse(result.get("isError"), result)
Expand Down
52 changes: 46 additions & 6 deletions tests/unit/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,40 @@ def wrapped(address, *args, **kwargs):
"sites_update_analytics",
)

# Monitors and alerts are project APIs, so both catalogs register them.
CONSOLE_SDK_0_18_PROJECT_TOOLS = (
"alerts_get",
"alerts_list",
"alerts_update",
"monitors_create_dns_monitor",
"monitors_create_http_monitor",
"monitors_create_smtp_monitor",
"monitors_create_tcp_monitor",
"monitors_create_usage_monitor",
"monitors_delete",
"monitors_get",
"monitors_list",
"monitors_update_dns_monitor",
"monitors_update_http_monitor",
"monitors_update_smtp_monitor",
"monitors_update_tcp_monitor",
"monitors_update_usage_monitor",
)

# Escalations take an organization key and the organizations service is console
# only, so these stay out of the API-key catalog.
CONSOLE_SDK_0_18_CONSOLE_TOOLS = (
"organization_create_escalation",
"organization_delete_escalation",
"organization_get_escalation",
"organization_list_escalations",
"organization_update_escalation",
"organizations_get_alert",
"organizations_get_monitor",
"organizations_list_alerts",
"organizations_list_monitors",
)


class ServerHelperTests(unittest.TestCase):
def test_parse_args_defaults_to_stdio(self):
Expand Down Expand Up @@ -1097,8 +1131,8 @@ def test_register_services_returns_fresh_manager(self):
{service.service_name for service in manager_a.services},
set(SERVICE_CLASSES),
)
self.assertEqual(len(manager_a.services), 41)
self.assertEqual(len(manager_a.get_all_tools()), 1069)
self.assertEqual(len(manager_a.services), 43)
self.assertEqual(len(manager_a.get_all_tools()), 1094)

def test_console_sdk_0_7_surface(self):
manager = register_services(object(), profile=OAUTH_PROFILE)
Expand All @@ -1111,7 +1145,11 @@ def test_console_sdk_0_7_surface(self):
self.assertIn("tables_db_create_cutover", tools)
self.assertIn("analytics_list_metrics", tools)
self.assertIn("avatars_update_photo", tools)
for tool_name in CONSOLE_SDK_0_17_TOOLS:
for tool_name in (
*CONSOLE_SDK_0_17_TOOLS,
*CONSOLE_SDK_0_18_PROJECT_TOOLS,
*CONSOLE_SDK_0_18_CONSOLE_TOOLS,
):
self.assertIn(tool_name, tools)
for removed_tool in (
"project_get_usage",
Expand Down Expand Up @@ -1221,10 +1259,12 @@ def test_api_key_profile_only_advertises_server_capabilities(self):
service_names = {service.service_name for service in manager.services}
tool_names = {tool.name for tool in manager.get_all_tools()}

self.assertEqual(len(manager.services), 27)
self.assertEqual(len(tool_names), 724)
for tool_name in CONSOLE_SDK_0_17_TOOLS:
self.assertEqual(len(manager.services), 29)
self.assertEqual(len(tool_names), 740)
for tool_name in (*CONSOLE_SDK_0_17_TOOLS, *CONSOLE_SDK_0_18_PROJECT_TOOLS):
self.assertIn(tool_name, tool_names)
for tool_name in CONSOLE_SDK_0_18_CONSOLE_TOOLS:
self.assertNotIn(tool_name, tool_names)
self.assertIn("waf_list_rules", tool_names)
self.assertIn("waf_create_deny_rule", tool_names)
self.assertIn("avatars_get_photo", tool_names)
Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading