diff --git a/AGENTS.md b/AGENTS.md index 39baf6f..31545ac 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 diff --git a/docs/appwrite-mcp-flow.svg b/docs/appwrite-mcp-flow.svg index a3005ee..fd9606d 100644 --- a/docs/appwrite-mcp-flow.svg +++ b/docs/appwrite-mcp-flow.svg @@ -115,7 +115,7 @@ search_docs - hosted catalog · 41 services · 1069 tools + hosted catalog · 43 services · 1094 tools writes need confirm_write: true diff --git a/docs/self-hosted.md b/docs/self-hosted.md index 2e8b6f8..bbddedc 100644 --- a/docs/self-hosted.md +++ b/docs/self-hosted.md @@ -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 diff --git a/docs/tool-surface.md b/docs/tool-surface.md index cb625c2..716c607 100644 --- a/docs/tool-surface.md +++ b/docs/tool-surface.md @@ -22,7 +22,7 @@ flowchart LR subgraph CAT[Internal catalog — authentication-aware] direction LR - K[OAuth: 41 services / 1069 tools
API key: 27 services / 724 tools] + K[OAuth: 43 services / 1094 tools
API key: 29 services / 740 tools] end CT -->|large output| R[(MCP resource
preview + URI)] @@ -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. diff --git a/pyproject.toml b/pyproject.toml index c0d35eb..6b6159e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/src/mcp_server_appwrite/catalog_policy.py b/src/mcp_server_appwrite/catalog_policy.py index 0c3b70a..ff86418 100644 --- a/src/mcp_server_appwrite/catalog_policy.py +++ b/src/mcp_server_appwrite/catalog_policy.py @@ -24,6 +24,7 @@ "account", "activities", "advisor", + "alerts", "apps", "avatars", "backups", @@ -34,6 +35,7 @@ "graphql", "locale", "messaging", + "monitors", "oauth2", "organization", "presences", @@ -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", } ), @@ -138,6 +145,7 @@ PROJECT_CONTEXT_SERVICES: frozenset[str] = frozenset( { "advisor", + "alerts", "databases", "documents_db", "embeddings", @@ -145,6 +153,7 @@ "messaging", "migrations", "mongo", + "monitors", "mysql", "postgresql", "sites", diff --git a/src/mcp_server_appwrite/constants.py b/src/mcp_server_appwrite/constants.py index ddaa4c8..201504c 100644 --- a/src/mcp_server_appwrite/constants.py +++ b/src/mcp_server_appwrite/constants.py @@ -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", "mysql_create_upgrade", "organizations_add_credit", "organizations_create_baa_addon", diff --git a/tests/e2e/test_tools.py b/tests/e2e/test_tools.py index 3d78ea7..34609bc 100644 --- a/tests/e2e/test_tools.py +++ b/tests/e2e/test_tools.py @@ -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) diff --git a/tests/unit/test_server.py b/tests/unit/test_server.py index 109edd7..41a21be 100644 --- a/tests/unit/test_server.py +++ b/tests/unit/test_server.py @@ -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): @@ -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) @@ -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", @@ -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) diff --git a/uv.lock b/uv.lock index 3b1cb85..0dd5a29 100644 --- a/uv.lock +++ b/uv.lock @@ -39,16 +39,16 @@ wheels = [ [[package]] name = "appwrite-console" -version = "0.17.0" +version = "0.18.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pydantic" }, { name = "requests" }, { name = "urllib3" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/67/c8/e75482299b88ad962c3f303eaa2d6b959699b7129cb1d248c9d6dd912def/appwrite_console-0.17.0.tar.gz", hash = "sha256:2b89dabca289a5de0ab71ac9af553f28e1d031bc7592b3deb6231237e78b7a1a", size = 380575, upload-time = "2026-11-16T13:53:25.912Z" } +sdist = { url = "https://files.pythonhosted.org/packages/1d/e4/0c2754933a3b3325f5a450c0bfede29e9b856e45fb2235b77992a2e1686d/appwrite_console-0.18.0.tar.gz", hash = "sha256:add5576fdf0a32e4f1cfd2f142d3071f39d81a150515defe61432fd66977ae1d", size = 391996, upload-time = "2026-11-26T14:58:28.063Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/2b/17/12e92ec603a8a76b2be2c2a12acfa5da18b1c5865be97b1508aba8b332c9/appwrite_console-0.17.0-py3-none-any.whl", hash = "sha256:9377f80e0bbd608936a8b9b692aaabb43f010936dc5f2938017044cf0e2b7f5b", size = 688210, upload-time = "2026-11-16T13:53:23.858Z" }, + { url = "https://files.pythonhosted.org/packages/ec/18/f59ccf206152b795d068c5d46c398b7962a387734b41b768168374fccb60/appwrite_console-0.18.0-py3-none-any.whl", hash = "sha256:ca7345dc7c0e93038378e923940d0d285602f4de77a166e33d51d5aedc362d26", size = 705703, upload-time = "2026-11-26T14:58:26.624Z" }, ] [[package]] @@ -752,7 +752,7 @@ e2e = [ [package.metadata] requires-dist = [ { name = "anyio", specifier = ">=4.0.0" }, - { name = "appwrite-console", specifier = ">=0.17.0,<0.18" }, + { name = "appwrite-console", specifier = ">=0.18.0,<0.19" }, { name = "argon2-cffi", marker = "extra == 'integration'", specifier = ">=23.1.0" }, { name = "bcrypt", marker = "extra == 'integration'", specifier = ">=4.1.2" }, { name = "cryptography", specifier = ">=44.0.0" },