test-mcp-content.jsā¢2.02 kB
#!/usr/bin/env node
/**
* Test script to verify MCP server tools are working with OAuth
*/
import { discoverTools } from './lib/tools.js';
async function testMCPTools() {
console.log('š Testing MCP Server Tools with OAuth...');
console.log('ā'.repeat(60));
try {
// Discover all available tools
console.log('š Step 1: Discovering available tools...');
const tools = await discoverTools();
console.log(`ā
Found ${tools.length} tools`);
// Find the get-content tool
const getContentTool = tools.find(tool =>
tool.definition.function.name === 'script_projects_get_content'
);
if (!getContentTool) {
console.error('ā script_projects_get_content tool not found!');
console.log('Available tools:');
tools.forEach(tool => {
console.log(` - ${tool.definition.function.name}`);
});
return;
}
console.log('ā
Found script_projects_get_content tool');
// Test the tool with your script ID
console.log('š Step 2: Testing script content fetch...');
const scriptId = '1fSY7y3Rh84FsgJmrFIMm4AUOV3mPgelLRvZ4Dahrv68zyDzX-cGbeYjn';
console.log(`š Fetching content for script: ${scriptId}`);
const result = await getContentTool.function({ scriptId });
if (result.error) {
console.error('ā Error fetching content:', result.error);
} else {
console.log('ā
Successfully fetched script content!');
console.log('š Content summary:');
console.log(` - Script ID: ${result.scriptId}`);
console.log(` - Number of files: ${result.files?.length || 0}`);
if (result.files) {
result.files.forEach((file, index) => {
console.log(` - File ${index + 1}: ${file.name} (${file.type})`);
});
}
console.log('\nš Full content:');
console.log(JSON.stringify(result, null, 2));
}
} catch (error) {
console.error('š„ Test failed:', error);
}
}
testMCPTools();