@posty5/mcp 0.0.0-stage → 1.1.0
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/LICENSE +21 -0
- package/README.md +202 -2
- package/dist/bin/stdio.js +4197 -0
- package/dist/bin/stdio.js.map +1 -0
- package/dist/bin/stdio.mjs +4195 -0
- package/dist/bin/stdio.mjs.map +1 -0
- package/dist/index.d.mts +374 -0
- package/dist/index.d.ts +374 -0
- package/dist/index.js +4321 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4299 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +75 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Posty5
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,203 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @posty5/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Every Posty5 service — short links, QR codes, hosted HTML pages, social
|
|
4
|
+
publishing and online stores — as [Model Context Protocol](https://modelcontextprotocol.io)
|
|
5
|
+
tools, for any AI assistant. One package holds the tool catalogue, the server
|
|
6
|
+
that serves it, and a stdio binary for clients that launch local servers.
|
|
7
|
+
|
|
8
|
+
**Learn more:** [https://posty5.com](https://posty5.com)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 🔌 Two ways to connect
|
|
13
|
+
|
|
14
|
+
| | Hosted (recommended) | Local (stdio) |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| What you add to the assistant | A URL: `https://mcp.posty5.com/t/<token>/mcp` | A command: `npx -y @posty5/mcp` |
|
|
17
|
+
| Where you get it | Posty5 → Account settings → API keys → **MCP link** | Posty5 → Account settings → API keys (any key) |
|
|
18
|
+
| Access level and toolsets | Chosen in the dashboard when the link is made | Environment variables (below) |
|
|
19
|
+
| Attribution of what it creates | Signed: Posty5 knows it came through MCP | Declared: recorded as reported |
|
|
20
|
+
|
|
21
|
+
The hosted server runs this package; the URL embeds a token shown once — treat
|
|
22
|
+
it like a password.
|
|
23
|
+
|
|
24
|
+
## 🖥️ Local (stdio)
|
|
25
|
+
|
|
26
|
+
Needs Node.js 20 or later.
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"posty5": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["-y", "@posty5/mcp"],
|
|
34
|
+
"env": {
|
|
35
|
+
"POSTY5_API_KEY": "your-api-key",
|
|
36
|
+
"POSTY5_MCP_TOOLSETS": "short-links,qr-codes",
|
|
37
|
+
"POSTY5_MCP_ACCESS": "write"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
| Variable | Required | Meaning |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `POSTY5_API_KEY` | yes | The API key every call uses. Never printed. |
|
|
47
|
+
| `POSTY5_MCP_TOOLSETS` | no | Comma list of toolsets (below). Default: `account,short-links,qr-codes,html-hosting,social-publisher`. |
|
|
48
|
+
| `POSTY5_MCP_ACCESS` | no | `read`, `write` (default) or `full`. |
|
|
49
|
+
| `POSTY5_AI_MODEL` | no | The model to record when a call does not name one. |
|
|
50
|
+
| `POSTY5_BASE_URL` | no | API base URL (default `https://api.posty5.com`). |
|
|
51
|
+
|
|
52
|
+
The server writes the protocol to stdout and everything else to stderr.
|
|
53
|
+
|
|
54
|
+
## 🧰 Toolsets
|
|
55
|
+
|
|
56
|
+
| Toolset | On by default | What it covers |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| `account` | always | Who the connection is, credits, live operation prices |
|
|
59
|
+
| `short-links` | ✅ | Short links, their controls (availability, password, routing, A/B split, UTM, pixels, health checks), tags and link campaigns |
|
|
60
|
+
| `qr-codes` | ✅ | QR codes of every type, and QR templates |
|
|
61
|
+
| `html-hosting` | ✅ | Hosted pages, their variables, form submissions |
|
|
62
|
+
| `social-publisher` | ✅ | Workspaces, connected accounts, posts to every platform |
|
|
63
|
+
| `store` | with any `store-*` | The stores the connection can manage |
|
|
64
|
+
| `store-catalog` | — | Products and tags |
|
|
65
|
+
| `store-orders` | — | Orders and customers — shoppers' personal data reaches the assistant's provider |
|
|
66
|
+
| `store-shipping` | — | Countries, routes, profiles, assignments |
|
|
67
|
+
| `store-dropshipping` | — | Supplier catalogue, imports, product links, supplier orders |
|
|
68
|
+
|
|
69
|
+
148 tools in all; `listToolsets()` and `listTools()` describe them.
|
|
70
|
+
|
|
71
|
+
## 🔐 Access levels and confirmation
|
|
72
|
+
|
|
73
|
+
- `read` — lists and gets only.
|
|
74
|
+
- `write` — also creates and updates.
|
|
75
|
+
- `full` — also deletes, removals from social platforms, supplier payments.
|
|
76
|
+
|
|
77
|
+
A tool above the connection's level is not listed and is refused if called.
|
|
78
|
+
Irreversible or paid tools take `confirm`: called without `confirm: true` they
|
|
79
|
+
change nothing and answer with what they would do (and the live price when the
|
|
80
|
+
action is charged), so the assistant can ask the user first.
|
|
81
|
+
|
|
82
|
+
### Batches
|
|
83
|
+
|
|
84
|
+
`short_link_create_many` and `qr_code_create_many` create 1–25 items in one
|
|
85
|
+
call and always take `confirm`: a batch costs up to 25 times the base price.
|
|
86
|
+
A refused row is reported and skipped. `qr_code_create_many` with `zip: true`
|
|
87
|
+
runs a bulk job and answers a **signed link to a ZIP of the images** that
|
|
88
|
+
expires within minutes; `qr_code_get_bulk_job` reports a job still running and
|
|
89
|
+
hands out fresh links. Webhook endpoints are not exposed through MCP.
|
|
90
|
+
|
|
91
|
+
### Visit analytics
|
|
92
|
+
|
|
93
|
+
`short_link_get_analytics` and `qr_code_get_analytics` (read) answer visits,
|
|
94
|
+
unique visitors, a day/week/month series and breakdowns (channel, country,
|
|
95
|
+
device, OS, browser, referrer, language) for one link or QR code over a date
|
|
96
|
+
range. Bots are excluded and reported as `botVisits`; data starts at
|
|
97
|
+
`meta.analyticsStartedAt`; breakdowns the owner's plan does not include are
|
|
98
|
+
listed in `meta.locked` with the plan that unlocks them. For a static QR code
|
|
99
|
+
the numbers are visits to its Posty5 page, not scans. No credits.
|
|
100
|
+
|
|
101
|
+
### Short link controls
|
|
102
|
+
|
|
103
|
+
`short_link_create` / `short_link_update` take `tags`, `campaignId`, `health`
|
|
104
|
+
and the controls `access` (start, end, visit limit, fallback URL, password),
|
|
105
|
+
`routing` (up to 20 ordered rules), `variants` (0 or 2–5), `utm`, `pixels`
|
|
106
|
+
and `pixelsConsentAcknowledged`. Per visit: access, then routing (first match),
|
|
107
|
+
then variants, else the target.
|
|
108
|
+
|
|
109
|
+
| Tool | Access | What it does |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| `short_link_set_rules` | write | Changes only the control sections given |
|
|
112
|
+
| `short_link_list_tags` | read | The account's distinct tags |
|
|
113
|
+
| `short_link_check_health` | write | Queues a destination check; the result shows later in `short_link_get` |
|
|
114
|
+
| `short_link_campaign_list` / `_get` | read | Campaigns, with link count and visits |
|
|
115
|
+
| `short_link_campaign_create` / `_update` | write | Name, description, colour, default UTM, archive |
|
|
116
|
+
| `short_link_campaign_delete` | full, `confirm` | `detach: true` removes the campaign from its links first |
|
|
117
|
+
|
|
118
|
+
A link password is write-only: no result ever carries it (only
|
|
119
|
+
`access.hasPassword`), and the hosted activity log drops it from the stored
|
|
120
|
+
arguments. `pixelsConsentAcknowledged` is for the user to confirm, not the
|
|
121
|
+
assistant.
|
|
122
|
+
|
|
123
|
+
### Dynamic QR codes
|
|
124
|
+
|
|
125
|
+
`qr_code_create` makes **dynamic** codes by default (`mode: "dynamic"`): the
|
|
126
|
+
image encodes the code's Posty5 link, so `qr_code_update` can change the
|
|
127
|
+
target later without reprinting. Wi-Fi codes are always static. Left out on
|
|
128
|
+
`qr_code_update`, `mode` keeps the stored mode. Dynamic codes take optional
|
|
129
|
+
scan rules in `access` (`activeFrom`, `expiresAt`, `maxVisits`,
|
|
130
|
+
`fallbackUrl`; `null` clears them, Starter plan or above). `qr_code_list`
|
|
131
|
+
filters by `mode`.
|
|
132
|
+
|
|
133
|
+
### QR content types
|
|
134
|
+
|
|
135
|
+
`qr_code_create` / `qr_code_update` take every QR type through `type` — no
|
|
136
|
+
extra tool:
|
|
137
|
+
|
|
138
|
+
| `type` | Fields | Mode |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| `freeText`, `email`, `wifi`, `call`, `sms`, `url`, `geolocation` | flat fields (`text`, `email`, `wifiName`, …) | dynamic by default; Wi-Fi static |
|
|
141
|
+
| `vcard` | `vcard` object: `firstName` or `organization`, phones, emails, … | **static by default** (a dynamic card is a public page) |
|
|
142
|
+
| `event` | `event` object: `title`, `startsAt` (ISO 8601), `timezone` (IANA), `allDay` | dynamic by default |
|
|
143
|
+
| `whatsapp` | `whatsapp` object: `phoneNumber`, `message` | dynamic by default |
|
|
144
|
+
| `review` | `review` object: `platform`, Google `placeId` or `url` | dynamic by default |
|
|
145
|
+
| `social` | `social.profiles`: 1–12 (`handle` or `url`); static takes one | dynamic by default |
|
|
146
|
+
| `appStore` | `appStore` object: `androidUrl`, `iosUrl`, `fallbackUrl` | always dynamic |
|
|
147
|
+
| `file` | `fileBase64` (≤ 5 MB decoded, `data:` prefix accepted), `fileName`, `mimeType` (PDF, JPEG, PNG, WebP) | always dynamic |
|
|
148
|
+
|
|
149
|
+
`qr_code_create_many` rows keep the first seven types.
|
|
150
|
+
|
|
151
|
+
## 🏷️ What gets recorded
|
|
152
|
+
|
|
153
|
+
Every tool that creates or changes something takes `aiModel` — the assistant
|
|
154
|
+
writes its exact model id. Records created through MCP carry
|
|
155
|
+
`createdFrom: "mcp"` and an `agentOrigin`: the MCP client (from the protocol)
|
|
156
|
+
and that model. Retrying a write with the same `idempotencyKey` returns the
|
|
157
|
+
first result instead of doing it twice.
|
|
158
|
+
|
|
159
|
+
## 🧩 Embedding the server
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { createPosty5McpServer, listTools } from "@posty5/mcp";
|
|
163
|
+
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
164
|
+
|
|
165
|
+
serveStdio(() => createPosty5McpServer({ apiKey: process.env.POSTY5_API_KEY, access: "read", toolsets: ["short-links"] }));
|
|
166
|
+
|
|
167
|
+
console.log(listTools({ access: "read" }).map((tool) => tool.name));
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
`createPosty5McpServer(options)` returns an `McpServer` from
|
|
171
|
+
[`@modelcontextprotocol/server`](https://www.npmjs.com/package/@modelcontextprotocol/server) v2
|
|
172
|
+
(protocol revisions 2025-era and 2026-07-28). A host supplies
|
|
173
|
+
`connection(call)` — the key, base URL and extra headers each call uses (the
|
|
174
|
+
package builds the SDK client) — `hooks` to refuse or log calls
|
|
175
|
+
(`beforeToolCall` may set `call.callId`, which the agent header carries), and
|
|
176
|
+
`idempotencyStore` to share replay protection across processes.
|
|
177
|
+
|
|
178
|
+
### Over HTTP
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
import http from "node:http";
|
|
182
|
+
import { createPosty5McpNodeHandler } from "@posty5/mcp";
|
|
183
|
+
|
|
184
|
+
const handler = createPosty5McpNodeHandler({
|
|
185
|
+
sessionSecret: process.env.SESSION_SECRET!,
|
|
186
|
+
resolve: async (req) => (await isValid(req)) ? { options: { access: "read", connection: () => ({ apiKey: "…" }) } } : { refusal: { status: 401, message: "Create a new MCP link." } },
|
|
187
|
+
});
|
|
188
|
+
http.createServer((req, res) => void handler(req, res)).listen(3021);
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
One handler serves the 2026-07-28 protocol and, statelessly, the 2025 era.
|
|
192
|
+
`resolve` runs per request, so each request's server lists exactly what its
|
|
193
|
+
options allow. A 2025-era client names itself only at `initialize`; the
|
|
194
|
+
handler hands that identity back as a signed `Mcp-Session-Id`, which the
|
|
195
|
+
client echoes, so its later tool calls are attributed to it on any process.
|
|
196
|
+
Express: pass `req.body` as the third argument.
|
|
197
|
+
|
|
198
|
+
Output: CommonJS and ES modules, with type definitions; the binary is CommonJS.
|
|
199
|
+
|
|
200
|
+
## 📖 Guide
|
|
201
|
+
|
|
202
|
+
Connecting Claude, ChatGPT, Cursor, VS Code and other clients, step by step:
|
|
203
|
+
[guide.posty5.com](https://guide.posty5.com).
|