JUHE API Marketplace
jimthompson5802 avatar
MCP Server

MCP Sentiment Analysis Server

This server implements the Model Context Protocol to provide sentiment analysis of text, returning polarity, subjectivity, and overall assessment (positive, negative, or neutral).

0
GitHub Stars
8/18/2025
Last Updated
No Configuration
Please check the documentation below.

README Documentation

Model Context Protocol (MCP) Test Lab

This project demonstrates the use of Model Context Protocol (MCP) and how it works with langgraph to build an agent. There are two parts to this project.

The first demonstrates the use of MCP for sentiment analysis and is based on the Hugging Face MCP Course. Instead of using the gradio library in the HuggingFace course, this project utilizes the fastmcp library to implement an MCP server and client.

The second part implements an MCP agent that connects to various tools, including mathematical operations and sentiment analysis capabilities, allowing for a more complex AI assistant. This part makes use of the langgraph library to create an agent that can interact with these tools.

Overview

This project demonstrates different implementations of the Model Context Protocol (MCP) with a focus on sentiment analysis and agent capabilities:

  • mcp-sentiment/: Contains the MCP server implementation (app_fastmcp.py) and various client implementations using different transport protocols (stdio, SSE, and streamable-http) for sentiment analysis. See mcp-sentiment/README.md for more details.

  • mcp-agent/: Implements agent functionality with specialized tools for mathematical operations and sentiment analysis, along with a client to interact with these agent capabilities. See mcp-agent/README.md for more details.

  • tests/: Comprehensive test suite validating all components of the system, including client implementations across different transport protocols, agent functionality, math tools, and sentiment analysis capabilities.

Codebase Directory Structure

mcp_testlab/
├── mcp-sentiment/
│   ├── app_fastmcp.py
│   ├── mcp_client_multi-transport.py
│   ├── mcp_client_stdio.py
│   ├── mcp_client_sse.py
│   └── mcp_client_streamable.py
├── mcp-agent/
│   ├── agent_client.py
│   ├── math_tools.py
│   └── sentiment_tools.py
├── tests/
│   ├── test_00multi_transport.py
│   ├── test_agent_client.py
│   ├── test_client_stdio.py
│   ├── test_client_sse.py
│   ├── test_client_streamable.py
│   ├── test_math_tools.py
│   └── test_sentiment_analysis.py
├── requirements.txt
├── README.md
├── LICENSE
├── .gitignore
└── .gitattributes

Setup Instructions

To set up the project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/jimthompson5802/mcp_testlab.git
    cd mcp_testlab
    
  2. Create a virtual environment:

    python -m venv venv
    
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    
  3. Install system dependencies (if needed):

    • For macOS, you may need to install Graphviz:

      brew install graphviz
      
    • For Linux, you can install Graphviz using your package manager, e.g.:

      sudo apt-get install graphviz
      
    • setup environment variables for CFLAGS and LDFLAGS:

    # For macOS with Homebrew
    export CFLAGS="-I/opt/homebrew/include"
    export LDFLAGS="-L/opt/homebrew/lib"
    
  4. Install the required packages:

    pip install -r requirements.txt
    

Unit Tests

Unit tests are provided to ensure the functionality of the MCP server and client. To run the tests, use the following command:

$ pytest -v --cov tests

Sample output:

Quick Actions

Key Features

Model Context Protocol
Secure Communication
Real-time Updates
Open Source