Skip to main content

mcp-nlp

MCP-NLP is a FastMCP application designed to provide NLP (Natural Language Processing) capabilities using the Model Context Protocol (MCP).

  • FastMCP Framework v2: A modern framework for fast, Pythonic way to build MCP servers.
  • Model Context Protocol (MCP): A protocol that allows for the management and control of LLM contexts.
  • NLP-modules
    • textdistance: A module for calculating text distance metrics

Prerequisites

Before you begin, ensure you have the following installed:

Installation

  1. Clone the repository:

    git clone https://github.com/tivaliy/mcp-nlp.git
    cd mcp-nlp
    
  2. Install dependencies (using uv):

    uv sync
    

Configuration

Authentication Modes

The MCP-NLP server supports two authentication modes:

  1. Unauthenticated Mode (default):

    • No API key required to access the server
    • Set environment variable API_KEY_ENABLED=False
  2. API Key Authentication:

    • Requires a valid API key in the request header
    • Set environment variable API_KEY_ENABLED=True and API_KEY=your-secret-key
    • By default, the header name is X-API-Key (can be customized with API_KEY_NAME)

Example .env file:

# Authentication configuration
API_KEY_ENABLED=True
API_KEY=not-a-secret
# API_KEY_NAME=X-API-Key  # Optional: customize header name

Available Tools

The MCP-NLP server currently provides the following MCP tools:

Text Distance Module

Calculate similarity/distance between text sequences using various algorithms:

  • #textdistance_measure:

    • Purpose: Measures text distance between two sequences of strings
    • Parameters:
      • source (required): The source text string
      • reference (required): The reference text string to compare against
      • algorithm (optional): The algorithm to use (default: levenshtein)
      • metric (optional): The metric to use (default: normalized_similarity)
    • Returns: A float value representing the calculated distance/similarity
  • #textdistance_list_metrics:

    • Purpose: Lists all supported metrics for text distance algorithms
    • Parameters: None
    • Returns: A list of available metrics: distance, similarity, normalized_distance, normalized_similarity, maximum
  • Supported Metrics:

    • distance: Raw distance score
    • similarity: Raw similarity score
    • normalized_distance: Distance normalized to a 0-1 scale
    • normalized_similarity: Similarity normalized to a 0-1 scale (default)
    • maximum: Maximum possible value for the algorithm
  • Default Algorithm: Levenshtein

Usage

Local Running

To run the application locally:

  1. Start the FastMCP application:

    mcp-nlp --transport streamable-http
    
  2. Access the MCP server endpoint at http://127.0.0.1:8000/mcp (in case of streamable-http transport)

Run MCP Server Using Docker

To run the MCP server in a Docker container:

  1. Build the Docker image:

    docker build -t mcp-nlp .
    
  2. Run the Docker container:

    docker run --rm -e TRANSPORT=streamable-http -p 8000:8000 mcp-nlp
    
  3. Access the MCP server endpoint at http://127.0.0.1:8000/mcp (in case of streamable-http transport)

Make sure to set the TRANSPORT environment variable to streamable-http or sse when running the Docker container.

VS Code Integration

To use the MCP-NLP server with VS Code:

  1. Make sure your MCP-NLP server is running

  2. Add the server configuration to your VS Code settings.json (using stdio transport):

    {
        "servers": {
            "mcp-nlp": {
                "type": "stdio",
                "command": "${workspaceFolder}/.venv/bin/mcp-nlp",
                "env": {
                     "API_KEY_ENABLED": "false"
                 }
             }
         }
     }
    
  3. Enable MCP in VS Code:

    "chat.mcp.enabled": true,
    "github.copilot.advanced": {
      "mcp.enabled": true
    }
    
  4. You can now use the MCP-NLP tools directly in VS Code through GitHub Copilot

MCP | Model Context Protocol | FastMCP | NLP

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for mcp-nlp 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-nlp 0.0.1
File Size Uploaded Provenance
mcp_nlp-0.0.1.tar.gz 54.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-nlp 0.0.1
File Interpreter ABI Platform
mcp_nlp-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 66.9 kB

Release files / mcp_nlp-0.0.1.tar.gz

Download URL mcp_nlp-0.0.1.tar.gz
Size 54.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2ea27cad071260d3cfa15bdb77d5dad95a99868dca953076de8c5db2f5d4feac
BLAKE2b-256 checksum
How to use checksums
786b223325f2db801307a5d5d9c44e1f2c220441b81df1bca0b2b2a8743b0856
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.4

Release files / mcp_nlp-0.0.1-py3-none-any.whl

Download URL mcp_nlp-0.0.1-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3c99fafc7a0b2fb4e9bcc243222a190de6ea6820248287342ae64726cd5fe10
BLAKE2b-256 checksum
How to use checksums
c58b71ffb3b594f68e042a53dbe364169d4a1e20013480a76dc3ffcbe56115bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.4

Security for mcp-nlp 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page