Text Classification MCP Server (Model2Vec)
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Text Classification MCP Server (Model2Vec) classify this article about electric vehicles and AI advancements"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Text Classification MCP Server (Model2Vec)
A powerful Model Context Protocol (MCP) server that provides comprehensive text classification tools using fast static embeddings from Model2Vec (Minish Lab).
π οΈ Complete MCP Tools & Resources
This server provides 6 essential tools, 2 resources, and 1 prompt template for text classification:
π·οΈ Classification Tools
classify_text- Classify single text with confidence scoresbatch_classify- Classify multiple texts simultaneously
π Category Management Tools
add_custom_category- Add individual custom categoriesbatch_add_custom_categories- Add multiple categories at oncelist_categories- View all available categoriesremove_categories- Remove unwanted categories
π Resources
categories://list- Access category list programmaticallymodel://info- Get model and system information
π¬ Prompt Templates
classification_prompt- Ready-to-use classification prompt template
Related MCP server: Laya Agent Kit
π Key Features
Zero-install: Just
uv runβ dependencies are declared inline (PEP 723)Multiple Transports: Supports stdio (local), HTTP/SSE, and Streamable HTTP
Fast Classification: Uses efficient static embeddings from Model2Vec
10 Default Categories: Technology, business, health, sports, entertainment, politics, science, education, travel, food
Custom Categories: Add your own categories with descriptions
Batch Processing: Classify multiple texts at once
Resource Endpoints: Access category lists and model information
Prompt Templates: Built-in prompts for classification tasks
π Installation
Prerequisites
Python 3.10+
uvpackage manager
Quick Setup
No separate install step needed β dependencies are declared inline in the script (PEP 723) and resolved automatically by uv.
πββοΈ Running the Server
Stdio Transport (Default)
uv run text_classifier_server.pyHTTP/SSE Transport
# SSE on default port 8000
uv run text_classifier_server.py --http
# SSE on custom port
uv run text_classifier_server.py --http 9000Streamable HTTP Transport
uv run text_classifier_server.py --streamable-httpπ§ Configuration
For Claude Desktop
Stdio Transport (Local)
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"text-classifier": {
"command": "uv",
"args": ["run", "/path/to/text_classifier_server.py"]
}
}
}HTTP Transport (Remote)
Start the server with uv run text_classifier_server.py --http, then add:
{
"mcpServers": {
"text-classifier": {
"url": "http://localhost:8000/sse"
}
}
}For Claude Code
claude mcp add text-classifier -- uv run /Users/olivier/DEV/mcp-text-classifier/text_classifier_server.pyπ οΈ Available Tools
classify_text
Classify a single text into predefined categories with confidence scores.
Parameters:
text(string): The text to classifytop_k(int, optional): Number of top categories to return (default: 3)
Returns: JSON with predictions, confidence scores, and category descriptions
Example:
classify_text("Apple announced new AI features", top_k=3)batch_classify
Classify multiple texts simultaneously for efficient processing.
Parameters:
texts(list): List of texts to classifytop_k(int, optional): Number of top categories per text (default: 1)
Returns: JSON with batch classification results
Example:
batch_classify(["Tech news", "Sports update", "Business report"], top_k=2)add_custom_category
Add a new custom category for classification.
Parameters:
category_name(string): Name of the new categorydescription(string): Description to generate the category embedding
Returns: JSON with operation result
Example:
add_custom_category("automotive", "Cars, vehicles, transportation, automotive industry")batch_add_custom_categories
Add multiple custom categories in a single operation for efficiency.
Parameters:
categories_data(list): List of dictionaries with 'name' and 'description' keys
Returns: JSON with batch operation results
Example:
batch_add_custom_categories([
{"name": "automotive", "description": "Cars, vehicles, transportation"},
{"name": "music", "description": "Music, songs, artists, albums, concerts"}
])list_categories
List all available categories and their descriptions.
Parameters: None
Returns: JSON with all categories and their descriptions
remove_categories
Remove one or multiple categories from the classification system.
Parameters:
category_names(list): List of category names to remove
Returns: JSON with removal results for each category
Example:
remove_categories(["automotive", "custom_category"])π Available Resources
categories://list: Get list of available categories with metadatamodel://info: Get information about the loaded Model2Vec model and system status
π¬ Available Prompts
classification_prompt: Template for text classification tasks with context and instructions
Parameters:
text(string): The text to classify
Returns: Formatted prompt for classification with available categories listed
π§ͺ Testing
Test with MCP Inspector
npx @modelcontextprotocol/inspector uv run text_classifier_server.pyπ Troubleshooting
Model download fails
# Manual model download
uv run python -c "from model2vec import StaticModel; StaticModel.from_pretrained('minishlab/potion-base-8M')"π Technical Details
Model:
minishlab/potion-base-8Mfrom Model2VecSimilarity: Cosine similarity between text and category embeddings
Performance: ~30MB model, fast inference with static embeddings
Protocol: MCP specification 2024-11-05
Transports: stdio, HTTP+SSE, Streamable HTTP
π€ Contributing
Fork the repository
Create a feature branch
Add tests for new functionality
Submit a pull request
π License
MIT License - see LICENSE file for details.
π Acknowledgments
Model2Vec by Minish Lab for fast static embeddings
Anthropic for the Model Context Protocol specification
FastMCP for the excellent Python MCP framework
Need help? Check the troubleshooting section or open an issue in the repository.
Available Tools
6 toolsadd_custom_categoryB
Add a new custom category for classification.
Inputs: description (required), category_name (required). Returns: result
batch_add_custom_categoriesB
Add multiple custom categories for classification in a single operation.
Inputs: categories_data (required). Returns: result
batch_classifyA
Classify multiple texts at once.
Inputs: texts (required), top_k. Returns: result
classify_textC
Classify text into predefined categories using static embeddings.
Inputs: text (required), top_k. Returns: result
list_categoriesA
List all available categories for classification.
Returns: JSON string with all categories and their descriptions
Inputs: no named parameters. Returns: result
remove_categoriesB
Remove one or multiple categories from the classification system.
Inputs: category_names (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 6 tools
Each tool has a distinct purpose: adding categories (single/batch), classifying text (single/batch), listing, and removing categories. No overlap or ambiguity.
All tools use snake_case and follow a consistent verb_noun pattern (e.g., add_custom_category, batch_classify, list_categories). No mixing of styles.
Six tools is well-scoped for a text classification server: category CRUD (add/batch add, list, remove) and classification (single/batch). Neither too few nor too many.
Covers core functionality: category management and classification. Missing an update category tool is a minor gap, but agents can work around it by removing and re-adding.
Maintenance
Related MCP Connectors
Score pages against 11,485 public taxonomy categories by embedding similarity. Free.
Train a text classifier from your labelled examples in a minute; label texts with probabilities.
Sentiment, toxicity, entity extraction, PII, translation, summary, QA, fraud scoring, safety audit.
Sort up to 1,000 texts into your own labels with a calibrated confidence per answer. No API key.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables PDF document processing including text, image, and table extraction, as well as intelligent classification and similarity analysis across multiple languages.51MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to perform typed decisions (choice, score, noul) over text, emails, tickets, or JSON documents, with automatic language routing and source ranking across 100+ languages via a single forward pass.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables LLM agents to make fast semantic decisions by choosing one of 2β16 options with probabilities, via tools for single and batch classification.MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to classify plain-language messages against runtime-defined intents, with margin-based doubt flags, beta yes/no checks, and per-intent probability scores, without training examples. It runs self-hosted and supports multilingual intent decisions in about 26 ms per message on a compiled GPU.1Apache 2.0