Skip to main content
Glama

X MCP Server

by tomaitagaki
check-auth.tsโ€ข2.6 kB
#!/usr/bin/env node import { existsSync } from 'fs'; import { join } from 'path'; import { XDatabase } from './database.js'; import { TokenStorage } from './storage.js'; import { encryption } from './encryption.js'; async function checkAuthStatus() { console.log('๐Ÿ” Checking for authenticated users...\n'); // Check legacy token storage (JSON file) console.log('๐Ÿ“ Checking legacy token storage...'); const tokenStorage = new TokenStorage(); const legacyTokens = await tokenStorage.loadTokens(); if (legacyTokens) { console.log('โœ… Found legacy tokens:'); console.log(` Token path: ${tokenStorage.getTokenPath()}`); console.log(` Scopes: ${legacyTokens.scope}`); console.log(` Expires at: ${new Date(legacyTokens.expires_at).toISOString()}`); console.log(` Status: ${Date.now() < legacyTokens.expires_at ? 'โœ… Valid' : 'โŒ Expired'}\n`); } else { console.log('โŒ No legacy tokens found\n'); } // Check multi-user database console.log('๐Ÿ“ Checking multi-user database...'); const dbPath = join(process.env.HOME || process.cwd(), '.mcp', 'x', 'tokens.db'); if (existsSync(dbPath)) { const db = new XDatabase(dbPath); // Get all users const users = db.getAllUsers(); console.log(` Found ${users.length} user(s) in database\n`); if (users.length > 0) { for (const user of users) { console.log(`๐Ÿ‘ค User: @${user.x_username} (${user.display_name})`); console.log(` X User ID: ${user.x_user_id}`); console.log(` Created: ${new Date(user.created_at).toISOString()}`); const tokens = db.getUserTokens(user.id); if (tokens) { const isExpired = Date.now() >= tokens.expires_at; console.log(` โœ… Has tokens`); console.log(` Scopes: ${tokens.granted_scopes}`); console.log(` Expires at: ${new Date(tokens.expires_at).toISOString()}`); console.log(` Status: ${isExpired ? 'โŒ Expired' : 'โœ… Valid'}`); console.log(` Updated: ${new Date(tokens.updated_at).toISOString()}`); } else { console.log(` โŒ No tokens found`); } console.log(''); } } else { console.log('โŒ No users found in database\n'); } db.close(); } else { console.log(`โŒ Database not found at: ${dbPath}\n`); } console.log('โœ… Check complete!'); } if (import.meta.url === `file://${process.argv[1]}`) { checkAuthStatus().catch(error => { console.error('โŒ Error checking auth status:', 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/tomaitagaki/x-mcp'

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