Skip to main content
Glama
by mohalmah
test-mcp-tools.jsโ€ข1.91 kB
#!/usr/bin/env node /** * Test script to verify MCP tools work with automatic OAuth */ import 'dotenv/config'; import { getAuthHeaders } from './lib/oauth-helper.js'; // Test the script-projects-get tool async function testScriptProjectGet() { console.log('๐Ÿงช Testing script-projects-get tool...'); try { // Import the tool const { apiTool } = await import('./tools/google-app-script-api/apps-script-api/script-projects-get.js'); // Test with a sample script ID (this will likely fail but should show detailed error info) const testScriptId = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms'; // Sample ID console.log('๐Ÿ“‹ Testing with script ID:', testScriptId); console.log('๐Ÿ”„ Calling tool function...'); const result = await apiTool.function({ scriptId: testScriptId }); console.log('โœ… Tool result:', JSON.stringify(result, null, 2)); } catch (error) { console.error('โŒ Test error:', error); } } // Test OAuth headers directly async function testOAuthHeaders() { console.log('\n๐Ÿงช Testing OAuth headers directly...'); try { const headers = await getAuthHeaders(); console.log('โœ… OAuth headers obtained successfully'); console.log('๐Ÿ” Authorization header length:', headers.Authorization?.length || 0); return true; } catch (error) { console.error('โŒ OAuth error:', error); return false; } } // Main test function async function runTests() { console.log('๐Ÿš€ Starting MCP Tool Tests...'); console.log('====================================='); // Test OAuth headers first const oauthWorking = await testOAuthHeaders(); if (!oauthWorking) { console.log('โŒ OAuth not working, skipping tool test'); return; } // Test the actual tool await testScriptProjectGet(); console.log('\n๐ŸŽ‰ Tests completed!'); } runTests().catch(console.error);

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mohalmah/google-appscript-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server