myaidev-method 0.2.15 → 0.2.16

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.
@@ -1,182 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
- import fetch from "node-fetch";
6
- import dotenv from "dotenv";
7
-
8
- // Load environment variables
9
- dotenv.config();
10
-
11
- // WordPress API configuration from environment
12
- const WORDPRESS_URL = process.env.WORDPRESS_URL;
13
- const WORDPRESS_USERNAME = process.env.WORDPRESS_USERNAME;
14
- const WORDPRESS_APP_PASSWORD = process.env.WORDPRESS_APP_PASSWORD;
15
-
16
- // Validate environment variables
17
- if (!WORDPRESS_URL || !WORDPRESS_USERNAME || !WORDPRESS_APP_PASSWORD) {
18
- console.error("Missing required environment variables: WORDPRESS_URL, WORDPRESS_USERNAME, WORDPRESS_APP_PASSWORD");
19
- process.exit(1);
20
- }
21
-
22
- // Create MCP server
23
- const server = new McpServer({
24
- name: "wordpress-mcp-server",
25
- version: "2.0.0",
26
- description: "Enhanced WordPress MCP Server with session management"
27
- });
28
-
29
- // Simple WordPress API helper
30
- async function wordpressRequest(endpoint, method = 'GET', data = null) {
31
- const baseUrl = WORDPRESS_URL.replace(/\/$/, '');
32
- const apiPath = '/wp-json/wp/v2';
33
- const auth = Buffer.from(`${WORDPRESS_USERNAME}:${WORDPRESS_APP_PASSWORD}`).toString('base64');
34
-
35
- const options = {
36
- method,
37
- headers: {
38
- 'Authorization': `Basic ${auth}`,
39
- 'Content-Type': 'application/json'
40
- }
41
- };
42
-
43
- if (data && method !== 'GET') {
44
- options.body = JSON.stringify(data);
45
- }
46
-
47
- const response = await fetch(`${baseUrl}${apiPath}${endpoint}`, options);
48
-
49
- if (!response.ok) {
50
- const error = await response.text();
51
- throw new Error(`WordPress API Error: ${response.status} - ${error}`);
52
- }
53
-
54
- return response.json();
55
- }
56
-
57
- // Health check tool
58
- server.registerTool("wp_health_check", {
59
- title: "WordPress Health Check",
60
- description: "Check WordPress API connectivity",
61
- inputSchema: {
62
- type: "object",
63
- properties: {},
64
- additionalProperties: false
65
- }
66
- }, async (params) => {
67
- try {
68
- // Test basic API connectivity
69
- const response = await wordpressRequest('/');
70
-
71
- return {
72
- content: [{
73
- type: "text",
74
- text: JSON.stringify({
75
- success: true,
76
- message: "WordPress API is responding",
77
- site_url: WORDPRESS_URL,
78
- server_version: "2.0.0"
79
- }, null, 2)
80
- }]
81
- };
82
- } catch (error) {
83
- return {
84
- content: [{
85
- type: "text",
86
- text: JSON.stringify({
87
- success: false,
88
- error: error.message
89
- }, null, 2)
90
- }]
91
- };
92
- }
93
- });
94
-
95
- // Create post tool
96
- server.registerTool("wp_create_post", {
97
- title: "Create WordPress Post",
98
- description: "Create a new WordPress post",
99
- inputSchema: {
100
- type: "object",
101
- properties: {
102
- title: {
103
- type: "string",
104
- description: "Post title"
105
- },
106
- content: {
107
- type: "string",
108
- description: "Post content"
109
- },
110
- status: {
111
- type: "string",
112
- enum: ["draft", "publish", "private"],
113
- description: "Post status",
114
- default: "draft"
115
- },
116
- excerpt: {
117
- type: "string",
118
- description: "Post excerpt"
119
- }
120
- },
121
- required: ["title", "content"],
122
- additionalProperties: false
123
- }
124
- }, async (params) => {
125
- try {
126
- const postData = {
127
- title: params.title,
128
- content: params.content,
129
- status: params.status || 'draft'
130
- };
131
-
132
- if (params.excerpt) {
133
- postData.excerpt = params.excerpt;
134
- }
135
-
136
- const post = await wordpressRequest('/posts', 'POST', postData);
137
-
138
- return {
139
- content: [{
140
- type: "text",
141
- text: JSON.stringify({
142
- success: true,
143
- post_id: post.id,
144
- post_url: post.link,
145
- edit_url: `${WORDPRESS_URL.replace(/\/$/, '')}/wp-admin/post.php?post=${post.id}&action=edit`,
146
- status: post.status,
147
- message: "Post created successfully"
148
- }, null, 2)
149
- }]
150
- };
151
- } catch (error) {
152
- return {
153
- content: [{
154
- type: "text",
155
- text: JSON.stringify({
156
- success: false,
157
- error: error.message
158
- }, null, 2)
159
- }]
160
- };
161
- }
162
- });
163
-
164
- // Start the MCP server
165
- async function main() {
166
- try {
167
- const transport = new StdioServerTransport();
168
- await server.connect(transport);
169
-
170
- console.error("Enhanced WordPress MCP Server v2.0.0 running...");
171
- console.error(`Connected to WordPress site: ${WORDPRESS_URL}`);
172
-
173
- } catch (error) {
174
- console.error("Failed to start server:", error.message);
175
- process.exit(1);
176
- }
177
- }
178
-
179
- main().catch((error) => {
180
- console.error("Server startup error:", error);
181
- process.exit(1);
182
- });
@@ -1,13 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm version:*)",
5
- "Bash(node:*)",
6
- "mcp__sequential-thinking__sequentialthinking",
7
- "WebFetch(domain:github.com)",
8
- "WebSearch"
9
- ],
10
- "deny": [],
11
- "ask": []
12
- }
13
- }