@sawala/mcp 0.1.0 → 0.1.1

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.
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # @sawala/mcp
2
+
3
+ Drive the Sawala API — [Kontena](https://sawala.cloud/products/kontena),
4
+ [Formulir](https://formulir.id), [Berkasna](https://sawala.cloud/products/berkasna) —
5
+ from any [MCP](https://modelcontextprotocol.io)-capable AI agent
6
+ (Claude Desktop, Claude Code, Cursor, Continue.dev, Zed, …).
7
+
8
+ Sibling to [`@sawala/kodena-mcp`](https://www.npmjs.com/package/@sawala/kodena-mcp),
9
+ which covers the Kodena deployment product. The two servers coexist
10
+ under separate MCP entries with separate credentials stores.
11
+
12
+ ```
13
+ ┌─────────────────────┐ stdio JSON-RPC ┌──────────────────┐
14
+ │ Claude Desktop / │ ───────────────────────────────▶ │ sawala-mcp │
15
+ │ Claude Code / │ ◀─────────────────────────────── │ (node process │
16
+ │ Cursor / … │ │ on your laptop) │
17
+ └─────────────────────┘ └─────────┬────────┘
18
+ │ HTTPS
19
+
20
+ ┌──────────────────┐
21
+ │ api.sawala.cloud │
22
+ └──────────────────┘
23
+ ```
24
+
25
+ ## Quick start
26
+
27
+ 1. **Log in once** via the [`@sawala/cli`](https://www.npmjs.com/package/@sawala/cli)
28
+ companion (writes `~/.sawala/credentials`):
29
+
30
+ ```sh
31
+ npm i -g @sawala/cli
32
+ sawala login
33
+ sawala org use <org-slug>
34
+ sawala project use <project-slug>
35
+ ```
36
+
37
+ 2. **Wire the MCP server into your host.** Pick the snippet below.
38
+
39
+ 3. **Ask the agent in plain English.** "List my Kontena content schemas."
40
+ "Show the latest 10 submissions of the contact form." "What images
41
+ are in this project's media library?"
42
+
43
+ ## Host configuration
44
+
45
+ ### Claude Desktop
46
+
47
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
48
+ or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
49
+
50
+ ```json
51
+ {
52
+ "mcpServers": {
53
+ "sawala": {
54
+ "command": "npx",
55
+ "args": ["-y", "@sawala/mcp"]
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ Restart Claude Desktop. The "sawala" server appears with 11 tools available.
62
+
63
+ ### Claude Code
64
+
65
+ ```sh
66
+ claude mcp add sawala -- npx -y @sawala/mcp
67
+ ```
68
+
69
+ ### Cursor
70
+
71
+ Edit `~/.cursor/mcp.json`:
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "sawala": {
77
+ "command": "npx",
78
+ "args": ["-y", "@sawala/mcp"]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ ### Local-build testing
85
+
86
+ To point a host at a locally built binary:
87
+
88
+ ```json
89
+ {
90
+ "mcpServers": {
91
+ "sawala": {
92
+ "command": "node",
93
+ "args": ["/absolute/path/to/cli/packages/sawala-mcp/dist/server.js"]
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Tools
100
+
101
+ All tools are flagged `readOnlyHint: true`; MCP hosts may auto-allow them
102
+ without per-call confirmation.
103
+
104
+ ### Identity
105
+
106
+ | Tool | API | Description |
107
+ | --- | --- | --- |
108
+ | `sawala_whoami` | `GET /cli/organization/me` | Identity + active org/project context. |
109
+
110
+ ### Kontena (content)
111
+
112
+ | Tool | API | Description |
113
+ | --- | --- | --- |
114
+ | `sawala_kontena_list_schemas` | `GET /cli/kontena/projects/:projId/schemas` | List content schemas in the active project. |
115
+ | `sawala_kontena_get_schema` | `GET /cli/kontena/projects/:projId/schemas/:id` | Show one schema. Accepts ULID or slug (slug falls back to a list lookup). |
116
+ | `sawala_kontena_list_entries` | `GET /cli/kontena/projects/:projId/content/collection/:schemaSlug` | List entries for a collection schema. Filters: `locale`, `state` (`preview` or `live`). |
117
+ | `sawala_kontena_get_entry` | `GET /cli/kontena/projects/:projId/content/collection/:schemaSlug/:idOrSlug` | Show one entry. Same filters as list. |
118
+
119
+ ### Formulir (forms + submissions)
120
+
121
+ | Tool | API | Description |
122
+ | --- | --- | --- |
123
+ | `sawala_formulir_list_forms` | `GET /cli/formulir/projects/:projId/forms` | List forms in the active project. |
124
+ | `sawala_formulir_get_form` | `GET /cli/formulir/projects/:projId/forms/:id` | Show one form (full definition). ULID-or-slug. |
125
+ | `sawala_formulir_list_submissions` | `GET /cli/formulir/projects/:projId/forms/:id/submissions` | List submissions for a form. Filters: `status`, `source`, `limit`, `cursor`. The per-submission `data` field is intentionally omitted from list output — fetch with `get_submission` for the full payload. |
126
+ | `sawala_formulir_get_submission` | `GET /cli/formulir/projects/:projId/forms/:id/submissions/:subId` | Show one submission, including its `data` payload. |
127
+
128
+ ### Berkasna (asset metadata)
129
+
130
+ Berkasna routes are org-scoped (no `:projId` segment). The active project
131
+ is sent in the `x-project-id` header for the audit trail; pass an explicit
132
+ `projectId` to filter the list.
133
+
134
+ | Tool | API | Description |
135
+ | --- | --- | --- |
136
+ | `sawala_berkasna_list_assets` | `GET /cli/berkasna/assets` | List assets in the org. Filters: `kind` (`image` / `pdf` / `video` / `audio` / `all`), `projectId`, `limit`, `cursor`. Returns metadata; for bytes, follow each asset's `publicUrl`. |
137
+ | `sawala_berkasna_get_asset` | `GET /cli/berkasna/assets/:id` | Show one asset's full metadata. |
138
+
139
+ ## Authentication
140
+
141
+ The server reads `~/.sawala/credentials` (written by `sawala login`) on
142
+ every tool call — so `sawala project use <slug>` in a separate terminal
143
+ takes effect on the very next tool invocation without restarting the host.
144
+
145
+ For non-interactive environments (CI runners, sandboxed agents), pass
146
+ the token via the MCP server's env:
147
+
148
+ ```json
149
+ {
150
+ "mcpServers": {
151
+ "sawala": {
152
+ "command": "npx",
153
+ "args": ["-y", "@sawala/mcp"],
154
+ "env": {
155
+ "SAWALA_API_TOKEN": "koda_…",
156
+ "SAWALA_ORG": "acme",
157
+ "SAWALA_PROJECT": "my-project"
158
+ }
159
+ }
160
+ }
161
+ }
162
+ ```
163
+
164
+ ## Links
165
+
166
+ - Sawala dashboard: <https://sawala.cloud/dashboard>
167
+ - Mint a CLI token: <https://sawala.cloud/dashboard/org/settings> → "CLI tokens"
168
+ - Monorepo: <https://github.com/sawala-tech/cli>
169
+ - Issues: <https://github.com/sawala-tech/cli/issues>
170
+
171
+ ## License
172
+
173
+ MIT — see [LICENSE](../../LICENSE).