home / mcp / sentiment mcp server

Sentiment MCP Server

Code for huggingface mcp course: https://huggingface.co/learn/mcp-course

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "aiden-jeon-huggingface-mcp-course": {
      "url": "http://localhost:7860/gradio_api/mcp/sse"
    }
  }
}

You can interact with the sentiment analysis MCP server to analyze text sentiment in real time. It exposes a remote sentiment analysis tool that runs locally and broadcasts results through a stable MCP channel, enabling you to plug it into your client workflows and dashboards with minimal setup.

How to use

To use the sentiment analysis MCP server, configure your MCP client to connect to the HTTP endpoint and then invoke the sentiment tool with the text you want to analyze. The server provides a sentiment analysis capability that reports polarity, subjectivity, and a categorical assessment (positive, negative, or neutral). Access the tool via the MCP channel and run analyses as part of your text processing pipelines, chatbots, or data processing jobs.

How to install

Prerequisites: you need Node.js and npm installed on your machine.

1. Ensure the sentiment analysis server is available locally at the specified URL (the MCP channel uses a local HTTP endpoint). If you are starting from scratch, make sure you have the necessary dependencies installed for the MCP client you intend to use.

2. Start the MCP client or server that hosts the sentiment tool using the command appropriate for your environment. The following configuration snippet shows how the MCP server is wired to connect to the remote endpoint.

{
  "mcpServers": {
    "sentiment-analysis": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:7860/gradio_api/mcp/sse",
        "--transport",
        "sse-only"
      ]
    }
  }
}

Additional steps

After starting the MCP client, you can verify that the sentiment tool is available at the configured MCP channel and accessible through the web interface. For example, you may see a web UI running locally that allows you to input text and view the sentiment analysis results in real time.

Note that the tool analyzes input text and returns three metrics: Polarity (from -1.0 to 1.0), Subjectivity (from 0.0 to 1.0), and an Assessment label (positive, negative, or neutral). The example sentence "Hello World!" is typically considered neutral with Polarity 0.0 and Subjectivity 0.0.

Usage notes and access

The sentiment analysis tool is exposed via a web interface at a local address (for example, http://127.0.0.1:7861) and is intended for interactive use or integration into larger text-processing workflows. Ensure your firewall and network settings allow access to the MCP endpoint and any associated UI components.

Available tools

sentiment_analysis

Analyzes text sentiment using an MCP-enabled tool. Returns Polarity (-1 to 1), Subjectivity (0 to 1), and an Assessment label (positive, negative, neutral). Accessible via a remote MCP endpoint or a local web interface.