Skip to main content
Glama

Social Media MCP Server

by tayler-id
test-mastodon-client-file.js1.95 kB
// Test script for Mastodon client with mock fallback import fs from 'fs/promises'; import mastodonClient from './build/src/platforms/mastodon/client.js'; // Define platform constants directly const MASTODON = 'mastodon'; // Function to write logs to a file async function writeLog(message) { await fs.appendFile('mastodon-test-log.txt', message + '\n'); } async function testMastodonClient() { await writeLog('Testing Mastodon client with mock fallback...'); try { // Create test content const content = { text: `Test toot from Social Media MCP Server - ${new Date().toISOString()}`, platform: MASTODON }; // Post to Mastodon await writeLog(`Posting to Mastodon... ${content.text}`); const postResult = await mastodonClient.postStatus(content); // Log result await writeLog(`Mastodon post result: ${JSON.stringify(postResult, null, 2)}`); // Get trending tags await writeLog('Getting trending tags from Mastodon...'); const trendingTags = await mastodonClient.getTrendingTags(5); // Log trending tags await writeLog(`Mastodon trending tags: ${JSON.stringify(trendingTags, null, 2)}`); // If post was successful, get engagement metrics if (postResult.success && postResult.postId) { await writeLog(`Getting engagement metrics for post: ${postResult.postId}`); const metrics = await mastodonClient.getEngagementMetrics(postResult.postId); // Log metrics await writeLog(`Mastodon engagement metrics: ${JSON.stringify(metrics, null, 2)}`); } await writeLog('Test completed successfully!'); } catch (error) { await writeLog(`Error testing Mastodon client: ${error.message}`); } } // Clear the log file first fs.writeFile('mastodon-test-log.txt', '').then(() => { // Run the test testMastodonClient().catch(async error => { await writeLog(`Unhandled error: ${error.message}`); }); });

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/tayler-id/social-media-mcp'

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