io.github.MusaddiqueHussainLabs/mhlabs_mcp_tools
平台与服务by musaddiquehussainlabs
提供文本预处理、NLP components 与文档分析能力的 MCP server,适合 AI 流程集成。
什么是 io.github.MusaddiqueHussainLabs/mhlabs_mcp_tools?
提供文本预处理、NLP components 与文档分析能力的 MCP server,适合 AI 流程集成。
README
mhlabs-mcp-tools
mcp-name: io.github.MusaddiqueHussainLabs/mhlabs_mcp_tools
🧠 mhlabs-mcp-tools
mhlabs-mcp-tools is a Modular MCP Tools Server built using FastMCP.
It provides an extendable AI tool ecosystem organized into functional categories (Text Preprocessing, NLP Components, Document Analysis, etc.) that can be dynamically loaded and served through MCP (Model Context Protocol) via STDIO transport.
This project is part of the MHLabs AI Agentic Ecosystem, designed to work with mhlabs-mcp-server, mhlabs-mcp-agents, and downstream A2A agent frameworks.
Features
- FastMCP Server: Pure FastMCP implementation supporting multiple transport protocols
- Factory Pattern: Reusable MCP tools factory for easy service management
- Domain-Based Organization: Services organized by business domains (HR, Tech Support, etc.)
- Authentication: Optional Azure AD authentication support
- Multiple Transports: STDIO, HTTP (Streamable), and SSE transport support
- VS Code Integration: Debug configurations and development settings
- Comprehensive Testing: Unit tests with pytest
- Flexible Configuration: Environment-based configuration management
Architecture
mhlabs_mcp_tools/
├── .gitignore
├── .vscode/
│ └── settings.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── docs/
│ └── index.md
├── examples/
│ ├── example_client.py
│ └── example_client_http.py
├── mkdocs.yml
├── pyproject.toml
├── requirements.txt
├── server.json
└── src/
├── __init__.py
├── main.py
└── mhlabs_mcp_tools/
├── __init__.py
├── core/
│ ├── __init__.py
│ ├── config.py
│ ├── constants.py
│ ├── factory.py
│ └── prompts.py
├── data/
│ ├── __init__.py
│ ├── external/
│ │ └── __init__.py
│ ├── interim/
│ │ └── __init__.py
│ ├── processed/
│ │ └── __init__.py
│ └── raw/
│ ├── __init__.py
│ ├── contractions_dict.json
│ ├── custom_substitutions.csv
│ ├── leftovers_dict.json
│ └── slang_dict.json
├── handlers/
│ ├── __init__.py
│ ├── custom_exceptions.py
│ └── output_generator.py
├── mcp_server.py
├── models/
│ └── __init__.py
├── nlp_components/
│ ├── __init__.py
│ └── nlp_model.py
├── services/
│ ├── __init__.py
│ ├── langchain_framework.py
│ └── spacy_extractor.py
└── text_preprocessing/
├── __init__.py
├── contractions.py
├── emo_unicode.py
├── slang_text.py
└── text_preprocessing.py
Available Services
Currently the package is organized into three primary modules:
1. NLP Components
| Component Type | Description |
|---|---|
| tokenize | Text tokenization |
| pos | Part-of-Speech tagging |
| lemma | Word lemmatization |
| morphology | Study of word forms |
| dep | Dependency parsing |
| ner | Named Entity Recognition |
| norm | Text normalization |
2. Text Preprocessing
This module equips users with an extensive set of text preprocessing tools:
| Function | Description |
|---|---|
| to_lower | Convert text to lowercase |
| to_upper | Convert text to uppercase |
| remove_number | Remove numerical characters |
| remove_itemized_bullet_and_numbering | Eliminate itemized/bullet-point numbering |
| remove_url | Remove URLs from text |
| remove_punctuation | Remove punctuation marks |
| remove_special_character | Remove special characters |
| keep_alpha_numeric | Keep only alphanumeric characters |
| remove_whitespace | Remove excess whitespace |
| normalize_unicode | Normalize Unicode characters |
| remove_stopword | Eliminate common stopwords |
| remove_freqwords | Remove frequently occurring words |
| remove_rarewords | Remove rare words |
| remove_email | Remove email addresses |
| remove_phone_number | Remove phone numbers |
| remove_ssn | Remove Social Security Numbers (SSN) |
| remove_credit_card_number | Remove credit card numbers |
| remove_emoji | Remove emojis |
| remove_emoticons | Remove emoticons |
| convert_emoticons_to_words | Convert emoticons to words |
| convert_emojis_to_words | Convert emojis to words |
| remove_html | Remove HTML tags |
| chat_words_conversion | Convert chat language to standard English |
| expand_contraction | Expand contractions (e.g., "can't" to "cannot") |
| tokenize_word | Tokenize words |
| tokenize_sentence | Tokenize sentences |
| stem_word | Stem words |
| lemmatize_word | Lemmatize words |
| preprocess_text | Combine multiple preprocessing steps into one function |
Quick Start
Development Setup
-
Clone and Navigate:
bashcd src/mhlabs_mcp_tools -
Install Dependencies:
bashpip install -r requirements.txt -
Configure Environment:
bashcp .env.example .env # Edit .env with your configuration -
Start the Server:
bash# Default STDIO transport (for local MCP clients) python mcp_server.py # HTTP transport (for web-based clients) python mcp_server.py --transport http --port 9000 or after installed mhlabs-mcp-tools python -m mhlabs_mcp_tools.mcp_server --transport http --port 9000 # Using FastMCP CLI (recommended) fastmcp run mcp_server.py -t streamable-http --port 9000 -l DEBUG # Debug mode with authentication disabled python mcp_server.py --transport http --debug --no-auth
Transport Options
1. STDIO Transport (default)
- 🔧 Perfect for: Local tools, command-line integrations, Claude Desktop
- 🚀 Usage:
python mcp_server.pyorpython mcp_server.py --transport stdio
2. HTTP (Streamable) Transport
- 🌐 Perfect for: Web-based deployments, microservices, remote access
- 🚀 Usage:
python mcp_server.py --transport http --port 9000 - 🌐 URL:
http://127.0.0.1:9000/mcp/
3. SSE Transport (deprecated)
- ⚠️ Legacy support only - use HTTP transport for new projects
- 🚀 Usage:
python mcp_server.py --transport sse --port 9000
FastMCP CLI Usage
# Standard HTTP server
fastmcp run mcp_server.py -t streamable-http --port 9000 -l DEBUG
# With custom host
fastmcp run mcp_server.py -t streamable-http --host 0.0.0.0 --port 9000 -l DEBUG
# STDIO transport (for local clients)
fastmcp run mcp_server.py -t stdio
# Development mode with MCP Inspector
fastmcp dev mcp_server.py -t streamable-http --port 9000
VS Code Development
-
Open in VS Code:
bashcode . -
Use Debug Configurations:
Debug MCP Server (STDIO): Run with STDIO transportDebug MCP Server (HTTP): Run with HTTP transportDebug Tests: Run the test suite
Configuration
Environment Variables
Create a .env file based on .env.example:
# Server Settings
MCP_HOST=0.0.0.0
MCP_PORT=9000
MCP_DEBUG=false
MCP_SERVER_NAME=MHLABS MCP Server
# Authentication Settings
MCP_ENABLE_AUTH=true
AZURE_TENANT_ID=your-tenant-id-here
AZURE_CLIENT_ID=your-client-id-here
AZURE_JWKS_URI=https://login.microsoftonline.com/your-tenant-id/discovery/v2.0/keys
AZURE_ISSUER=https://sts.windows.net/your-tenant-id/
AZURE_AUDIENCE=api://your-client-id
Authentication
When MCP_ENABLE_AUTH=true, the server expects Azure AD Bearer tokens. Configure your Azure App Registration with the appropriate settings.
For development, set MCP_ENABLE_AUTH=false to disable authentication.
Adding New Services
-
Create Service Class:
pythonfrom core.factory import MCPToolBase, Domain class MyService(MCPToolBase): def __init__(self): super().__init__(Domain.MY_DOMAIN) def register_tools(self, mcp): @mcp.tool(tags={self.domain.value}) async def my_tool(param: str) -> str: # Tool implementation pass @property def tool_count(self) -> int: return 1 # Number of tools -
Register in Server:
python# In mcp_server.py (gets registered automatically from services/ directory) factory.register_service(MyService()) -
Add Domain (if new):
python# In core/factory.py class Domain(Enum): # ... existing domains MY_DOMAIN = "my_domain"
MCP Client Usage
Python Client
import asyncio
from fastmcp import Client
client = Client("http://localhost:9000/mcp")
async def main():
async with client:
tools = await client.list_tools()
# tools -> list[mcp.types.Tool]
# print(tools)
for tool in tools:
print(f"Tool: {tool.name}")
result = await client.call_tool("textprep.expand_contraction", {"input_text": "The must've SSN is 859-98-0987. The employee's phone number is 555-555-5555."})
print("Result:", result)
asyncio.run(main())
Command Line Testing
# Test the server is running
curl http://localhost:9000/mcp/
# With FastMCP CLI for testing
fastmcp dev mcp_server.py -t streamable-http --port 9000
Quick Test
Test STDIO Transport:
# Start server in STDIO mode
python mcp_server.py --debug --no-auth
# Test with client_example.py
python client_example.py
Test HTTP Transport:
# Start HTTP server
python mcp_server.py --transport http --port 9000 --debug --no-auth
# Test with FastMCP client
python -c "
from fastmcp import Client
import asyncio
async def test():
async with Client('http://localhost:9000/mcp') as client:
result = await client.call_tool("textprep.expand_contraction", {"input_text": "The must've SSN is 859-98-0987. The employee's phone number is 555-555-5555."})
print(result)
asyncio.run(test())
"
Test with FastMCP CLI:
# Start with FastMCP CLI
fastmcp run mcp_server.py -t streamable-http --port 9000 -l DEBUG
# Server will be available at: http://127.0.0.1:9000/mcp/
Troubleshooting
Common Issues
- Import Errors: Make sure you're in the correct directory and dependencies are installed
- Authentication Errors: Check your Azure AD configuration and tokens
- Port Conflicts: Change the port in configuration if 9000 is already in use
- Missing fastmcp: Install with
pip install fastmcp
Debug Mode
Enable debug mode for detailed logging:
python mcp_server.py --debug --no-auth
Or set in environment:
MCP_DEBUG=true
Server Arguments
usage: mcp_server.py [-h] [--transport {stdio,http,streamable-http,sse}]
[--host HOST] [--port PORT] [--debug] [--no-auth]
MHLABS MCP Server
options:
-h, --help show this help message and exit
--transport, -t Transport protocol (default: stdio)
--host HOST Host to bind to for HTTP transport (default: 127.0.0.1)
--port, -p PORT Port to bind to for HTTP transport (default: 9000)
--debug Enable debug mode
--no-auth Disable authentication
📄 License
MIT License © 2025 MusaddiqueHussain Labs
🤝 Contributing
- Follow the existing code structure and patterns
- Add tests for new functionality
- Update documentation for new features
- Use the provided VS Code configurations for development
🧠 Learn More
- MCP Protocol: https://modelcontextprotocol.io
- FastMCP GitHub: https://github.com/fastmcp/fastmcp
- LangGraph Integration Guide (coming soon)
💡 Tip
If you want to embed mhlabs-mcp-tools into a larger MCP-based orchestrator:
from fastmcp import StdioServerParameters
server_params = StdioServerParameters(
command="python",
args=["-m", "mhlabs_mcp_tools.server"],
//env={"MHLABS_MCP_CATEGORY": "textprep,nlp"}
)
Developed with ❤️ by MusaddiqueHussain Labs
常见问题
io.github.MusaddiqueHussainLabs/mhlabs_mcp_tools 是什么?
提供文本预处理、NLP components 与文档分析能力的 MCP server,适合 AI 流程集成。
相关 Skills
MCP构建
by anthropics
聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。
✎ 想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。
Slack动图
by anthropics
面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。
✎ 帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。
MCP服务构建器
by alirezarezvani
从 OpenAPI 一键生成 Python/TypeScript MCP server 脚手架,并校验 tool schema、命名规范与版本兼容性,适合把现有 REST API 快速发布成可生产演进的 MCP 服务。
✎ 帮你快速搭建 MCP 服务与后端 API,脚手架完善、扩展顺手,尤其适合想高效验证服务能力的开发者。
相关 MCP Server
Slack 消息
编辑精选by Anthropic
Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。
✎ 这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。
by netdata
io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。
✎ 这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。
by d4vinci
Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。
✎ 这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。