mcp-sentiment / README.md
SpringDai's picture
Create README.md
87f9bcf verified

A newer version of the Gradio SDK is available: 6.8.0

Upgrade
metadata
title: MCP Sentiment Analysis
emoji: 🎭
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.0.0
app_file: app.py
pinned: false

🎭 Text Sentiment Analysis with MCP

A powerful sentiment analysis tool built with Gradio and TextBlob, featuring Model Context Protocol (MCP) server integration for AI assistant interoperability.

πŸš€ Features

  • Real-time Sentiment Analysis: Analyze the emotional tone of any text instantly
  • Polarity Score: Measures sentiment from -1 (negative) to +1 (positive)
  • Subjectivity Score: Evaluates objectivity (0) vs subjectivity (1)
  • MCP Server Integration: Expose sentiment analysis as a tool for AI assistants
  • Clean Web Interface: User-friendly Gradio interface

πŸ“Š How It Works

The application uses TextBlob, a Python library for natural language processing that:

  1. Tokenizes and analyzes input text
  2. Applies sentiment lexicon algorithms
  3. Returns polarity, subjectivity, and overall assessment

Output Metrics

  • Polarity: Emotional tone ranging from -1.0 (very negative) to +1.0 (very positive)
  • Subjectivity: Opinion level from 0.0 (objective/factual) to 1.0 (subjective/opinionated)
  • Assessment: Simple classification (positive, negative, or neutral)

πŸ’‘ Example Usage

Input:

I absolutely love this product! It's amazing!

Output:

{
  "polarity": 0.75,
  "subjectivity": 0.95,
  "assessment": "positive"
}

πŸ”§ Technologies Used

  • Gradio: Web UI framework with MCP support
  • TextBlob: NLP library for sentiment analysis
  • Python 3.13: Core programming language

πŸ€– MCP Integration

This Space runs as an MCP server, allowing AI assistants (like Claude) to discover and use the sentiment_analysis function as a tool. This enables AI assistants to analyze sentiment in real-time during conversations.

πŸ› οΈ Local Development

# Clone the repository
git clone https://huggingface.co/spaces/SpringDai/mcp-sentiment

# Install dependencies
pip install -r requirements.txt

# Run the application
python app.py

πŸ“ License

Open source - feel free to use and modify!

πŸ‘€ Author

Created by SpringDai