@klappay/mcp 0.0.0-stage → 1.0.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 +132 -2
- package/dist/chunk-FCIY5UOM.js +9 -0
- package/dist/chunk-FCIY5UOM.js.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/start-4SOOSFNC.js +620 -0
- package/dist/start-4SOOSFNC.js.map +1 -0
- package/docs/configuration.md +79 -0
- package/docs/getting-started.md +80 -0
- package/docs/public/favicon.png +0 -0
- package/docs/public/logo.png +0 -0
- package/docs/security.md +66 -0
- package/docs/tools.md +131 -0
- package/package.json +69 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Klappay
|
|
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,133 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="./docs/public/logo.png" alt="Klap" width="80" />
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @klappay/mcp
|
|
4
|
+
|
|
5
|
+
A local [Model Context Protocol](https://modelcontextprotocol.io) server for
|
|
6
|
+
the Klap Core API. Your AI assistant (Claude Code, Claude Desktop, Cursor,
|
|
7
|
+
or any MCP client) runs it on your own machine over stdio with `npx`.
|
|
8
|
+
Nothing is hosted by Klappay: the server talks straight to the Klap API with
|
|
9
|
+
the key [`klap login`](https://github.com/klappay/klap-cli) already stored in
|
|
10
|
+
`~/.klap/config.json`.
|
|
11
|
+
|
|
12
|
+
What the assistant can do with it:
|
|
13
|
+
|
|
14
|
+
- **Read**: look up a charge and its timeline, list webhooks and their
|
|
15
|
+
deliveries, list accepted `(token, network)` pairs, run metrics queries.
|
|
16
|
+
- **Test mode**: create charges, re-check them on-chain, retry webhook
|
|
17
|
+
deliveries and push a sandbox charge through its payment states.
|
|
18
|
+
- **Live mode**: read-only by default. Writes are only registered when
|
|
19
|
+
you opt in explicitly.
|
|
20
|
+
|
|
21
|
+
Moving money (escrow release/refund) and managing webhook endpoints or
|
|
22
|
+
payout recipients are never exposed. See [Security](./docs/security.md).
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
Requires Node.js 24+. Log in once with the CLI so the key lives in
|
|
27
|
+
`~/.klap/config.json` instead of your MCP client's config file:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npx @klappay/cli login --api-key - --base-url https://api.klap.example
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Paste the key on stdin and press Ctrl-D. `--api-key -` keeps the key out of
|
|
34
|
+
your shell history; `KLAP_API_KEY=... npx @klappay/cli login --base-url ...`
|
|
35
|
+
works too.
|
|
36
|
+
|
|
37
|
+
Then add one server per environment. Keeping test and live as separate
|
|
38
|
+
servers means the assistant always knows which one it is talking to, and
|
|
39
|
+
you can turn live off without touching test.
|
|
40
|
+
|
|
41
|
+
### Claude Code
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
claude mcp add klap-test -- npx -y @klappay/mcp@0.1.0
|
|
45
|
+
claude mcp add klap-live -e KLAP_ENV=live -- npx -y @klappay/mcp@0.1.0
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Claude Desktop (`claude_desktop_config.json`) and Cursor (`~/.cursor/mcp.json`)
|
|
49
|
+
|
|
50
|
+
Both use the same shape:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"klap-test": {
|
|
56
|
+
"command": "npx",
|
|
57
|
+
"args": ["-y", "@klappay/mcp@0.1.0"]
|
|
58
|
+
},
|
|
59
|
+
"klap-live": {
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": ["-y", "@klappay/mcp@0.1.0"],
|
|
62
|
+
"env": { "KLAP_ENV": "live" }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Pin the exact version as above rather than `@latest`: an MCP server runs
|
|
69
|
+
with your API key, so upgrade it on purpose. On startup it prints one line
|
|
70
|
+
to stderr, e.g. `klap-mcp: test → api.example.com`, and never the key.
|
|
71
|
+
|
|
72
|
+
## Environment variables
|
|
73
|
+
|
|
74
|
+
| Variable | Default | Meaning |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `KLAP_ENV` | `test` | `test` or `live`, exactly. Anything else refuses to start. |
|
|
77
|
+
| `KLAP_API_KEY` | unset | Use this key instead of `~/.klap/config.json`. Requires `KLAP_BASE_URL`. Its prefix must match `KLAP_ENV`. |
|
|
78
|
+
| `KLAP_BASE_URL` | stored `baseUrl` | Required with `KLAP_API_KEY`. With a stored key it must equal the stored `baseUrl`. |
|
|
79
|
+
| `KLAP_MCP_ALLOW_LIVE_WRITES` | unset | Set to exactly `1` to register `charges_create`, `charges_check` and `webhooks_retry_delivery` in live. |
|
|
80
|
+
|
|
81
|
+
An empty value counts as unset. Full rules: [Configuration](./docs/configuration.md).
|
|
82
|
+
|
|
83
|
+
## Tools
|
|
84
|
+
|
|
85
|
+
| Tool | Test | Live | Live + writes |
|
|
86
|
+
|---|---|---|---|
|
|
87
|
+
| `klap_status` | yes | yes | yes |
|
|
88
|
+
| `charges_get` | yes | yes | yes |
|
|
89
|
+
| `charges_timeline` | yes | yes | yes |
|
|
90
|
+
| `webhooks_list` | yes | yes | yes |
|
|
91
|
+
| `webhooks_list_deliveries` | yes | yes | yes |
|
|
92
|
+
| `networks_get` | yes | yes | yes |
|
|
93
|
+
| `metrics_query` | yes | yes | yes |
|
|
94
|
+
| `charges_create` | yes | no | yes |
|
|
95
|
+
| `charges_check` | yes | no | yes |
|
|
96
|
+
| `webhooks_retry_delivery` | yes | no | yes |
|
|
97
|
+
| `sandbox_trigger` | yes | no | no |
|
|
98
|
+
|
|
99
|
+
Every result is JSON and carries `environment`. Inputs and outputs are
|
|
100
|
+
described in [Tools](./docs/tools.md).
|
|
101
|
+
|
|
102
|
+
## Security notes
|
|
103
|
+
|
|
104
|
+
- Live is read-only unless `KLAP_MCP_ALLOW_LIVE_WRITES=1`.
|
|
105
|
+
- A key stored by `klap login` is only ever sent to the base URL it was
|
|
106
|
+
stored with. Pointing `KLAP_BASE_URL` somewhere else refuses to start.
|
|
107
|
+
- Plain `http://` is only accepted for `localhost`, `127.0.0.1` and `[::1]`.
|
|
108
|
+
- API responses are filtered through the published `@klappay/types`
|
|
109
|
+
schemas before the assistant sees them; unknown fields are dropped and a
|
|
110
|
+
charge's `metadata` is left out unless asked for.
|
|
111
|
+
- Not available at all: escrow `release`/`refund`, webhook
|
|
112
|
+
create/delete/rotate-secret, recipient changes, live event streams, QR
|
|
113
|
+
codes and swap quotes.
|
|
114
|
+
|
|
115
|
+
More in [Security](./docs/security.md).
|
|
116
|
+
|
|
117
|
+
## Documentation
|
|
118
|
+
|
|
119
|
+
Full docs live in [`docs/`](./docs) and as a browsable site at
|
|
120
|
+
[mcp.klappay.com](https://mcp.klappay.com), which also publishes
|
|
121
|
+
[`llms.txt`](https://mcp.klappay.com/llms.txt) and
|
|
122
|
+
[`llms-full.txt`](https://mcp.klappay.com/llms-full.txt).
|
|
123
|
+
|
|
124
|
+
| Topic | |
|
|
125
|
+
|---|---|
|
|
126
|
+
| [Getting started](./docs/getting-started.md) | Log in, add the server, first prompts |
|
|
127
|
+
| [Configuration](./docs/configuration.md) | How the environment and key are chosen, every refusal |
|
|
128
|
+
| [Tools](./docs/tools.md) | Every tool's input, output and availability |
|
|
129
|
+
| [Security](./docs/security.md) | Threat model, what's excluded and why |
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server-name.ts"],"sourcesContent":["export const SERVER_NAME = 'klap-mcp'\n"],"mappings":";;;AAAO,IAAM,cAAc;","names":[]}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
SERVER_NAME
|
|
4
|
+
} from "./chunk-FCIY5UOM.js";
|
|
5
|
+
|
|
6
|
+
// src/index.ts
|
|
7
|
+
console.log = console.error;
|
|
8
|
+
console.info = console.error;
|
|
9
|
+
console.debug = console.error;
|
|
10
|
+
try {
|
|
11
|
+
const { start } = await import("./start-4SOOSFNC.js");
|
|
12
|
+
await start();
|
|
13
|
+
} catch (err) {
|
|
14
|
+
const name = err instanceof Error ? err.name : typeof err;
|
|
15
|
+
console.error(`${SERVER_NAME}: failed to start (${name}).`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { SERVER_NAME } from './server-name'\n\nconsole.log = console.error\nconsole.info = console.error\nconsole.debug = console.error\n\ntry {\n const { start } = await import('./start')\n await start()\n} catch (err) {\n const name = err instanceof Error ? err.name : typeof err\n console.error(`${SERVER_NAME}: failed to start (${name}).`)\n process.exit(1)\n}\n"],"mappings":";;;;;;AAEA,QAAQ,MAAM,QAAQ;AACtB,QAAQ,OAAO,QAAQ;AACvB,QAAQ,QAAQ,QAAQ;AAExB,IAAI;AACF,QAAM,EAAE,MAAM,IAAI,MAAM,OAAO,qBAAS;AACxC,QAAM,MAAM;AACd,SAAS,KAAK;AACZ,QAAM,OAAO,eAAe,QAAQ,IAAI,OAAO,OAAO;AACtD,UAAQ,MAAM,GAAG,WAAW,sBAAsB,IAAI,IAAI;AAC1D,UAAQ,KAAK,CAAC;AAChB;","names":[]}
|