Skip to content

japhari/mcp-sentiment

Repository files navigation

title emoji colorFrom colorTo sdk sdk_version app_file pinned
Mcp Sentiment
📚
indigo
purple
gradio
5.31.0
app.py
false

MCP Sentiment Analysis

Screenshot

This project demonstrates an end-to-end Model Context Protocol (MCP) sentiment analysis tool using Gradio and TextBlob, deployable to Hugging Face Spaces.

Features

  • Sentiment analysis using TextBlob
  • Exposed as an MCP server (Gradio)
  • Python and JavaScript client examples
  • Ready for Hugging Face Spaces deployment

Quickstart

1. Setup

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

2. Run Locally

python app.py

3. Example Client Usage

Python

from smolagents import ToolCollection, CodeAgent
from mcp.client.sse import SSEServerParameters

server_params = SSEServerParameters(url="http://localhost:7860/gradio_api/mcp/sse")
with ToolCollection.from_mcp(server_params, trust_remote_code=True) as tools:
    agent = CodeAgent(tools=[*tools.tools])
    agent.run("What is the sentiment of 'I love working with MCP!'?")

JavaScript

const response = await mcpClient.call("sentiment_analysis", {
  text: "MCP is amazing!",
});
console.log(response);

Deployment

See mcp.md for full instructions, including Hugging Face Spaces deployment and advanced configuration.


Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages