Skip to content

feat(mcp): add Social Sentiment Trading MCP Server#350

Draft
FidelCoder wants to merge 4 commits intoEmberAGI:mainfrom
FidelCoder:feature/centrifuge-mcp-tool
Draft

feat(mcp): add Social Sentiment Trading MCP Server#350
FidelCoder wants to merge 4 commits intoEmberAGI:mainfrom
FidelCoder:feature/centrifuge-mcp-tool

Conversation

@FidelCoder
Copy link
Contributor

Summary

Related Issue(s): #349

This PR adds a new Social Sentiment Trading MCP Server that aggregates social sentiment from multiple platforms (Reddit, Twitter/X, Farcaster, Discord, Telegram) and provides real-time sentiment analysis, early signal detection, and social momentum scoring for DeFi tokens.

Type of Change:

  • 🔧 MCP server (new MCP integration)

🧪 Testing

Tests Performed:

  • Manual testing of all 4 MCP tools using MCP Inspector
  • Verified sentiment aggregation across Reddit, Twitter/X, and Farcaster
  • Tested caching mechanism and rate limit handling
  • Verified error handling for missing API keys
  • Tested with multiple tokens (ETH, BTC, ARB, UNI)

Test Results:

  • All tools return structured JSON responses
  • Sentiment analysis works across all configured platforms
  • Early signal detection correctly identifies volume spikes
  • Momentum scoring calculates accurate scores
  • Token listing returns all supported tokens

Steps to Run Tests:

  1. Set up environment variables in .env (see README.md)
  2. Build: pnpm build
  3. Start MCP server: pnpm start
  4. Use MCP Inspector to test tools:
    • analyze-social-sentiment: {"tokenSymbol": "ETH", "timeRange": {"hours": 24}}
    • social-momentum-score: {"tokenSymbol": "ETH"}
    • detect-early-signals: {"tokenSymbol": "ARB", "lookbackHours": 24}
    • list-supported-tokens: {}

Checklists

Code Quality

  • Code follows project conventions and style guidelines
  • TypeScript compilation passes (pnpm build)
  • Linting passes (pnpm lint)
  • No any types introduced
  • Error handling implemented appropriately
  • Security best practices followed (no exposed secrets/keys)

Documentation

  • Code is self-documenting or includes necessary comments
  • README updated if applicable
  • Configuration options documented

Agent/MCP Specific

  • MCP protocol compliance verified
  • Agent skills and tools properly defined
  • Error handling for external API failures
  • Rate limiting and retry logic implemented
  • Configuration options documented

Deployment Notes

New Dependencies Added:

  • discord.js (^14.25.1)
  • node-telegram-bot-api (^0.66.0)
  • node-fetch (^3.3.2)
  • lru-cache (^10.2.0)

New Environment Variables:

  • TWITTER_BEARER_TOKEN (optional)
  • NEYNAR_API_KEY (optional)
  • DISCORD_BOT_TOKEN (optional)
  • DISCORD_CHANNEL_IDS (optional)
  • TELEGRAM_BOT_TOKEN (optional)
  • TELEGRAM_CHAT_IDS (optional)
  • HUGGING_FACE_API_KEY (optional)
  • REDDIT_USER_AGENT (optional)

MCP Tools

  1. analyze-social-sentiment

    • Parameters: {"tokenSymbol": "ETH", "timeRange": {"hours": 24}}
    • Returns: Sentiment score, confidence, trend, sources breakdown, contextual analysis, DeFi categories
  2. social-momentum-score

    • Parameters: {"tokenSymbol": "ETH"}
    • Returns: Momentum score (0-100), breakdown by platform, velocity, volume, interpretation
  3. detect-early-signals

    • Parameters: {"tokenSymbol": "ARB", "lookbackHours": 24}
    • Returns: Signal type, strength, description, historical comparison, relevant posts
  4. list-supported-tokens

    • Parameters: {}
    • Returns: List of supported tokens with categories and metadata

- Add initial project structure for social sentiment analysis
- Implement Reddit API client using snoowrap
- Add TypeScript types for sentiment analysis
- Add caching utility for API response caching
- Configure free-tier API strategy (Reddit, Discord, Telegram, Hugging Face)
- Add comprehensive README and development guidance
- Exclude .contribution folder from git (local dev docs only)
- Add Reddit API client using public JSON endpoints (free tier)
- Implement sentiment analysis with Hugging Face fallback
- Add token mapping system for 15+ DeFi tokens
- Create analyze-social-sentiment tool with real post links
- Add detect-early-signals, social-momentum-score, and list-supported-tokens tools
- Implement multi-source aggregator (Reddit ready, Discord/Telegram placeholders)
- Add lenient filtering to capture real social media posts
- Include all posts with direct links in response
- Add comprehensive logging for debugging
…xtual analysis

- Add Twitter/X integration using API v2 with Bearer token
- Add Farcaster integration via Neynar API with improved search
- Add contextual explanations and actionable insights to sentiment scores
- Add DeFi-specific sentiment categories (perpetuals, arbitrage, flashloans, lending, staking)
- Enhance all tools with multi-platform support (Reddit, Twitter, Farcaster)
- Add environment variable loader for Node.js < 20.6 compatibility
- Improve error logging and debugging for API integrations
- Update momentum score to include Twitter and Farcaster breakdowns
- Add comprehensive API keys setup guide in .contribution folder
- Add multi-platform sentiment aggregation (Reddit, Twitter/X, Farcaster, Discord, Telegram)
- Implement 4 MCP tools: analyze-social-sentiment, social-momentum-score, detect-early-signals, list-supported-tokens
- Add contextual AI-generated explanations and DeFi-specific sentiment categories
- Support for 14+ major DeFi tokens with optimized search configurations
- Implement caching to respect API rate limits
- Add Discord.js and Telegram bot integrations
- Include comprehensive README with setup instructions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant