Token导航 LogoToken导航TokenDH.com
mhlabs MCP tools logo
文档知识stdio官方级别未说明来源级核验

mhlabs MCP tools

MCP Server

一个基于FastMCP的可扩展AI工具生态系统,提供文本预处理、NLP组件和文档分析等功能,支持多种传输协议和认证方式。

工具数

36

提示词数

0

GitHub Stars

0

资源数

0
PythonClaudeFastMCPClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

MusaddiqueHussainLabs

提供方

MusaddiqueHussainLabs

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -r requirements.txt

详细介绍

mhlabs mcp工具

mcp名称:io.github。音乐学院侯赛因实验室/mhlabs_mcp_tools

🧠 mhlabs mcp工具

mhlabs-mcp-tools 是一个 模块化MCP工具服务器 使用 FastMCP.\ 它提供了一个 可扩展的人工智能工具生态系统 组织成功能类别(文本预处理、NLP组件、文档分析等),可以通过以下方式动态加载和提供服务 MCP(模型上下文协议) 通过 STDIO传输.

该项目是 MHLabs人工智能代理生态系统,旨在与 mhlabs-mcp-server, mhlabs-mcp-agents以及下游A2A代理框架。

______________________________________________________________________

特性

  • FastMCP服务器:支持多种传输协议的纯FastMCP实现
  • 工厂模式:可重复使用的MCP工具工厂,便于服务管理
  • 基于域的组织:按业务领域组织的服务(人力资源、技术支持等)
  • 认证:可选的Azure AD身份验证支持
  • 多个传输:STDIO、HTTP(流式传输)和SSE传输支持
  • VS代码集成:调试配置和开发设置
  • 综合测试:使用pytest进行单元测试
  • 灵活的配置:基于环境的配置管理

建筑

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

可用服务

目前,该软件包分为三个主要模块:

NLP组件

组件类型描述
标记化文本标记化
词性标注
词词形化
词法词形研究
dep依赖关系解析
ner命名实体识别
norm文本规范化

2.文本预处理

该模块为用户提供了一套广泛的文本预处理工具:

功能说明
to_lower将文本转换为小写
to_upper将文本转换为大写
remove_number删除数字字符
remove_itemized_bullet_and_numbering取消逐项/要点编号
remove_url从文本中删除url
remove_punctuation删除标点符号
remove_special_character删除特殊字符
keep_alpha_numeric仅保留字母数字字符
remove_whitespace删除多余的空格
normalize_unicode规范unicode字符
remove_stopword消除常见的停用词
remove_freqwords删除频繁出现的单词
remove_rarewords删除罕见词
remove_email删除电子邮件地址
remove_phone_number删除电话号码
remove_ssn删除社会安全号码(ssn)
remove_credit_card_number删除信用卡号
remove_emoji删除表情符号
remove_emotcons删除表情符号
convert_emoticons_to_words将表情符号转换为单词
convert_emojis_to_words将表情符号转换为单词
remove_html删除html标签
chat_words_conversion将聊天语言转换为标准英语
expand_contraction扩大收缩(例如,“不能”到“不能”)
tokenize_word标记单词
tokenize_sentence将句子标记化
stem_word词干
词形词对单词进行lemmatize
preprocess_text将多个预处理步骤合并到一个函数中

快速开始

开发设置

  1. 克隆和导航:
   cd src/mhlabs_mcp_tools
  1. 再进行:
   pip install -r requirements.txt
  1. 配置环境:
   cp .env.example .env
   # Edit .env with your configuration
  1. 启动服务器:
   # 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

运输选项

1.STDIO传输(默认)

  • 🔧 非常适合:本地工具、命令行集成、Claude Desktop
  • 🚀 用途: python mcp_server.pypython mcp_server.py --transport stdio

2.HTTP(流式)传输

  • 🌐 非常适合:基于Web的部署、微服务、远程访问
  • 🚀 用途: python mcp_server.py --transport http --port 9000
  • 🌐 网址: http://127.0.0.1:9000/mcp/

3.苏格兰和南方能源公司运输部(已弃用)

  • ⚠️ 仅支持旧版本-对新项目使用HTTP传输
  • 🚀 用途: python mcp_server.py --transport sse --port 9000

FastMCP CLI使用情况

# 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代码开发

  1. 在VS代码中打开:
   code .
  1. 使用调试配置:

- Debug MCP Server (STDIO):使用STDIO传输运行 - Debug MCP Server (HTTP):使用HTTP传输运行 - Debug Tests:运行测试套件

配置

环境变量

创建一个 .env 文件基于 .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

认证

MCP_ENABLE_AUTH=true,服务器需要Azure AD承载令牌。使用适当的设置配置您的Azure应用程序注册。

对于开发,set MCP_ENABLE_AUTH=false 禁用身份验证。

添加新服务

  1. 创建服务类:
   from 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
  1. 在服务器中注册:
   # In mcp_server.py (gets registered automatically from services/ directory)
   factory.register_service(MyService())
  1. 添加域 (如果是新的):
   # In core/factory.py
   class Domain(Enum):
       # ... existing domains
       MY_DOMAIN = "my_domain"

MCP客户端使用情况

Python客户端

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())

命令行测试

# 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

快速测试

测试STDIO传输:

# Start server in STDIO mode
python mcp_server.py --debug --no-auth

# Test with client_example.py
python client_example.py

测试HTTP传输:

# 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())
"

使用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/

故障排除

常见问题

  1. 导入错误:确保您位于正确的目录中,并且安装了依赖项
  2. 身份验证错误:检查您的Azure AD配置和令牌
  3. 端口冲突:如果9000已在使用中,请更改配置中的端口
  4. 缺少fastmcp:安装 pip install fastmcp

调试模式

启用调试模式以进行详细日志记录:

python mcp_server.py --debug --no-auth

或设置在环境中:

MCP_DEBUG=true

服务器参数

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

______________________________________________________________________

📄 许可证

麻省理工学院许可证©2025 侯赛因博物馆实验室

______________________________________________________________________

🤝 贡献

  1. 遵循现有的代码结构和模式
  2. 添加新功能的测试
  3. 更新新功能的文档
  4. 使用提供的VS代码配置进行开发

______________________________________________________________________

🧠 了解更多

______________________________________________________________________

💡 小贴士

如果你想嵌入 mhlabs-mcp-tools 变成一个更大的基于MCP的编排器:

from fastmcp import StdioServerParameters
server_params = StdioServerParameters(
    command="python",
    args=["-m", "mhlabs_mcp_tools.server"],
    //env={"MHLABS_MCP_CATEGORY": "textprep,nlp"}
)

______________________________________________________________________

与开发❤️ 通过 侯赛因博物馆实验室

目录标签

目录标签

PythonClaudeFastMCP文本预处理本地部署NLP组件文档分析AI工具

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

工具数量(toolCount,工具数)

36

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosession部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP