@modly_public/mcp-server 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 Modly
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,223 @@
1
+ # @modly_public/mcp-server
2
+
3
+ > Modly is the all-in-one Discord moderation bot — this is the official **MCP server** that lets any Model Context Protocol agent (Claude Desktop, Cursor, Cline, Continue, custom agents) drive a Modly-powered guild.
4
+
5
+ Run it locally over stdio. Point it at your guild with a personal access token. Your AI assistant can then triage appeals, audit members, install recipes, save embed templates, and more — without you leaving the chat.
6
+
7
+ - Bot: <https://modly.net>
8
+ - Issues: <https://github.com/modly-public/modly-mcp/issues>
9
+ - License: [MIT](./LICENSE)
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install -g @modly_public/mcp-server
15
+ ```
16
+
17
+ …or skip global install and use `npx @modly_public/mcp-server` directly in your MCP host config (recommended — auto-updates with each release).
18
+
19
+ ## Run without npm registry
20
+
21
+ The npm package isn't published yet. Until it is, run straight from GitHub — `npx` clones, builds (via the `prepare` script), and launches in one step:
22
+
23
+ ```bash
24
+ # One-liner — auto-clones + builds + runs
25
+ npx github:modly-public/modly-mcp
26
+
27
+ # Or clone + run for local dev
28
+ git clone https://github.com/modly-public/modly-mcp.git
29
+ cd modly-mcp && npm install && npm run build && npm start
30
+ ```
31
+
32
+ The same form works inside MCP host configs — see the [Host configs](#host-configs) section below for `npx github:modly-public/modly-mcp` snippets.
33
+
34
+ > The git-URL form pulls `@modly_public/sdk` straight from `github:modly-public/modly-sdk`, so neither package needs to be on npm yet.
35
+
36
+ ## Environment variables
37
+
38
+ | Variable | Required | Default | Description |
39
+ |---|---|---|---|
40
+ | `MODLY_API_KEY` | yes | — | Personal access token from **Account Settings → API tokens** (`modly_pat_...`). |
41
+ | `MODLY_GUILD_ID` | yes | — | Snowflake of the guild to operate on. |
42
+ | `MODLY_BASE_URL` | no | `https://modly.net` | Override for self-hosted Modly. |
43
+
44
+ ## Host configs
45
+
46
+ > **Which `args` to use?**
47
+ > - `["-y", "@modly_public/mcp-server"]` — preferred, once the package is published to npm.
48
+ > - `["-y", "github:modly-public/modly-mcp"]` — works **today** without an npm publish; pulls source from GitHub, runs the `prepare` build, and launches.
49
+ >
50
+ > The two forms are interchangeable inside any of the host configs below.
51
+
52
+ ### Claude Desktop
53
+
54
+ Edit `claude_desktop_config.json`:
55
+
56
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
57
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
58
+
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "modly": {
63
+ "command": "npx",
64
+ "args": ["-y", "github:modly-public/modly-mcp"],
65
+ "env": {
66
+ "MODLY_GUILD_ID": "1234567890",
67
+ "MODLY_API_KEY": "modly_pat_..."
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ Once `@modly_public/mcp-server` is published to npm, swap `"github:modly-public/modly-mcp"` for `"@modly_public/mcp-server"`.
75
+
76
+ Restart Claude Desktop. The Modly tools appear under the hammer icon.
77
+
78
+ ### Cursor
79
+
80
+ `~/.cursor/mcp.json`:
81
+
82
+ ```json
83
+ {
84
+ "mcpServers": {
85
+ "modly": {
86
+ "command": "npx",
87
+ "args": ["-y", "github:modly-public/modly-mcp"],
88
+ "env": { "MODLY_GUILD_ID": "...", "MODLY_API_KEY": "modly_pat_..." }
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ ### Cline (VS Code)
95
+
96
+ `cline_mcp_settings.json` in the Cline extension settings:
97
+
98
+ ```json
99
+ {
100
+ "mcpServers": {
101
+ "modly": {
102
+ "command": "npx",
103
+ "args": ["-y", "github:modly-public/modly-mcp"],
104
+ "env": { "MODLY_GUILD_ID": "...", "MODLY_API_KEY": "modly_pat_..." }
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ ### Continue / generic MCP host
111
+
112
+ Any MCP host that supports stdio transport. Pass the same `command` + `args` + `env`. Full per-host walkthroughs in [`docs/installation.md`](./docs/installation.md).
113
+
114
+ ## Tool surface
115
+
116
+ Eighteen tools, grouped by domain:
117
+
118
+ ### Webhooks & embeds
119
+
120
+ | Tool | What it does |
121
+ |---|---|
122
+ | `list_webhook_targets` | List every saved outbound webhook target in the guild. |
123
+ | `list_webhook_groups` | List every saved target group in the guild. |
124
+ | `list_embed_templates` | List every saved embed template in the guild. |
125
+ | `save_embed_template` | Create or overwrite a named embed template. |
126
+ | `send_webhook` | Broadcast a saved (or inline) embed to one or more targets. |
127
+ | `search_webhook_deliveries` | Search outbound webhook delivery history for a hook. |
128
+
129
+ ### Moderation & cases
130
+
131
+ | Tool | What it does |
132
+ |---|---|
133
+ | `list_moderation_cases` | List recent moderation cases, optionally filtered by user. |
134
+ | `lookup_member_cases` | Full moderation history for a specific member. |
135
+ | `list_member_notes` | List moderator-only notes attached to a member. |
136
+
137
+ ### Automod & captcha
138
+
139
+ | Tool | What it does |
140
+ |---|---|
141
+ | `list_automod_rules` | List every automod rule in the guild. |
142
+ | `create_automod_rule` | Create a new automod rule (kind, config, scope, action). |
143
+ | `delete_automod_rule` | Delete an automod rule by ID. |
144
+ | `get_captcha_analytics` | Captcha pass/fail counts and active challenge state. |
145
+
146
+ ### Safety / appeals / forms
147
+
148
+ | Tool | What it does |
149
+ |---|---|
150
+ | `list_evader_detections` / `list_evader_flags` | List ban-evasion detections, filterable by risk band and resolution. |
151
+ | `resolve_evader_flag` | Resolve a detection (confirmed / false_positive / ignored). |
152
+ | `list_pending_appeals` | List pending appeals awaiting review. |
153
+ | `list_form_submissions` | Forms approval queue, filterable by form and status. |
154
+ | `decide_form_submission` | Approve or reject a form submission with optional reason. |
155
+
156
+ ### Custom commands
157
+
158
+ | Tool | What it does |
159
+ |---|---|
160
+ | `list_custom_commands` | List every custom command in the guild. |
161
+ | `save_custom_command` | Create or update a custom command. |
162
+ | `delete_custom_command` | Delete a custom command by ID. |
163
+
164
+ ### Engagement / automation / recipes
165
+
166
+ | Tool | What it does |
167
+ |---|---|
168
+ | `get_leveling_top` | Top-N leveling leaderboard. |
169
+ | `enqueue_scheduled_action` | Enqueue a one-shot or cron automation rule. |
170
+ | `install_recipe` | Install a public recipe by slug, with optional overrides. |
171
+
172
+ Full schemas (every input field, type, enum) live in [`docs/tools.md`](./docs/tools.md).
173
+
174
+ > **Why this surface?** Read tools and safe writes only. Anything that mutates webhook URLs (which contain credentials) or escalates moderation actions (ban / kick a real human) stays dashboard-only by design — agents shouldn't be able to add a partner's webhook URL or unilaterally ban a member.
175
+
176
+ ## Example transcripts
177
+
178
+ Three short snippets in [`examples/`](./examples) showing realistic uses:
179
+
180
+ - [Triage today's appeals queue](./examples/triage-appeals.md)
181
+ - [Audit a member](./examples/audit-member.md)
182
+ - [Roll out a recipe](./examples/rollout-recipe.md)
183
+
184
+ ## Directory map
185
+
186
+ ```
187
+ modly-mcp/
188
+ ├── src/
189
+ │ ├── index.ts # stdio entry — wires MCP host ↔ ModlyClient
190
+ │ ├── tools.ts # 18-tool registry with handlers
191
+ │ └── locales/
192
+ │ └── en.ts # tool description strings
193
+ ├── dist/ # compiled output (published to npm)
194
+ ├── docs/
195
+ │ ├── installation.md # per-host install walkthroughs
196
+ │ └── tools.md # full tool reference with schemas
197
+ ├── examples/ # transcript snippets
198
+ ├── package.json
199
+ ├── tsconfig.json
200
+ ├── LICENSE
201
+ └── README.md
202
+ ```
203
+
204
+ | Path | What's in it |
205
+ |---|---|
206
+ | [`src/`](./src) | Server source — entry point, tool registry, locales. |
207
+ | [`docs/`](./docs) | Install + tool reference. |
208
+ | [`examples/`](./examples) | Realistic usage transcripts. |
209
+ | `dist/` | TypeScript build output. Don't edit. |
210
+
211
+ ## Contributing
212
+
213
+ See [`CONTRIBUTING.md`](./CONTRIBUTING.md). Adding a tool means: pick a name, write the JSON schema in `src/tools.ts`, add the description string in `src/locales/en.ts`, and update [`docs/tools.md`](./docs/tools.md).
214
+
215
+ ## License
216
+
217
+ MIT — see [`LICENSE`](./LICENSE).
218
+
219
+ ---
220
+
221
+ Built with ❤ for [Modly](https://modly.net).
222
+
223
+ Last updated: 2026-04-30
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Modly MCP server (stdio transport).
4
+ *
5
+ * Reads `MODLY_GUILD_ID` and `MODLY_API_KEY` from the environment, opens a
6
+ * stdio-based MCP server, and exposes a focused tool surface for managing
7
+ * a single guild's webhooks + embed library + cases. The host (Claude
8
+ * Desktop, Cursor, Cline, custom agent) handles transport negotiation;
9
+ * this process just answers tool calls.
10
+ */
11
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
12
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
13
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
14
+ import { ModlyClient } from "@modly_public/sdk";
15
+ import { TOOLS, dispatch, toolDescription, toolInputSchema } from "./tools.js";
16
+ const GUILD_ID = process.env["MODLY_GUILD_ID"];
17
+ const API_KEY = process.env["MODLY_API_KEY"];
18
+ const BASE_URL = process.env["MODLY_BASE_URL"] ?? "https://modly.net";
19
+ if (!GUILD_ID || !API_KEY) {
20
+ console.error("modly-mcp: MODLY_GUILD_ID and MODLY_API_KEY must be set. Add them to your MCP host config — see README.");
21
+ process.exit(1);
22
+ }
23
+ const client = new ModlyClient({ guildId: GUILD_ID, apiKey: API_KEY, baseUrl: BASE_URL });
24
+ const server = new Server({ name: "modly", version: "0.1.0" }, { capabilities: { tools: {} } });
25
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
26
+ tools: TOOLS.map((t) => ({
27
+ name: t.name,
28
+ description: toolDescription(t),
29
+ inputSchema: toolInputSchema(t),
30
+ })),
31
+ }));
32
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
33
+ const out = await dispatch(req.params.name, req.params.arguments ?? {}, client);
34
+ return {
35
+ content: [{ type: "text", text: JSON.stringify(out, null, 2) }],
36
+ };
37
+ });
38
+ const transport = new StdioServerTransport();
39
+ await server.connect(transport);
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,MAA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