mcp-wordpress 1.2.2 → 1.3.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/README.md +210 -182
- package/dist/cache/CacheInvalidation.d.ts +3 -3
- package/dist/cache/CacheInvalidation.d.ts.map +1 -1
- package/dist/cache/CacheInvalidation.js +119 -119
- package/dist/cache/CacheInvalidation.js.map +1 -1
- package/dist/cache/CacheManager.d.ts +5 -0
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.js +26 -16
- package/dist/cache/CacheManager.js.map +1 -1
- package/dist/cache/HttpCacheWrapper.d.ts +1 -1
- package/dist/cache/HttpCacheWrapper.d.ts.map +1 -1
- package/dist/cache/HttpCacheWrapper.js +29 -29
- package/dist/cache/HttpCacheWrapper.js.map +1 -1
- package/dist/cache/__tests__/CacheInvalidation.test.js +96 -94
- package/dist/cache/__tests__/CacheInvalidation.test.js.map +1 -1
- package/dist/cache/__tests__/CacheManager.test.js +113 -113
- package/dist/cache/__tests__/CacheManager.test.js.map +1 -1
- package/dist/cache/__tests__/CachedWordPressClient.test.js +102 -99
- package/dist/cache/__tests__/CachedWordPressClient.test.js.map +1 -1
- package/dist/cache/__tests__/HttpCacheWrapper.test.js +98 -95
- package/dist/cache/__tests__/HttpCacheWrapper.test.js.map +1 -1
- package/dist/cache/index.d.ts +7 -7
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +4 -4
- package/dist/cache/index.js.map +1 -1
- package/dist/client/CachedWordPressClient.d.ts +4 -4
- package/dist/client/CachedWordPressClient.d.ts.map +1 -1
- package/dist/client/CachedWordPressClient.js +55 -51
- package/dist/client/CachedWordPressClient.js.map +1 -1
- package/dist/client/api.d.ts +10 -10
- package/dist/client/api.js +158 -158
- package/dist/client/api.js.map +1 -1
- package/dist/client/auth.d.ts +2 -2
- package/dist/client/auth.js +72 -72
- package/dist/client/managers/AuthenticationManager.d.ts +2 -2
- package/dist/client/managers/AuthenticationManager.js +46 -46
- package/dist/client/managers/BaseManager.d.ts +1 -1
- package/dist/client/managers/BaseManager.js +9 -9
- package/dist/client/managers/RequestManager.d.ts +5 -3
- package/dist/client/managers/RequestManager.d.ts.map +1 -1
- package/dist/client/managers/RequestManager.js +39 -19
- package/dist/client/managers/RequestManager.js.map +1 -1
- package/dist/client/managers/index.d.ts +3 -3
- package/dist/client/managers/index.js +3 -3
- package/dist/config/ConfigurationSchema.d.ts +2 -2
- package/dist/config/ConfigurationSchema.d.ts.map +1 -1
- package/dist/config/ConfigurationSchema.js +40 -40
- package/dist/config/ConfigurationSchema.js.map +1 -1
- package/dist/config/ServerConfiguration.d.ts +2 -2
- package/dist/config/ServerConfiguration.js +35 -35
- package/dist/config/ServerConfiguration.js.map +1 -1
- package/dist/docs/DocumentationGenerator.d.ts.map +1 -1
- package/dist/docs/DocumentationGenerator.js +296 -255
- package/dist/docs/DocumentationGenerator.js.map +1 -1
- package/dist/docs/MarkdownFormatter.d.ts +1 -1
- package/dist/docs/MarkdownFormatter.d.ts.map +1 -1
- package/dist/docs/MarkdownFormatter.js +60 -51
- package/dist/docs/MarkdownFormatter.js.map +1 -1
- package/dist/docs/index.d.ts +3 -3
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/mcp-wordpress-1.3.0.tgz +0 -0
- package/dist/performance/MetricsCollector.d.ts +3 -3
- package/dist/performance/MetricsCollector.d.ts.map +1 -1
- package/dist/performance/MetricsCollector.js +33 -27
- package/dist/performance/MetricsCollector.js.map +1 -1
- package/dist/performance/PerformanceAnalytics.d.ts +12 -12
- package/dist/performance/PerformanceAnalytics.d.ts.map +1 -1
- package/dist/performance/PerformanceAnalytics.js +200 -154
- package/dist/performance/PerformanceAnalytics.js.map +1 -1
- package/dist/performance/PerformanceMonitor.d.ts +5 -5
- package/dist/performance/PerformanceMonitor.d.ts.map +1 -1
- package/dist/performance/PerformanceMonitor.js +53 -52
- package/dist/performance/PerformanceMonitor.js.map +1 -1
- package/dist/performance/index.d.ts +6 -6
- package/dist/performance/index.d.ts.map +1 -1
- package/dist/performance/index.js +3 -3
- package/dist/security/InputValidator.d.ts +1 -1
- package/dist/security/InputValidator.d.ts.map +1 -1
- package/dist/security/InputValidator.js +111 -88
- package/dist/security/InputValidator.js.map +1 -1
- package/dist/security/SecurityConfig.d.ts +5 -5
- package/dist/security/SecurityConfig.js +92 -92
- package/dist/security/SecurityConfig.js.map +1 -1
- package/dist/server/ConnectionTester.d.ts +1 -1
- package/dist/server/ConnectionTester.d.ts.map +1 -1
- package/dist/server/ConnectionTester.js +4 -4
- package/dist/server/ConnectionTester.js.map +1 -1
- package/dist/server/ToolRegistry.d.ts +2 -2
- package/dist/server/ToolRegistry.d.ts.map +1 -1
- package/dist/server/ToolRegistry.js +35 -32
- package/dist/server/ToolRegistry.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/tools/BaseToolManager.js +5 -5
- package/dist/tools/auth.d.ts +2 -2
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +32 -31
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/cache.d.ts +1 -1
- package/dist/tools/cache.d.ts.map +1 -1
- package/dist/tools/cache.js +71 -71
- package/dist/tools/cache.js.map +1 -1
- package/dist/tools/comments.d.ts +2 -2
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +79 -79
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/index.d.ts +10 -10
- package/dist/tools/index.js +10 -10
- package/dist/tools/media.d.ts +2 -2
- package/dist/tools/media.js +80 -80
- package/dist/tools/pages.d.ts +2 -2
- package/dist/tools/pages.d.ts.map +1 -1
- package/dist/tools/pages.js +75 -75
- package/dist/tools/pages.js.map +1 -1
- package/dist/tools/performance.d.ts +1 -1
- package/dist/tools/performance.d.ts.map +1 -1
- package/dist/tools/performance.js +311 -287
- package/dist/tools/performance.js.map +1 -1
- package/dist/tools/posts.d.ts +2 -2
- package/dist/tools/posts.d.ts.map +1 -1
- package/dist/tools/posts.js +94 -94
- package/dist/tools/posts.js.map +1 -1
- package/dist/tools/site.d.ts +2 -2
- package/dist/tools/site.d.ts.map +1 -1
- package/dist/tools/site.js +60 -60
- package/dist/tools/site.js.map +1 -1
- package/dist/tools/taxonomies.d.ts +2 -2
- package/dist/tools/taxonomies.js +89 -89
- package/dist/tools/users.d.ts +2 -2
- package/dist/tools/users.js +68 -68
- package/dist/tools/users.js.map +1 -1
- package/dist/types/client.d.ts +13 -13
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client.js +12 -12
- package/dist/types/client.js.map +1 -1
- package/dist/types/index.d.ts +19 -19
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -3
- package/dist/types/mcp.d.ts +7 -7
- package/dist/types/wordpress.d.ts +21 -21
- package/dist/types/wordpress.d.ts.map +1 -1
- package/dist/utils/debug.d.ts +2 -2
- package/dist/utils/debug.js +28 -28
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/error.js +13 -13
- package/dist/utils/error.js.map +1 -1
- package/dist/utils/toolWrapper.d.ts.map +1 -1
- package/dist/utils/toolWrapper.js +5 -5
- package/dist/utils/toolWrapper.js.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +41 -31
- package/dist/utils/validation.js.map +1 -1
- package/docs/CACHING.md +36 -2
- package/docs/DOCKER.md +24 -18
- package/docs/PERFORMANCE_MONITORING.md +49 -1
- package/docs/SECURITY_TESTING.md +30 -1
- package/docs/api/README.md +9 -1
- package/docs/api/summary.json +1 -1
- package/docs/contract-testing.md +24 -3
- package/docs/developer/GITHUB_ACTIONS_SETUP.md +8 -2
- package/docs/developer/MAINTENANCE.md +29 -3
- package/docs/developer/MIGRATION_GUIDE.md +13 -1
- package/docs/developer/NPM_AUTH_SETUP.md +13 -2
- package/docs/developer/REFACTORING.md +31 -1
- package/docs/releases/COMMUNITY_ANNOUNCEMENT_v1.1.2.md +18 -7
- package/docs/releases/RELEASE_NOTES_v1.1.2.md +31 -5
- package/docs/user-guides/DOCKER_SETUP.md +264 -0
- package/docs/user-guides/DTX_SETUP.md +327 -0
- package/docs/user-guides/NPM_SETUP.md +109 -0
- package/docs/user-guides/NPX_SETUP.md +281 -0
- package/docs/wordpress-rest-api-authentication-troubleshooting.md +13 -2
- package/package.json +27 -8
- package/src/cache/CacheInvalidation.ts +140 -132
- package/src/cache/CacheManager.ts +40 -29
- package/src/cache/HttpCacheWrapper.ts +105 -68
- package/src/cache/__tests__/CacheInvalidation.test.ts +123 -118
- package/src/cache/__tests__/CacheManager.test.ts +156 -152
- package/src/cache/__tests__/CachedWordPressClient.test.ts +131 -116
- package/src/cache/__tests__/HttpCacheWrapper.test.ts +118 -115
- package/src/cache/index.ts +13 -13
- package/src/client/CachedWordPressClient.ts +90 -80
- package/src/client/api.ts +205 -205
- package/src/client/auth.ts +80 -80
- package/src/client/managers/AuthenticationManager.ts +61 -61
- package/src/client/managers/BaseManager.ts +11 -11
- package/src/client/managers/RequestManager.ts +79 -47
- package/src/client/managers/index.ts +3 -3
- package/src/config/ConfigurationSchema.ts +44 -44
- package/src/config/ServerConfiguration.ts +39 -39
- package/src/docs/DocumentationGenerator.ts +402 -295
- package/src/docs/MarkdownFormatter.ts +94 -69
- package/src/docs/index.ts +4 -4
- package/src/index.ts +24 -21
- package/src/performance/MetricsCollector.ts +90 -58
- package/src/performance/PerformanceAnalytics.ts +386 -262
- package/src/performance/PerformanceMonitor.ts +152 -118
- package/src/performance/index.ts +9 -9
- package/src/security/InputValidator.ts +148 -91
- package/src/security/SecurityConfig.ts +94 -94
- package/src/server/ConnectionTester.ts +21 -15
- package/src/server/ToolRegistry.ts +64 -51
- package/src/server.ts +2 -2
- package/src/tools/BaseToolManager.ts +6 -6
- package/src/tools/auth.ts +42 -37
- package/src/tools/cache.ts +85 -81
- package/src/tools/comments.ts +93 -91
- package/src/tools/index.ts +10 -10
- package/src/tools/media.ts +89 -89
- package/src/tools/pages.ts +89 -87
- package/src/tools/performance.ts +443 -352
- package/src/tools/posts.ts +109 -107
- package/src/tools/site.ts +86 -77
- package/src/tools/taxonomies.ts +102 -102
- package/src/tools/users.ts +77 -77
- package/src/types/client.ts +157 -60
- package/src/types/index.ts +49 -27
- package/src/types/mcp.ts +15 -15
- package/src/types/wordpress.ts +57 -29
- package/src/utils/debug.ts +37 -37
- package/src/utils/error.ts +47 -25
- package/src/utils/toolWrapper.ts +12 -8
- package/src/utils/validation.ts +116 -65
- package/dist/client/WordPressClient.d.ts +0 -81
- package/dist/client/WordPressClient.d.ts.map +0 -1
- package/dist/client/WordPressClient.js +0 -354
- package/dist/client/WordPressClient.js.map +0 -1
- package/dist/performance/AnomalyDetector.d.ts +0 -63
- package/dist/performance/AnomalyDetector.d.ts.map +0 -1
- package/dist/performance/AnomalyDetector.js +0 -222
- package/dist/performance/AnomalyDetector.js.map +0 -1
- package/dist/performance/BenchmarkAnalyzer.d.ts +0 -67
- package/dist/performance/BenchmarkAnalyzer.d.ts.map +0 -1
- package/dist/performance/BenchmarkAnalyzer.js +0 -301
- package/dist/performance/BenchmarkAnalyzer.js.map +0 -1
- package/dist/performance/TrendAnalyzer.d.ts +0 -69
- package/dist/performance/TrendAnalyzer.d.ts.map +0 -1
- package/dist/performance/TrendAnalyzer.js +0 -203
- package/dist/performance/TrendAnalyzer.js.map +0 -1
- package/dist/tools/BaseToolClass.d.ts +0 -76
- package/dist/tools/BaseToolClass.d.ts.map +0 -1
- package/dist/tools/BaseToolClass.js +0 -104
- package/dist/tools/BaseToolClass.js.map +0 -1
- package/dist/tools/base.d.ts +0 -37
- package/dist/tools/base.d.ts.map +0 -1
- package/dist/tools/base.js +0 -60
- package/dist/tools/base.js.map +0 -1
- package/docs/user-guides/CLAUDE_DESKTOP_SETUP.md +0 -187
package/docs/contract-testing.md
CHANGED
|
@@ -11,6 +11,7 @@ npm run test:contracts:live
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
This command will:
|
|
14
|
+
|
|
14
15
|
1. 🐳 Start isolated WordPress + MySQL containers (port 8081)
|
|
15
16
|
2. ⚙️ Auto-configure WordPress with test data
|
|
16
17
|
3. 🧪 Run contract tests against the live instance
|
|
@@ -21,17 +22,20 @@ This command will:
|
|
|
21
22
|
## 📋 What the Automated Setup Includes
|
|
22
23
|
|
|
23
24
|
### WordPress Configuration
|
|
25
|
+
|
|
24
26
|
- **URL**: `http://localhost:8081`
|
|
25
27
|
- **Admin User**: `testuser` / `test-password-123`
|
|
26
28
|
- **App Password**: Auto-generated for API access
|
|
27
29
|
- **Test Content**: Pre-created posts and media for testing
|
|
28
30
|
|
|
29
31
|
### Docker Services
|
|
32
|
+
|
|
30
33
|
- **WordPress**: Latest WordPress with auto-setup
|
|
31
34
|
- **MySQL**: 8.0 with optimized configuration
|
|
32
35
|
- **WP-CLI**: For automated WordPress configuration
|
|
33
36
|
|
|
34
37
|
### Network Isolation
|
|
38
|
+
|
|
35
39
|
- Uses separate Docker network: `wordpress-test-network`
|
|
36
40
|
- Port 8081 (different from main development environment)
|
|
37
41
|
- Isolated volumes: `wordpress_test_data`, `db_test_data`
|
|
@@ -41,21 +45,25 @@ This command will:
|
|
|
41
45
|
If you prefer manual setup or need custom configuration:
|
|
42
46
|
|
|
43
47
|
### 1. Start Services
|
|
48
|
+
|
|
44
49
|
```bash
|
|
45
50
|
docker-compose -f docker-compose.test.yml up -d
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
### 2. Check Status
|
|
54
|
+
|
|
49
55
|
```bash
|
|
50
56
|
docker-compose -f docker-compose.test.yml ps
|
|
51
57
|
docker-compose -f docker-compose.test.yml logs -f wordpress-test
|
|
52
58
|
```
|
|
53
59
|
|
|
54
60
|
### 3. Access WordPress
|
|
55
|
-
|
|
56
|
-
-
|
|
61
|
+
|
|
62
|
+
- WordPress: <http://localhost:8081>
|
|
63
|
+
- Admin Panel: <http://localhost:8081/wp-admin>
|
|
57
64
|
|
|
58
65
|
### 4. Run Tests
|
|
66
|
+
|
|
59
67
|
```bash
|
|
60
68
|
# Set environment variables
|
|
61
69
|
export WORDPRESS_TEST_URL="http://localhost:8081"
|
|
@@ -68,6 +76,7 @@ npm run test:contracts
|
|
|
68
76
|
```
|
|
69
77
|
|
|
70
78
|
### 5. Cleanup
|
|
79
|
+
|
|
71
80
|
```bash
|
|
72
81
|
docker-compose -f docker-compose.test.yml down -v
|
|
73
82
|
```
|
|
@@ -75,18 +84,22 @@ docker-compose -f docker-compose.test.yml down -v
|
|
|
75
84
|
## 🧪 Test Modes
|
|
76
85
|
|
|
77
86
|
### Mock Testing (Default)
|
|
87
|
+
|
|
78
88
|
```bash
|
|
79
89
|
npm run test:contracts
|
|
80
90
|
```
|
|
91
|
+
|
|
81
92
|
- Uses Pact mock provider
|
|
82
93
|
- No external dependencies
|
|
83
94
|
- Fast execution
|
|
84
95
|
- Good for CI/CD
|
|
85
96
|
|
|
86
97
|
### Live Testing
|
|
98
|
+
|
|
87
99
|
```bash
|
|
88
100
|
npm run test:contracts:live
|
|
89
101
|
```
|
|
102
|
+
|
|
90
103
|
- Tests against real WordPress
|
|
91
104
|
- Validates actual API behavior
|
|
92
105
|
- Comprehensive integration testing
|
|
@@ -97,21 +110,25 @@ npm run test:contracts:live
|
|
|
97
110
|
The contract tests verify:
|
|
98
111
|
|
|
99
112
|
### ✅ Posts API
|
|
113
|
+
|
|
100
114
|
- Create posts with proper structure
|
|
101
115
|
- Retrieve posts with pagination
|
|
102
116
|
- Response format validation
|
|
103
117
|
|
|
104
118
|
### ✅ Media API
|
|
119
|
+
|
|
105
120
|
- File upload handling
|
|
106
121
|
- Multipart form data
|
|
107
122
|
- Media library integration
|
|
108
123
|
|
|
109
124
|
### ✅ Users API
|
|
125
|
+
|
|
110
126
|
- User information retrieval
|
|
111
127
|
- Authentication validation
|
|
112
128
|
- Permission handling
|
|
113
129
|
|
|
114
130
|
### ✅ Authentication
|
|
131
|
+
|
|
115
132
|
- App password authentication
|
|
116
133
|
- Authorization headers
|
|
117
134
|
- Error handling
|
|
@@ -119,6 +136,7 @@ The contract tests verify:
|
|
|
119
136
|
## 🛠️ Troubleshooting
|
|
120
137
|
|
|
121
138
|
### Port Already in Use
|
|
139
|
+
|
|
122
140
|
```bash
|
|
123
141
|
# Check what's using port 8081
|
|
124
142
|
lsof -i :8081
|
|
@@ -128,6 +146,7 @@ kill -9 <PID>
|
|
|
128
146
|
```
|
|
129
147
|
|
|
130
148
|
### Docker Issues
|
|
149
|
+
|
|
131
150
|
```bash
|
|
132
151
|
# Clean up Docker resources
|
|
133
152
|
docker system prune -f
|
|
@@ -139,6 +158,7 @@ sudo service docker restart # Linux
|
|
|
139
158
|
```
|
|
140
159
|
|
|
141
160
|
### WordPress Not Ready
|
|
161
|
+
|
|
142
162
|
```bash
|
|
143
163
|
# Check WordPress logs
|
|
144
164
|
docker-compose -f docker-compose.test.yml logs wordpress-test
|
|
@@ -151,6 +171,7 @@ curl http://localhost:8081/wp-json/wp/v2/
|
|
|
151
171
|
```
|
|
152
172
|
|
|
153
173
|
### Test Failures
|
|
174
|
+
|
|
154
175
|
```bash
|
|
155
176
|
# Run with debug output
|
|
156
177
|
DEBUG=true npm run test:contracts:live
|
|
@@ -180,4 +201,4 @@ To use in CI/CD pipelines:
|
|
|
180
201
|
timeout-minutes: 10
|
|
181
202
|
```
|
|
182
203
|
|
|
183
|
-
The automated setup is designed to work in CI environments with proper Docker support.
|
|
204
|
+
The automated setup is designed to work in CI environments with proper Docker support.
|
|
@@ -12,6 +12,7 @@ The MCP WordPress project includes comprehensive GitHub Actions workflows for au
|
|
|
12
12
|
**Purpose**: Automatically publish the package to NPM
|
|
13
13
|
|
|
14
14
|
**Features**:
|
|
15
|
+
|
|
15
16
|
- ✅ Checkout code with latest actions
|
|
16
17
|
- ✅ Setup Node.js 18 with NPM registry
|
|
17
18
|
- ✅ Install dependencies with `npm ci`
|
|
@@ -23,6 +24,7 @@ The MCP WordPress project includes comprehensive GitHub Actions workflows for au
|
|
|
23
24
|
**Required Secret**: `NPM_TOKEN`
|
|
24
25
|
|
|
25
26
|
**Usage**:
|
|
27
|
+
|
|
26
28
|
```bash
|
|
27
29
|
# Create a GitHub release to trigger publishing
|
|
28
30
|
gh release create v1.1.3 --title "Release v1.1.3" --notes "Release notes here"
|
|
@@ -30,12 +32,14 @@ gh release create v1.1.3 --title "Release v1.1.3" --notes "Release notes here"
|
|
|
30
32
|
|
|
31
33
|
### 2. CI Workflow (`.github/workflows/ci.yml`)
|
|
32
34
|
|
|
33
|
-
**Triggers**:
|
|
35
|
+
**Triggers**:
|
|
36
|
+
|
|
34
37
|
- Push to `main` or `develop` branches
|
|
35
38
|
- Pull requests to `main`
|
|
36
39
|
- Scheduled nightly runs
|
|
37
40
|
|
|
38
41
|
**Features**:
|
|
42
|
+
|
|
39
43
|
- 🧪 **Test Matrix**: Multiple Node.js versions (18, 20, 22)
|
|
40
44
|
- 🔍 **Quality Checks**: Linting, type checking, coverage
|
|
41
45
|
- 📦 **Build Verification**: Package building and installation
|
|
@@ -79,12 +83,14 @@ Check that your workflows reference the correct package name and repository:
|
|
|
79
83
|
### 3. Test the Workflows
|
|
80
84
|
|
|
81
85
|
1. **Test CI Workflow**:
|
|
86
|
+
|
|
82
87
|
```bash
|
|
83
88
|
# Push to main branch triggers CI
|
|
84
89
|
git push origin main
|
|
85
90
|
```
|
|
86
91
|
|
|
87
92
|
2. **Test NPM Publish**:
|
|
93
|
+
|
|
88
94
|
```bash
|
|
89
95
|
# Create a release to trigger publishing
|
|
90
96
|
git tag v1.1.3
|
|
@@ -205,4 +211,4 @@ This automatically triggers the NPM publish workflow and makes the new version a
|
|
|
205
211
|
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
|
|
206
212
|
- [NPM Publishing Guide](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)
|
|
207
213
|
- [Semantic Versioning](https://semver.org/)
|
|
208
|
-
- [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github)
|
|
214
|
+
- [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github)
|
|
@@ -9,6 +9,7 @@ This document outlines automated and manual processes to keep the project secure
|
|
|
9
9
|
### NPM Package Configuration
|
|
10
10
|
|
|
11
11
|
#### `.npmignore` File Maintenance
|
|
12
|
+
|
|
12
13
|
The `.npmignore` file is automatically checked before each publication:
|
|
13
14
|
|
|
14
15
|
```bash
|
|
@@ -20,6 +21,7 @@ npm run check:ignore
|
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
**What it checks:**
|
|
24
|
+
|
|
23
25
|
- ✅ **Security files** are excluded (`.env`, `.npmrc`, `*.pem`, `*.key`, credentials)
|
|
24
26
|
- ✅ **Test files** are excluded (`tests/`, `*.test.js`, `coverage/`)
|
|
25
27
|
- ✅ **Development files** are excluded (`src/`, config files, IDE settings)
|
|
@@ -28,9 +30,11 @@ npm run check:ignore
|
|
|
28
30
|
- ✅ **Documentation** is selectively included (README, LICENSE, CHANGELOG only)
|
|
29
31
|
|
|
30
32
|
#### Files Excluded from NPM Package
|
|
33
|
+
|
|
31
34
|
The following are **never** published to NPM:
|
|
32
35
|
|
|
33
36
|
**Security & Secrets:**
|
|
37
|
+
|
|
34
38
|
- `.env*` files
|
|
35
39
|
- `.npmrc` (contains auth tokens)
|
|
36
40
|
- `*.pem`, `*.key`, `*.cert` (certificates/keys)
|
|
@@ -38,22 +42,26 @@ The following are **never** published to NPM:
|
|
|
38
42
|
- `*.token`, `*.credentials` files
|
|
39
43
|
|
|
40
44
|
**Development Files:**
|
|
45
|
+
|
|
41
46
|
- `src/` (source TypeScript - only `dist/` is published)
|
|
42
47
|
- `tests/`, `coverage/`, test configuration files
|
|
43
48
|
- `tsconfig.json`, `eslint.config.js`
|
|
44
49
|
- `.vscode/`, `.idea/` (IDE settings)
|
|
45
50
|
|
|
46
51
|
**CI/CD & Git:**
|
|
52
|
+
|
|
47
53
|
- `.git/`, `.github/`
|
|
48
54
|
- `.gitignore`, `.gitattributes`
|
|
49
55
|
- CI configuration files (`.travis.yml`, `.circleci/`, etc.)
|
|
50
56
|
|
|
51
57
|
**Logs & Temporary:**
|
|
58
|
+
|
|
52
59
|
- `logs/`, `*.log`, `debug/`
|
|
53
60
|
- `tmp/`, `temp/`, `*.tmp`
|
|
54
61
|
- `test-results/`, `test-reports/`
|
|
55
62
|
|
|
56
63
|
**Documentation (Selective):**
|
|
64
|
+
|
|
57
65
|
- ❌ Development docs: `TODO.md`, `REFACTORING.md`, `MIGRATION_GUIDE.md`
|
|
58
66
|
- ❌ Release docs: `COMMUNITY_ANNOUNCEMENT_*.md`, `RELEASE_NOTES_*.md`
|
|
59
67
|
- ❌ Setup docs: `NPM_AUTH_SETUP.md`, `CLAUDE_DESKTOP_SETUP.md`
|
|
@@ -62,6 +70,7 @@ The following are **never** published to NPM:
|
|
|
62
70
|
### Scripts for Maintenance
|
|
63
71
|
|
|
64
72
|
#### Ignore Files Sync (`scripts/sync-ignore-files.js`)
|
|
73
|
+
|
|
65
74
|
Ensures `.gitignore` and `.npmignore` stay synchronized and secure:
|
|
66
75
|
|
|
67
76
|
```bash
|
|
@@ -73,12 +82,14 @@ npm run prepublishOnly
|
|
|
73
82
|
```
|
|
74
83
|
|
|
75
84
|
**Features:**
|
|
85
|
+
|
|
76
86
|
- Verifies security patterns are in place
|
|
77
87
|
- Checks for missing patterns in both files
|
|
78
88
|
- Validates that sensitive files are properly excluded
|
|
79
89
|
- Reports summary statistics
|
|
80
90
|
|
|
81
91
|
#### Pre-commit Hooks
|
|
92
|
+
|
|
82
93
|
Automated checks before each commit:
|
|
83
94
|
|
|
84
95
|
```bash
|
|
@@ -90,6 +101,7 @@ npx lint-staged
|
|
|
90
101
|
```
|
|
91
102
|
|
|
92
103
|
**What runs:**
|
|
104
|
+
|
|
93
105
|
- ESLint fixes on TypeScript/JavaScript
|
|
94
106
|
- Prettier formatting
|
|
95
107
|
- Markdown linting
|
|
@@ -114,6 +126,7 @@ The following scripts help maintain file integrity:
|
|
|
114
126
|
### Weekly Tasks
|
|
115
127
|
|
|
116
128
|
1. **Dependency Updates**
|
|
129
|
+
|
|
117
130
|
```bash
|
|
118
131
|
npm audit
|
|
119
132
|
npm audit fix
|
|
@@ -121,12 +134,14 @@ The following scripts help maintain file integrity:
|
|
|
121
134
|
```
|
|
122
135
|
|
|
123
136
|
2. **Security Review**
|
|
137
|
+
|
|
124
138
|
```bash
|
|
125
139
|
npm run check:ignore
|
|
126
140
|
git status # Ensure no sensitive files are staged
|
|
127
141
|
```
|
|
128
142
|
|
|
129
143
|
3. **Test Coverage Review**
|
|
144
|
+
|
|
130
145
|
```bash
|
|
131
146
|
npm run test:coverage
|
|
132
147
|
npm run health
|
|
@@ -145,6 +160,7 @@ The following scripts help maintain file integrity:
|
|
|
145
160
|
- Check all markdown files for accuracy
|
|
146
161
|
|
|
147
162
|
3. **Dependency Major Updates**
|
|
163
|
+
|
|
148
164
|
```bash
|
|
149
165
|
npm update
|
|
150
166
|
npm run test
|
|
@@ -154,6 +170,7 @@ The following scripts help maintain file integrity:
|
|
|
154
170
|
### Before Each Release
|
|
155
171
|
|
|
156
172
|
1. **Pre-publication Checklist**
|
|
173
|
+
|
|
157
174
|
```bash
|
|
158
175
|
# 1. Build and test everything
|
|
159
176
|
npm run build
|
|
@@ -182,6 +199,7 @@ The following scripts help maintain file integrity:
|
|
|
182
199
|
### File Exclusion Patterns
|
|
183
200
|
|
|
184
201
|
**Always exclude from NPM:**
|
|
202
|
+
|
|
185
203
|
```
|
|
186
204
|
.env*
|
|
187
205
|
.npmrc
|
|
@@ -194,6 +212,7 @@ secrets/
|
|
|
194
212
|
```
|
|
195
213
|
|
|
196
214
|
**Always exclude from Git:**
|
|
215
|
+
|
|
197
216
|
```
|
|
198
217
|
.env
|
|
199
218
|
.npmrc
|
|
@@ -219,10 +238,11 @@ node_modules/
|
|
|
219
238
|
**If credentials are accidentally published:**
|
|
220
239
|
|
|
221
240
|
1. **Immediate Response:**
|
|
241
|
+
|
|
222
242
|
```bash
|
|
223
|
-
npm unpublish
|
|
243
|
+
npm unpublish mcp-wordpress@version
|
|
224
244
|
# Or deprecate if unpublish is not allowed
|
|
225
|
-
npm deprecate
|
|
245
|
+
npm deprecate mcp-wordpress@version "Security issue - use newer version"
|
|
226
246
|
```
|
|
227
247
|
|
|
228
248
|
2. **Credential Rotation:**
|
|
@@ -232,6 +252,7 @@ node_modules/
|
|
|
232
252
|
- Regenerate any exposed credentials
|
|
233
253
|
|
|
234
254
|
3. **Republish:**
|
|
255
|
+
|
|
235
256
|
```bash
|
|
236
257
|
npm version patch
|
|
237
258
|
npm publish
|
|
@@ -242,6 +263,7 @@ node_modules/
|
|
|
242
263
|
### Automated Checks
|
|
243
264
|
|
|
244
265
|
The following run automatically:
|
|
266
|
+
|
|
245
267
|
- `prepublishOnly` before each npm publish
|
|
246
268
|
- `pre-commit` before each git commit
|
|
247
269
|
- CI/CD tests on every push/PR
|
|
@@ -249,6 +271,7 @@ The following run automatically:
|
|
|
249
271
|
### Manual Verification
|
|
250
272
|
|
|
251
273
|
Regular checks to perform:
|
|
274
|
+
|
|
252
275
|
```bash
|
|
253
276
|
# Check what would be published
|
|
254
277
|
npm publish --dry-run
|
|
@@ -266,6 +289,7 @@ git log --oneline -10
|
|
|
266
289
|
## Tools and Dependencies
|
|
267
290
|
|
|
268
291
|
### Core Tools
|
|
292
|
+
|
|
269
293
|
- **ESLint**: Code quality and consistency
|
|
270
294
|
- **Prettier**: Code formatting
|
|
271
295
|
- **Husky**: Git hooks management
|
|
@@ -273,6 +297,7 @@ git log --oneline -10
|
|
|
273
297
|
- **Jest**: Testing framework
|
|
274
298
|
|
|
275
299
|
### Security Tools
|
|
300
|
+
|
|
276
301
|
- **npm audit**: Vulnerability scanning
|
|
277
302
|
- **Custom scripts**: File exclusion verification
|
|
278
303
|
- **Git hooks**: Pre-commit security checks
|
|
@@ -301,7 +326,8 @@ git status --ignored
|
|
|
301
326
|
```
|
|
302
327
|
|
|
303
328
|
This maintenance approach ensures:
|
|
329
|
+
|
|
304
330
|
- 🔒 **Security**: No sensitive files ever published
|
|
305
331
|
- 📦 **Optimization**: Minimal package size
|
|
306
332
|
- 🔄 **Automation**: Critical checks run automatically
|
|
307
|
-
- 📋 **Consistency**: Standardized maintenance procedures
|
|
333
|
+
- 📋 **Consistency**: Standardized maintenance procedures
|
|
@@ -7,6 +7,7 @@ This guide helps you migrate from the previous single-site configuration to the
|
|
|
7
7
|
### 1. Configuration Method Changed
|
|
8
8
|
|
|
9
9
|
**Old Method (Environment Variables):**
|
|
10
|
+
|
|
10
11
|
```bash
|
|
11
12
|
WORDPRESS_SITE_URL=https://example.com
|
|
12
13
|
WORDPRESS_USERNAME=admin
|
|
@@ -15,6 +16,7 @@ WORDPRESS_APP_PASSWORD=xxxx xxxx xxxx xxxx xxxx xxxx
|
|
|
15
16
|
|
|
16
17
|
**New Method (Configuration File):**
|
|
17
18
|
Create a `mcp-wordpress.config.json` file:
|
|
19
|
+
|
|
18
20
|
```json
|
|
19
21
|
{
|
|
20
22
|
"sites": [
|
|
@@ -36,11 +38,13 @@ Create a `mcp-wordpress.config.json` file:
|
|
|
36
38
|
All tools now require a `site` parameter when multiple sites are configured.
|
|
37
39
|
|
|
38
40
|
**Old Usage:**
|
|
41
|
+
|
|
39
42
|
```
|
|
40
43
|
wp_list_posts
|
|
41
44
|
```
|
|
42
45
|
|
|
43
46
|
**New Usage:**
|
|
47
|
+
|
|
44
48
|
```
|
|
45
49
|
wp_list_posts --site="main"
|
|
46
50
|
```
|
|
@@ -50,6 +54,7 @@ Note: If only one site is configured, the `site` parameter is optional and that
|
|
|
50
54
|
### 3. Tool Architecture Refactored
|
|
51
55
|
|
|
52
56
|
Tools have been refactored from function-based to class-based architecture:
|
|
57
|
+
|
|
53
58
|
- All tools are now organized into classes (e.g., `PostTools`, `PageTools`)
|
|
54
59
|
- Tool registration is centralized through `src/tools/index.ts`
|
|
55
60
|
- Each tool category has its own class file in `src/tools/`
|
|
@@ -59,6 +64,7 @@ Tools have been refactored from function-based to class-based architecture:
|
|
|
59
64
|
### Step 1: Backup Your Configuration
|
|
60
65
|
|
|
61
66
|
Save your current environment variables:
|
|
67
|
+
|
|
62
68
|
```bash
|
|
63
69
|
cp .env .env.backup
|
|
64
70
|
```
|
|
@@ -104,6 +110,7 @@ wp_create_post --title="Hello" --content="World"
|
|
|
104
110
|
### Step 4: Test Your Configuration
|
|
105
111
|
|
|
106
112
|
Run the health check to verify your configuration:
|
|
113
|
+
|
|
107
114
|
```bash
|
|
108
115
|
npm run health
|
|
109
116
|
```
|
|
@@ -111,6 +118,7 @@ npm run health
|
|
|
111
118
|
### Step 5: Remove Old Configuration (Optional)
|
|
112
119
|
|
|
113
120
|
Once verified, you can remove the old `.env` file:
|
|
121
|
+
|
|
114
122
|
```bash
|
|
115
123
|
rm .env
|
|
116
124
|
```
|
|
@@ -145,6 +153,7 @@ The main benefit of the new configuration is support for multiple WordPress site
|
|
|
145
153
|
```
|
|
146
154
|
|
|
147
155
|
Then use tools with specific sites:
|
|
156
|
+
|
|
148
157
|
```bash
|
|
149
158
|
wp_list_posts --site="site1"
|
|
150
159
|
wp_create_post --site="site2" --title="New Blog Post"
|
|
@@ -157,16 +166,19 @@ The server maintains backward compatibility with environment variables. If no `m
|
|
|
157
166
|
## Troubleshooting
|
|
158
167
|
|
|
159
168
|
### Issue: "Site parameter is required"
|
|
169
|
+
|
|
160
170
|
**Solution:** When multiple sites are configured, you must specify which site to use with the `--site` parameter.
|
|
161
171
|
|
|
162
172
|
### Issue: "Site 'xyz' not found"
|
|
173
|
+
|
|
163
174
|
**Solution:** Check that the site ID in your command matches an ID in your configuration file.
|
|
164
175
|
|
|
165
176
|
### Issue: Tools not working after migration
|
|
177
|
+
|
|
166
178
|
**Solution:** Run `npm run health` to diagnose configuration issues.
|
|
167
179
|
|
|
168
180
|
## Need Help?
|
|
169
181
|
|
|
170
182
|
- Check the [CLAUDE.md](./CLAUDE.md) file for detailed documentation
|
|
171
183
|
- Run `npm run health` for system diagnostics
|
|
172
|
-
- Open an issue on GitHub if you encounter problems
|
|
184
|
+
- Open an issue on GitHub if you encounter problems
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
The project includes a pre-configured `.npmrc` file that uses environment variables:
|
|
6
6
|
|
|
7
7
|
1. **Set your NPM token as environment variable:**
|
|
8
|
+
|
|
8
9
|
```bash
|
|
9
10
|
export NPM_TOKEN="npm_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
|
10
11
|
```
|
|
11
12
|
|
|
12
13
|
2. **Or add to your shell profile:**
|
|
14
|
+
|
|
13
15
|
```bash
|
|
14
16
|
# Add to ~/.bashrc, ~/.zshrc, or ~/.profile
|
|
15
17
|
echo 'export NPM_TOKEN="npm_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"' >> ~/.zshrc
|
|
@@ -17,11 +19,13 @@ The project includes a pre-configured `.npmrc` file that uses environment variab
|
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
3. **Verify authentication:**
|
|
22
|
+
|
|
20
23
|
```bash
|
|
21
24
|
npm whoami
|
|
22
25
|
```
|
|
23
26
|
|
|
24
27
|
4. **Publish:**
|
|
28
|
+
|
|
25
29
|
```bash
|
|
26
30
|
npm publish
|
|
27
31
|
```
|
|
@@ -37,13 +41,15 @@ The project includes a pre-configured `.npmrc` file that uses environment variab
|
|
|
37
41
|
- Copy the generated token
|
|
38
42
|
|
|
39
43
|
2. **Store the token locally**:
|
|
40
|
-
|
|
44
|
+
|
|
41
45
|
Create or edit `~/.npmrc`:
|
|
46
|
+
|
|
42
47
|
```bash
|
|
43
48
|
echo "//registry.npmjs.org/:_authToken=YOUR_NPM_TOKEN" >> ~/.npmrc
|
|
44
49
|
```
|
|
45
50
|
|
|
46
51
|
Or set it for this project only in `.npmrc` (in project root):
|
|
52
|
+
|
|
47
53
|
```bash
|
|
48
54
|
# Copy the example file
|
|
49
55
|
cp .npmrc.example .npmrc
|
|
@@ -53,6 +59,7 @@ The project includes a pre-configured `.npmrc` file that uses environment variab
|
|
|
53
59
|
```
|
|
54
60
|
|
|
55
61
|
3. **Using environment variable** (more secure):
|
|
62
|
+
|
|
56
63
|
```bash
|
|
57
64
|
# Add to ~/.bashrc or ~/.zshrc
|
|
58
65
|
export NPM_TOKEN="npm_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
|
@@ -95,11 +102,13 @@ npm config set //registry.npmjs.org/:_authToken YOUR_NPM_TOKEN
|
|
|
95
102
|
## Publishing with Token
|
|
96
103
|
|
|
97
104
|
Once authenticated, publish with:
|
|
105
|
+
|
|
98
106
|
```bash
|
|
99
107
|
npm publish
|
|
100
108
|
```
|
|
101
109
|
|
|
102
110
|
Or with explicit registry:
|
|
111
|
+
|
|
103
112
|
```bash
|
|
104
113
|
npm publish --registry https://registry.npmjs.org/
|
|
105
114
|
```
|
|
@@ -107,6 +116,7 @@ npm publish --registry https://registry.npmjs.org/
|
|
|
107
116
|
## Verifying Authentication
|
|
108
117
|
|
|
109
118
|
Check if you're logged in:
|
|
119
|
+
|
|
110
120
|
```bash
|
|
111
121
|
npm whoami
|
|
112
122
|
```
|
|
@@ -137,6 +147,7 @@ Your `NPM_TOKEN` is already stored in GitHub secrets. For automated publishing v
|
|
|
137
147
|
## Revoking Tokens
|
|
138
148
|
|
|
139
149
|
If a token is compromised:
|
|
150
|
+
|
|
140
151
|
1. Go to npmjs.com → Account Settings → Access Tokens
|
|
141
152
|
2. Find the token and click "Revoke"
|
|
142
|
-
3. Generate a new token and update your configurations
|
|
153
|
+
3. Generate a new token and update your configurations
|