Skip to main content
Glama

MCP Sentiment Analysis Server

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:

-
security - not tested
A
license - permissive license
-
quality - not tested

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

  1. Overview
    1. Codebase Directory Structure
      1. Setup Instructions
        1. Unit Tests

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            A Model Context Protocol server that provides tools for analyzing text documents, including counting words and characters. This server helps LLMs perform text analysis tasks by exposing simple document statistics functionality.
            Last updated -
            1
            616
            10
            JavaScript
            Apache 2.0
          • A
            security
            A
            license
            A
            quality
            This server implements the Model Context Protocol to facilitate meaningful interaction and understanding development between humans and AI through structured tools and progressive interaction patterns.
            Last updated -
            13
            51
            MIT License
          • -
            security
            A
            license
            -
            quality
            Provides advanced analytical, research, and natural language processing capabilities through a Model Context Protocol server, enabling dataset analysis, decision analysis, and enhanced NLP features like entity recognition and fact extraction.
            Last updated -
            2
            TypeScript
            MIT License
            • Linux
            • Apple
          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol server that enables users to query, retrieve details, and manage reviews/ratings for NetMind AI servers through simple endpoints.
            Last updated -
            Python
            MIT License

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/jimthompson5802/mcp_testlab'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server