Skip to main content
Glama

Google Sheets MCP Server

by stephenyu
GPL 3.0
test-credentials.js•2.7 kB
#!/usr/bin/env node import { readFile } from 'fs/promises'; import { resolve } from 'path'; /** * Test script to verify credentials JSON file loading * This simulates the same logic used in server/index.js */ async function testCredentialsLoading(credentialsFilePath) { try { console.log('Testing credentials loading...'); // Resolve the file path (handle relative paths) const resolvedPath = resolve(credentialsFilePath); console.log(`Resolved path: ${resolvedPath}`); // Read and parse the credentials file const credentialsData = await readFile(resolvedPath, 'utf8'); const credentials = JSON.parse(credentialsData); // Extract required fields const serviceAccountEmail = credentials.client_email; const privateKey = credentials.private_key; const projectId = credentials.project_id; // Validate required fields if (!serviceAccountEmail || !privateKey || !projectId) { throw new Error('Invalid credentials JSON file. Missing required fields: client_email, private_key, or project_id'); } console.log('āœ… Credentials loaded successfully!'); console.log('šŸ“§ Service Account Email: [REDACTED]'); console.log('šŸ”‘ Private Key: [REDACTED]'); console.log(`šŸ—ļø Project ID: ${projectId}`); // Test private key format if (!privateKey.includes('-----BEGIN PRIVATE KEY-----')) { console.warn('āš ļø Warning: Private key may not be in the correct format'); } else { console.log('āœ… Private key format looks correct'); } return { success: true, serviceAccountEmail, privateKey, projectId }; } catch (error) { console.error('āŒ Error loading credentials:', error.message); return { success: false, error: error.message }; } } // Main execution async function main() { const args = process.argv.slice(2); if (args.length === 0) { console.log('Usage: node test-credentials.js <path-to-credentials.json>'); console.log(''); console.log('Example:'); console.log(' node test-credentials.js ./credentials.json'); console.log(' node test-credentials.js /path/to/service-account-key.json'); process.exit(1); } const credentialsPath = args[0]; const result = await testCredentialsLoading(credentialsPath); if (result.success) { console.log('\nšŸŽ‰ Credentials test passed! Your JSON file is ready to use.'); process.exit(0); } else { console.log('\nšŸ’„ Credentials test failed. Please check your JSON file.'); process.exit(1); } } main().catch(error => { console.error('Unexpected error:', error); process.exit(1); });

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/stephenyu/mcp-googlesheet'

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