slc-wp-mcp-bridge 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 ADDED
@@ -0,0 +1,373 @@
1
+ SLC WP MCP Bridge
2
+ Copyright (C) 2026 Silicate Labs
3
+
4
+ This program is free software; you can redistribute it and/or modify it under the terms of the
5
+ GNU General Public License as published by the Free Software Foundation; either version 2 of the
6
+ License, or (at your option) any later version.
7
+
8
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
9
+ even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
+ General Public License below for more details.
11
+
12
+ "SLC WP MCP Bridge", "Silicate Labs" and the associated logos are names and marks of Silicate Labs.
13
+ The GPL grants rights to the code; it does not grant rights to use these names or marks.
14
+
15
+ -------------------------------------------------------------------------------------------------
16
+
17
+ GNU GENERAL PUBLIC LICENSE
18
+
19
+ Version 2, June 1991
20
+
21
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
22
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23
+
24
+ Everyone is permitted to copy and distribute verbatim copies
25
+ of this license document, but changing it is not allowed.
26
+
27
+ ### Preamble
28
+
29
+ The licenses for most software are designed to take away your freedom
30
+ to share and change it. By contrast, the GNU General Public License is
31
+ intended to guarantee your freedom to share and change free
32
+ software--to make sure the software is free for all its users. This
33
+ General Public License applies to most of the Free Software
34
+ Foundation's software and to any other program whose authors commit to
35
+ using it. (Some other Free Software Foundation software is covered by
36
+ the GNU Lesser General Public License instead.) You can apply it to
37
+ your programs, too.
38
+
39
+ When we speak of free software, we are referring to freedom, not
40
+ price. Our General Public Licenses are designed to make sure that you
41
+ have the freedom to distribute copies of free software (and charge for
42
+ this service if you wish), that you receive source code or can get it
43
+ if you want it, that you can change the software or use pieces of it
44
+ in new free programs; and that you know you can do these things.
45
+
46
+ To protect your rights, we need to make restrictions that forbid
47
+ anyone to deny you these rights or to ask you to surrender the rights.
48
+ These restrictions translate to certain responsibilities for you if
49
+ you distribute copies of the software, or if you modify it.
50
+
51
+ For example, if you distribute copies of such a program, whether
52
+ gratis or for a fee, you must give the recipients all the rights that
53
+ you have. You must make sure that they, too, receive or can get the
54
+ source code. And you must show them these terms so they know their
55
+ rights.
56
+
57
+ We protect your rights with two steps: (1) copyright the software, and
58
+ (2) offer you this license which gives you legal permission to copy,
59
+ distribute and/or modify the software.
60
+
61
+ Also, for each author's protection and ours, we want to make certain
62
+ that everyone understands that there is no warranty for this free
63
+ software. If the software is modified by someone else and passed on,
64
+ we want its recipients to know that what they have is not the
65
+ original, so that any problems introduced by others will not reflect
66
+ on the original authors' reputations.
67
+
68
+ Finally, any free program is threatened constantly by software
69
+ patents. We wish to avoid the danger that redistributors of a free
70
+ program will individually obtain patent licenses, in effect making the
71
+ program proprietary. To prevent this, we have made it clear that any
72
+ patent must be licensed for everyone's free use or not licensed at
73
+ all.
74
+
75
+ The precise terms and conditions for copying, distribution and
76
+ modification follow.
77
+
78
+ ### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
79
+
80
+ **0.** This License applies to any program or other work which
81
+ contains a notice placed by the copyright holder saying it may be
82
+ distributed under the terms of this General Public License. The
83
+ "Program", below, refers to any such program or work, and a "work
84
+ based on the Program" means either the Program or any derivative work
85
+ under copyright law: that is to say, a work containing the Program or
86
+ a portion of it, either verbatim or with modifications and/or
87
+ translated into another language. (Hereinafter, translation is
88
+ included without limitation in the term "modification".) Each licensee
89
+ is addressed as "you".
90
+
91
+ Activities other than copying, distribution and modification are not
92
+ covered by this License; they are outside its scope. The act of
93
+ running the Program is not restricted, and the output from the Program
94
+ is covered only if its contents constitute a work based on the Program
95
+ (independent of having been made by running the Program). Whether that
96
+ is true depends on what the Program does.
97
+
98
+ **1.** You may copy and distribute verbatim copies of the Program's
99
+ source code as you receive it, in any medium, provided that you
100
+ conspicuously and appropriately publish on each copy an appropriate
101
+ copyright notice and disclaimer of warranty; keep intact all the
102
+ notices that refer to this License and to the absence of any warranty;
103
+ and give any other recipients of the Program a copy of this License
104
+ along with the Program.
105
+
106
+ You may charge a fee for the physical act of transferring a copy, and
107
+ you may at your option offer warranty protection in exchange for a
108
+ fee.
109
+
110
+ **2.** You may modify your copy or copies of the Program or any
111
+ portion of it, thus forming a work based on the Program, and copy and
112
+ distribute such modifications or work under the terms of Section 1
113
+ above, provided that you also meet all of these conditions:
114
+
115
+ **a)** You must cause the modified files to carry prominent notices
116
+ stating that you changed the files and the date of any change.
117
+
118
+ **b)** You must cause any work that you distribute or publish, that in
119
+ whole or in part contains or is derived from the Program or any part
120
+ thereof, to be licensed as a whole at no charge to all third parties
121
+ under the terms of this License.
122
+
123
+ **c)** If the modified program normally reads commands interactively
124
+ when run, you must cause it, when started running for such interactive
125
+ use in the most ordinary way, to print or display an announcement
126
+ including an appropriate copyright notice and a notice that there is
127
+ no warranty (or else, saying that you provide a warranty) and that
128
+ users may redistribute the program under these conditions, and telling
129
+ the user how to view a copy of this License. (Exception: if the
130
+ Program itself is interactive but does not normally print such an
131
+ announcement, your work based on the Program is not required to print
132
+ an announcement.)
133
+
134
+ These requirements apply to the modified work as a whole. If
135
+ identifiable sections of that work are not derived from the Program,
136
+ and can be reasonably considered independent and separate works in
137
+ themselves, then this License, and its terms, do not apply to those
138
+ sections when you distribute them as separate works. But when you
139
+ distribute the same sections as part of a whole which is a work based
140
+ on the Program, the distribution of the whole must be on the terms of
141
+ this License, whose permissions for other licensees extend to the
142
+ entire whole, and thus to each and every part regardless of who wrote
143
+ it.
144
+
145
+ Thus, it is not the intent of this section to claim rights or contest
146
+ your rights to work written entirely by you; rather, the intent is to
147
+ exercise the right to control the distribution of derivative or
148
+ collective works based on the Program.
149
+
150
+ In addition, mere aggregation of another work not based on the Program
151
+ with the Program (or with a work based on the Program) on a volume of
152
+ a storage or distribution medium does not bring the other work under
153
+ the scope of this License.
154
+
155
+ **3.** You may copy and distribute the Program (or a work based on it,
156
+ under Section 2) in object code or executable form under the terms of
157
+ Sections 1 and 2 above provided that you also do one of the following:
158
+
159
+ **a)** Accompany it with the complete corresponding machine-readable
160
+ source code, which must be distributed under the terms of Sections 1
161
+ and 2 above on a medium customarily used for software interchange; or,
162
+
163
+ **b)** Accompany it with a written offer, valid for at least three
164
+ years, to give any third party, for a charge no more than your cost of
165
+ physically performing source distribution, a complete machine-readable
166
+ copy of the corresponding source code, to be distributed under the
167
+ terms of Sections 1 and 2 above on a medium customarily used for
168
+ software interchange; or,
169
+
170
+ **c)** Accompany it with the information you received as to the offer
171
+ to distribute corresponding source code. (This alternative is allowed
172
+ only for noncommercial distribution and only if you received the
173
+ program in object code or executable form with such an offer, in
174
+ accord with Subsection b above.)
175
+
176
+ The source code for a work means the preferred form of the work for
177
+ making modifications to it. For an executable work, complete source
178
+ code means all the source code for all modules it contains, plus any
179
+ associated interface definition files, plus the scripts used to
180
+ control compilation and installation of the executable. However, as a
181
+ special exception, the source code distributed need not include
182
+ anything that is normally distributed (in either source or binary
183
+ form) with the major components (compiler, kernel, and so on) of the
184
+ operating system on which the executable runs, unless that component
185
+ itself accompanies the executable.
186
+
187
+ If distribution of executable or object code is made by offering
188
+ access to copy from a designated place, then offering equivalent
189
+ access to copy the source code from the same place counts as
190
+ distribution of the source code, even though third parties are not
191
+ compelled to copy the source along with the object code.
192
+
193
+ **4.** You may not copy, modify, sublicense, or distribute the Program
194
+ except as expressly provided under this License. Any attempt otherwise
195
+ to copy, modify, sublicense or distribute the Program is void, and
196
+ will automatically terminate your rights under this License. However,
197
+ parties who have received copies, or rights, from you under this
198
+ License will not have their licenses terminated so long as such
199
+ parties remain in full compliance.
200
+
201
+ **5.** You are not required to accept this License, since you have not
202
+ signed it. However, nothing else grants you permission to modify or
203
+ distribute the Program or its derivative works. These actions are
204
+ prohibited by law if you do not accept this License. Therefore, by
205
+ modifying or distributing the Program (or any work based on the
206
+ Program), you indicate your acceptance of this License to do so, and
207
+ all its terms and conditions for copying, distributing or modifying
208
+ the Program or works based on it.
209
+
210
+ **6.** Each time you redistribute the Program (or any work based on
211
+ the Program), the recipient automatically receives a license from the
212
+ original licensor to copy, distribute or modify the Program subject to
213
+ these terms and conditions. You may not impose any further
214
+ restrictions on the recipients' exercise of the rights granted herein.
215
+ You are not responsible for enforcing compliance by third parties to
216
+ this License.
217
+
218
+ **7.** If, as a consequence of a court judgment or allegation of
219
+ patent infringement or for any other reason (not limited to patent
220
+ issues), conditions are imposed on you (whether by court order,
221
+ agreement or otherwise) that contradict the conditions of this
222
+ License, they do not excuse you from the conditions of this License.
223
+ If you cannot distribute so as to satisfy simultaneously your
224
+ obligations under this License and any other pertinent obligations,
225
+ then as a consequence you may not distribute the Program at all. For
226
+ example, if a patent license would not permit royalty-free
227
+ redistribution of the Program by all those who receive copies directly
228
+ or indirectly through you, then the only way you could satisfy both it
229
+ and this License would be to refrain entirely from distribution of the
230
+ Program.
231
+
232
+ If any portion of this section is held invalid or unenforceable under
233
+ any particular circumstance, the balance of the section is intended to
234
+ apply and the section as a whole is intended to apply in other
235
+ circumstances.
236
+
237
+ It is not the purpose of this section to induce you to infringe any
238
+ patents or other property right claims or to contest validity of any
239
+ such claims; this section has the sole purpose of protecting the
240
+ integrity of the free software distribution system, which is
241
+ implemented by public license practices. Many people have made
242
+ generous contributions to the wide range of software distributed
243
+ through that system in reliance on consistent application of that
244
+ system; it is up to the author/donor to decide if he or she is willing
245
+ to distribute software through any other system and a licensee cannot
246
+ impose that choice.
247
+
248
+ This section is intended to make thoroughly clear what is believed to
249
+ be a consequence of the rest of this License.
250
+
251
+ **8.** If the distribution and/or use of the Program is restricted in
252
+ certain countries either by patents or by copyrighted interfaces, the
253
+ original copyright holder who places the Program under this License
254
+ may add an explicit geographical distribution limitation excluding
255
+ those countries, so that distribution is permitted only in or among
256
+ countries not thus excluded. In such case, this License incorporates
257
+ the limitation as if written in the body of this License.
258
+
259
+ **9.** The Free Software Foundation may publish revised and/or new
260
+ versions of the General Public License from time to time. Such new
261
+ versions will be similar in spirit to the present version, but may
262
+ differ in detail to address new problems or concerns.
263
+
264
+ Each version is given a distinguishing version number. If the Program
265
+ specifies a version number of this License which applies to it and
266
+ "any later version", you have the option of following the terms and
267
+ conditions either of that version or of any later version published by
268
+ the Free Software Foundation. If the Program does not specify a
269
+ version number of this License, you may choose any version ever
270
+ published by the Free Software Foundation.
271
+
272
+ **10.** If you wish to incorporate parts of the Program into other
273
+ free programs whose distribution conditions are different, write to
274
+ the author to ask for permission. For software which is copyrighted by
275
+ the Free Software Foundation, write to the Free Software Foundation;
276
+ we sometimes make exceptions for this. Our decision will be guided by
277
+ the two goals of preserving the free status of all derivatives of our
278
+ free software and of promoting the sharing and reuse of software
279
+ generally.
280
+
281
+ **NO WARRANTY**
282
+
283
+ **11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
284
+ WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
285
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
286
+ OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY
287
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
288
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
289
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
290
+ PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
291
+ THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
292
+
293
+ **12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
294
+ WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
295
+ AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
296
+ FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
297
+ CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
298
+ PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
299
+ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
300
+ FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
301
+ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
302
+ DAMAGES.
303
+
304
+ ### END OF TERMS AND CONDITIONS
305
+
306
+ ### How to Apply These Terms to Your New Programs
307
+
308
+ If you develop a new program, and you want it to be of the greatest
309
+ possible use to the public, the best way to achieve this is to make it
310
+ free software which everyone can redistribute and change under these
311
+ terms.
312
+
313
+ To do so, attach the following notices to the program. It is safest to
314
+ attach them to the start of each source file to most effectively
315
+ convey the exclusion of warranty; and each file should have at least
316
+ the "copyright" line and a pointer to where the full notice is found.
317
+
318
+ one line to give the program's name and an idea of what it does.
319
+ Copyright (C) yyyy name of author
320
+
321
+ This program is free software; you can redistribute it and/or
322
+ modify it under the terms of the GNU General Public License
323
+ as published by the Free Software Foundation; either version 2
324
+ of the License, or (at your option) any later version.
325
+
326
+ This program is distributed in the hope that it will be useful,
327
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
328
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
329
+ GNU General Public License for more details.
330
+
331
+ You should have received a copy of the GNU General Public License
332
+ along with this program; if not, write to the Free Software
333
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
334
+
335
+ Also add information on how to contact you by electronic and paper
336
+ mail.
337
+
338
+ If the program is interactive, make it output a short notice like this
339
+ when it starts in an interactive mode:
340
+
341
+ Gnomovision version 69, Copyright (C) year name of author
342
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
343
+ type `show w'. This is free software, and you are welcome
344
+ to redistribute it under certain conditions; type `show c'
345
+ for details.
346
+
347
+ The hypothetical commands \`show w' and \`show c' should show the
348
+ appropriate parts of the General Public License. Of course, the
349
+ commands you use may be called something other than \`show w' and
350
+ \`show c'; they could even be mouse-clicks or menu items--whatever
351
+ suits your program.
352
+
353
+ You should also get your employer (if you work as a programmer) or
354
+ your school, if any, to sign a "copyright disclaimer" for the program,
355
+ if necessary. Here is a sample; alter the names:
356
+
357
+ Yoyodyne, Inc., hereby disclaims all copyright
358
+ interest in the program `Gnomovision'
359
+ (which makes passes at compilers) written
360
+ by James Hacker.
361
+
362
+ signature of Ty Coon, 1 April 1989
363
+ Ty Coon, President of Vice
364
+
365
+ This General Public License does not permit incorporating your program
366
+ into proprietary programs. If your program is a subroutine library,
367
+ you may consider it more useful to permit linking proprietary
368
+ applications with the library. If this is what you want to do, use the
369
+ [GNU Lesser General Public
370
+ License](http://www.gnu.org/licenses/lgpl.html) instead of this
371
+ License.
372
+
373
+ ---
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # slc-wp-mcp-bridge
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Design WordPress sites with AI (Claude Code, Claude Desktop or any MCP client) using **native Gutenberg blocks**.
4
+ Build and test on your own machine, then deploy to your live site, or work on your live site directly.
5
+
6
+ This is the connector for the **SLC WP MCP Bridge** WordPress plugin. Built by Silicate Labs.
7
+
8
+ ## Quick start
9
+
10
+ **1. Local site (optional, recommended).** Needs Node.js 20+. No Docker required.
11
+
12
+ ```bash
13
+ npx slc-wp-mcp-bridge@1.0.0 dev
14
+ ```
15
+
16
+ This starts a private local WordPress at `http://127.0.0.1:9400` (reachable only from your computer) with the plugin installed and configured.
17
+ It is kept between runs. Credentials are random per machine and stored in `~/.slc-wp-mcp/local.json`.
18
+
19
+ **2. Connect your live site** (optional). On the site: install **SLC WP MCP Bridge**, enable it under
20
+ Settings > SLC WP MCP Bridge, allow your user, and create an Application Password (Users > Profile). Then:
21
+
22
+ ```bash
23
+ npx slc-wp-mcp-bridge@1.0.0 connect --url https://your-site.com
24
+ ```
25
+
26
+ The password is typed with hidden input, checked against the site, and saved in `~/.slc-wp-mcp/sites.json`,
27
+ readable only by your OS user. It never goes into a command line, shell history, MCP config or chat.
28
+
29
+ **3. Add the connector to your AI client** once (Claude Code shown). No secrets in this command:
30
+
31
+ ```bash
32
+ claude mcp add wordpress -- npx -y slc-wp-mcp-bridge@1.0.0
33
+ ```
34
+
35
+ **4. Ask**, for example:
36
+
37
+ - "Design a homepage for a bakery on the local site with a hero, three feature columns and a contact call to action."
38
+ - "Make buttons pill-shaped and use the accent color for headings."
39
+ - "Build a header with the site title and a menu: Home, Menu, About, Contact."
40
+ - "Deploy everything to live." (The assistant shows a dry-run plan first.)
41
+
42
+ ## Tools
43
+
44
+ | Area | Tools |
45
+ |---|---|
46
+ | Sites | `wp_list_sites`, `wp_site_info`, `wp_audit_log` |
47
+ | Blocks | `wp_describe_block`, `wp_build_blocks`, `wp_validate_markup` |
48
+ | Pages, posts, menus, synced patterns | `wp_list_content`, `wp_get_content`, `wp_save_content`, `wp_publish_content`, `wp_rollback_content` |
49
+ | Templates and header/footer | `wp_list_templates`, `wp_get_template`, `wp_save_template`, `wp_rollback_template`, `wp_reset_template` |
50
+ | Global styles | `wp_get_styles`, `wp_update_styles`, `wp_rollback_styles` |
51
+ | Patterns, media, identity | `wp_list_patterns`, `wp_get_pattern`, `wp_upload_image`, `wp_set_site_identity` |
52
+ | Local to live | `wp_deploy` (dry run first) |
53
+
54
+ ## How blocks stay valid
55
+
56
+ The assistant sends a block tree (`{ name, attributes, innerBlocks }`). The connector builds the HTML with
57
+ WordPress's own block code (`@wordpress/blocks`), so the editor accepts it, and the plugin validates it again
58
+ before saving. Unsupported attributes are reported instead of silently lost.
59
+
60
+ ## Security
61
+
62
+ **On your computer**
63
+ - Credentials are saved by `connect` in a file only your OS user can read (Windows ACL / chmod 600) and are sent only
64
+ to your site, over https (plain http only for localhost). The connector refuses to send them if TLS certificate
65
+ checking is disabled (`NODE_TLS_REJECT_UNAUTHORIZED=0`), and never follows redirects with them.
66
+ - The local dev site listens on 127.0.0.1 only; its credentials are random per machine.
67
+ - Local images can only be uploaded from the media folder (current directory or `SLC_MEDIA_ROOT`), must be real
68
+ JPEG/PNG/GIF/WebP/AVIF files (checked by content) and at most 10 MB.
69
+ - No install scripts; the full dependency tree is pinned with `npm-shrinkwrap.json`. Pin the version in your MCP
70
+ config (`slc-wp-mcp-bridge@1.0.0`) so updates only happen when you choose.
71
+
72
+ **On your site**
73
+ - Only Application Passwords from users an administrator allowed; WordPress capabilities always apply.
74
+ - WordPress's HTML filter runs on everything the assistant writes, even for administrator accounts; anything it would
75
+ strip is rejected. Pages stay drafts unless publishing is enabled; live design changes need a separate switch.
76
+ - Every overwrite is snapshotted (rollbacks are safety-checked too); every write is audited and rate limited.
77
+ - `wp_deploy` only runs with the confirmation token from a dry run of the same plan, so a deploy can't skip the preview.
78
+ - Treat site content as untrusted: the assistant is told so, and the protections above hold even if it is fooled.
79
+
80
+ ## Environment variables
81
+
82
+ | Variable | Purpose |
83
+ |---|---|
84
+ | `WP_SITE_URL`, `WP_USERNAME`, `WP_APP_PASSWORD` | Alternative to `connect` for CI (all three; prefer `connect` on personal machines) |
85
+ | `SLC_MEDIA_ROOT` | Folder local images may be uploaded from (default: current directory) |
86
+ | `SLC_WP_MCP_HOME` | Where the local site and its credentials live (default: `~/.slc-wp-mcp`) |
87
+
88
+ ## Commands
89
+
90
+ ```
91
+ npx slc-wp-mcp-bridge run the MCP server (started by your AI client)
92
+ npx slc-wp-mcp-bridge dev [--port 9400] start the local WordPress
93
+ npx slc-wp-mcp-bridge connect [--name live] [--url URL] save a site (password typed privately)
94
+ npx slc-wp-mcp-bridge disconnect [--name live]
95
+ npx slc-wp-mcp-bridge info [--show-password]
96
+ npx slc-wp-mcp-bridge reset --yes delete the local site
97
+ ```
98
+
99
+ ## License
100
+
101
+ GPL-2.0-or-later. Copyright (C) 2026 Silicate Labs. "SLC WP MCP Bridge" and "Silicate Labs" are names of Silicate Labs.
package/bin/cli.js ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ // SLC WP MCP Bridge connector by Silicate Labs. GPL-2.0-or-later.
3
+ import { parseArgs } from 'node:util';
4
+
5
+ const [cmd, ...rest] = process.argv.slice(2);
6
+
7
+ const HELP = `slc-wp-mcp-bridge: design WordPress with AI using native blocks (by Silicate Labs)
8
+
9
+ Usage
10
+ npx slc-wp-mcp-bridge Run the MCP server (your AI client starts this)
11
+ npx slc-wp-mcp-bridge dev [--port N] Start a private local WordPress for designing and testing
12
+ npx slc-wp-mcp-bridge connect [--name live] [--url URL] [--user NAME]
13
+ Save a live site; the Application Password is typed privately
14
+ npx slc-wp-mcp-bridge disconnect [--name live]
15
+ npx slc-wp-mcp-bridge info [--show-password] Show local site details
16
+ npx slc-wp-mcp-bridge reset --yes Delete the local site
17
+
18
+ Never paste an Application Password into a chat or a command line.
19
+ `;
20
+
21
+ try {
22
+ if (!cmd || cmd === 'serve') {
23
+ const { startServer } = await import('../src/server.js');
24
+ await startServer();
25
+ } else if (cmd === 'dev') {
26
+ const { values } = parseArgs({ args: rest, options: { port: { type: 'string' } } });
27
+ const { runDev } = await import('../src/dev.js');
28
+ await runDev({ port: values.port });
29
+ } else if (cmd === 'connect') {
30
+ const { values } = parseArgs({ args: rest, options: { name: { type: 'string' }, url: { type: 'string' }, user: { type: 'string' } } });
31
+ const { connect } = await import('../src/connect.js');
32
+ await connect(values);
33
+ } else if (cmd === 'disconnect') {
34
+ const { values } = parseArgs({ args: rest, options: { name: { type: 'string' } } });
35
+ const { disconnect } = await import('../src/connect.js');
36
+ disconnect(values);
37
+ } else if (cmd === 'info') {
38
+ const { values } = parseArgs({ args: rest, options: { 'show-password': { type: 'boolean' } } });
39
+ const { showInfo } = await import('../src/dev.js');
40
+ showInfo({ showPassword: values['show-password'] });
41
+ } else if (cmd === 'reset') {
42
+ const { values } = parseArgs({ args: rest, options: { yes: { type: 'boolean' } } });
43
+ const { resetLocal } = await import('../src/dev.js');
44
+ resetLocal({ yes: values.yes });
45
+ } else if (cmd === '--version' || cmd === '-v') {
46
+ const { VERSION } = await import('../src/version.js');
47
+ console.log(VERSION);
48
+ } else {
49
+ console.log(HELP);
50
+ if (cmd !== '--help' && cmd !== '-h') process.exitCode = 1;
51
+ }
52
+ } catch (e) {
53
+ process.stderr.write(`slc-wp-mcp-bridge: ${e.message}\n`);
54
+ process.exitCode = 1;
55
+ }