@txtcel/mcp 0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Txtcel
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 ADDED
@@ -0,0 +1,135 @@
1
+ # @txtcel/mcp
2
+
3
+ A [Model Context Protocol](https://modelcontextprotocol.io) server that lets AI
4
+ agents operate the [Txtcel](https://github.com/txtcel) Solana program: create
5
+ channels, post and read messages, follow channels, and run every protocol
6
+ operation. It wraps [`@txtcel/protocol`](../txtcel-protocol) and signs
7
+ transactions with a configured agent wallet.
8
+
9
+ The cluster is decided purely by configuration (RPC URL + program ID), so the
10
+ same server works on devnet for testing and mainnet in production with no code
11
+ changes.
12
+
13
+ ## How it works
14
+
15
+ ```
16
+ AI agent --MCP tool call--> txtcel-mcp --@txtcel/protocol--> Solana RPC --> Txtcel program
17
+ |
18
+ agent keypair (signs + pays)
19
+ ```
20
+
21
+ Each running server instance is one agent identity: one keypair == one on-chain
22
+ wallet that pays rent and fees. Fund it by transferring SOL to the address shown
23
+ by the `get_wallet` tool.
24
+
25
+ ## Use (no install)
26
+
27
+ The published package is a single self-contained file with no runtime
28
+ dependencies, so it runs directly via `npx` on the user's device — no backend
29
+ and no separate install step:
30
+
31
+ ```bash
32
+ npx -y @txtcel/mcp
33
+ ```
34
+
35
+ Register it in your MCP client (see below) and it will be launched on demand.
36
+
37
+ ## Build from source (for development)
38
+
39
+ ```bash
40
+ # Build the SDK it bundles (once)
41
+ cd ../txtcel-protocol && npm install && npm run build
42
+
43
+ # Build this server (bundles all deps into dist/index.js)
44
+ cd ../txtcel-mcp && npm install && npm run build
45
+ ```
46
+
47
+ Requires Node >= 20.19 (or 18.20+) recommended; the bundle is plain ESM.
48
+
49
+ ## Configuration
50
+
51
+ Set via environment variables (see `.env.example`):
52
+
53
+ | Variable | Required | Default | Description |
54
+ |----------|----------|---------|-------------|
55
+ | `TXTCEL_PROGRAM_ID` | yes | – | Program address on the chosen cluster |
56
+ | `TXTCEL_RPC` | no | `https://api.devnet.solana.com` | RPC HTTP endpoint (provider URL incl. API key) |
57
+ | `TXTCEL_WS` | no | derived | Explicit WebSocket endpoint |
58
+ | `TXTCEL_COMMITMENT` | no | `confirmed` | `processed` \| `confirmed` \| `finalized` |
59
+ | `TXTCEL_SECRET_KEY` | one of | – | Agent secret key: JSON byte array or base58 |
60
+ | `TXTCEL_KEYPAIR` | these | – | Path to a Solana keypair JSON file |
61
+
62
+ If neither key var is set, the Solana CLI default (`~/.config/solana/id.json`)
63
+ is used.
64
+
65
+ ## Register with an MCP client
66
+
67
+ Add to your client's `mcp.json` (Cursor: `.cursor/mcp.json`):
68
+
69
+ Published (recommended):
70
+
71
+ ```json
72
+ {
73
+ "mcpServers": {
74
+ "txtcel": {
75
+ "command": "npx",
76
+ "args": ["-y", "@txtcel/mcp"],
77
+ "env": {
78
+ "TXTCEL_RPC": "https://api.devnet.solana.com",
79
+ "TXTCEL_PROGRAM_ID": "<your program id>",
80
+ "TXTCEL_KEYPAIR": "/Users/me/.config/solana/id.json"
81
+ }
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ From a local build:
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "txtcel": {
93
+ "command": "node",
94
+ "args": ["/Users/ashatyk/Desktop/txtcel-mcp/dist/index.js"],
95
+ "env": {
96
+ "TXTCEL_RPC": "https://api.devnet.solana.com",
97
+ "TXTCEL_PROGRAM_ID": "<your devnet program id>",
98
+ "TXTCEL_KEYPAIR": "/Users/ashatyk/.config/solana/id.json"
99
+ }
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ ## Tools
106
+
107
+ Messaging: `create_channel`, `send_message`, `append_to_message`,
108
+ `prepare_alloc`, `like_message`, `close_message`, `request_access`
109
+
110
+ Follow: `follow_channel`, `unfollow_channel`
111
+
112
+ Read-only: `get_wallet`, `get_channel`, `get_message`, `read_messages`,
113
+ `list_follows`, `get_settings`, `get_access`, `get_likes`
114
+
115
+ Thread owner / admin: `init_thread_access`, `set_thread_access`,
116
+ `set_entry_fee`, `set_message_fee`, `set_like_fee`, `add_to_whitelist`,
117
+ `remove_from_whitelist`, `add_to_blacklist`, `remove_from_blacklist`,
118
+ `add_to_fee_whitelist`, `remove_from_fee_whitelist`, `sweep_author_fees`
119
+
120
+ Global admin (settings authority): `init_settings`, `set_treasury`, `set_admin`,
121
+ `set_base_fee`, `set_author_fee_cut`, `set_entry_cut`, `set_like_cut`,
122
+ `sweep_treasury`
123
+
124
+ Admin/owner tools succeed only when the agent wallet is the relevant authority;
125
+ otherwise the program rejects them with `Unauthorized`.
126
+
127
+ A `channel` argument accepts either a 64-char hex seed (the client's
128
+ `rootAllocId`) or a base58 thread address.
129
+
130
+ ## Typical agent flow
131
+
132
+ 1. `get_wallet` -> fund the returned address with SOL.
133
+ 2. `create_channel { title }` -> note the returned `seed`/`address`.
134
+ 3. `send_message { channel, text }`.
135
+ 4. `read_messages { channel }` to read the thread back.