/**
* Test MCP endpoint directly
*/
import axios from 'axios';
const MCP_URL = 'https://api.postiz.com/mcp/0a89feebe1e21582362064558e460b8c0e35eb0133bbf21c2409571bd80eb463';
async function testMCPEndpoint() {
console.log('š Testing MCP endpoint directly...\n');
console.log(`URL: ${MCP_URL}\n`);
const tests = [
{
name: 'GET request (no auth)',
method: 'GET',
headers: {},
},
{
name: 'GET with token as path',
method: 'GET',
headers: {},
url: MCP_URL + '/posts',
},
{
name: 'POST request (MCP protocol)',
method: 'POST',
headers: { 'Content-Type': 'application/json' },
data: {
jsonrpc: '2.0',
method: 'tools/list',
id: 1,
},
},
];
for (const test of tests) {
console.log(`\nš ${test.name}`);
console.log(` Method: ${test.method}`);
try {
const response = await axios({
method: test.method,
url: test.url || MCP_URL,
headers: test.headers,
data: test.data,
timeout: 10000,
});
console.log(` ā
Success (${response.status})`);
console.log(` Response:`, JSON.stringify(response.data, null, 2).substring(0, 500));
} catch (error) {
if (error.response) {
console.log(` ā ${error.response.status} - ${error.response.statusText}`);
console.log(` Error:`, JSON.stringify(error.response.data, null, 2).substring(0, 200));
} else {
console.log(` ā ${error.message}`);
}
}
}
console.log('\n\nš Analysis:');
console.log('If you see 404/401 errors, this MCP URL is not a REST API endpoint.');
console.log('You need to find the actual REST API token from Postiz settings.');
console.log('\nLook for:');
console.log(' - Settings ā API Keys');
console.log(' - Settings ā Integrations');
console.log(' - Settings ā Developers');
}
testMCPEndpoint();