This repository was archived by the owner on Apr 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.js
More file actions
76 lines (64 loc) · 2 KB
/
setup.js
File metadata and controls
76 lines (64 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env node
/**
* Setup script for the MCP WordPress Proxy
*
* This script helps users configure the MCP proxy by creating a configuration file
* with the necessary environment variables.
*/
const fs = require('fs');
const path = require('path');
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
console.log('MCP WordPress Proxy Setup');
console.log('=========================');
console.log('This script will help you configure the MCP proxy for your WordPress site.');
console.log('');
// Function to prompt for input
function prompt(question) {
return new Promise(resolve => {
rl.question(question, answer => {
resolve(answer);
});
});
}
async function setup() {
try {
// Get WordPress site URL
const wpUrl = await prompt('Enter your WordPress site URL (e.g., https://example.com): ');
// Get WordPress username
const username = await prompt('Enter your WordPress username: ');
// Get WordPress application password
const password = await prompt('Enter your WordPress application password: ');
// Create configuration object
const config = {
mcpServers: {
'mcp-wordpress-remote': {
command: 'npx',
args: ['mcp-wordpress-remote'],
env: {
WP_API_USERNAME: username,
WP_API_PASSWORD: password,
WP_API_URL: wpUrl,
},
},
},
};
// Write configuration to file
const configPath = path.join(__dirname, 'mcp-config.json');
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
console.log('');
console.log('Configuration saved to mcp-config.json');
console.log('');
console.log('Next steps:');
console.log('1. Configure your MCP client to use this configuration file');
console.log('2. Restart your MCP client');
} catch (error) {
console.error('Error setting up configuration:', error);
} finally {
rl.close();
}
}
setup();