Token导航 LogoToken导航TokenDH.com
Python Lft MCP logo
AI代理stdio官方级别未说明来源级核验

Python Lft MCP

MCP Server

一个现代化的Python开发工具包,通过Model Context Protocol (MCP)提供代码检查、格式化和测试功能,适用于专业开发工作流程。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
PythonCursor开发工具Cursor

安装说明

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

作者 / 组织

Agent-Hellboy

提供方

Agent-Hellboy

最后核验

2026/5/17 20:20

快速接入

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

命令预览

pip install python-lft-mcp

详细介绍

Python LFT(Lint、Format、Test)-MCP服务器

一个现代的模块化Python开发工具包,通过以下方式公开linting、格式化和测试功能 模型上下文协议(MCP)。采用干净的架构和现代设计模式构建,用于专业开发工作流程。

](https://github.com/Agent-Hellboy/python-lft-mcp) ![License: MIT](https://github.com/Agent-Hellboy/python-lft-mcp/blob/main/LICENSE)

![Tests](https://github.com/Agent-Hellboy/python-lft-mcp/actions/workflows/test.yml) ![codecov](https://codecov.io/gh/Agent-Hellboy/python-lft-mcp)

一个全面的MCP服务器,为Python项目提供智能linting、格式化和测试功能。它自动检测项目配置,并使LLM能够对代码质量工具做出明智的决策。

特性

  • 全面配置检测 -分析70多个Python生态系统配置文件
  • 智能工具集成 -支持褶皱、黑色、pytest、mypy、pylint等
  • LLM优化 -为智能工具选择提供详细的配置数据
  • 跨项目支持 -适用于任何Python项目结构
  • 快速可靠 -采用现代异步Python和MCP协议构建

快速开始

安装

# Install from PyPI (when published)
pip install python-lft-mcp

# Or install with all optional tool dependencies
pip install python-lft-mcp[tools]

MCP客户端配置

安装后,生成MCP配置:

# Generate configuration for your MCP client
python-lft-config

这将显示您需要添加到MCP客户端的配置。

Cursor IDE的快速配置

增添 ~/.cursor/mcp.json:

{
  "mcpServers": {
    "python-lft": {
      "command": "python",
      "args": ["-m", "python_lft"],
      "description": "Python LFT MCP Server"
    }
  }
}

对于其他MCP客户端

  • python-lft-config 获取完整说明
  • examples/mcp-config.json 有关更多配置选项

开发安装

# Clone the repository  
git clone https://github.com/Agent-Hellboy/python-lft-mcp.git
cd python-lft-mcp

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e ".[dev]"

有关开发配置,请参阅 examples/README.md.

用法

1.检测项目配置

# LLM calls this first to understand the project
detect_workspace_tools(work_dir="/path/to/project")

2.使用项目设置执行工具

# LLM uses the detected configuration
lint(
    target="all",
    exact_tool="ruff", 
    tool_config={"line-length": 88, "target-version": "py39"},
    work_dir="/path/to/project"
)

format_code(
    exact_tool="black",
    tool_config={"line-length": 88, "target-version": ["py39"]},
    work_dir="/path/to/project"
)

test(
    exact_tool="pytest",
    tool_config={"testpaths": ["tests"], "addopts": "-v"},
    work_dir="/path/to/project"
)

支持的工具

棉毛

  • 颈毛 -快速Python linter
  • 薄片8 -风格指南执行
  • 皮林 -代码分析
  • mypy -静态类型检查
  • 强盗 -安全防盗
  • pydoc风格 -Docstring约定

使用格式器

  • 黑色 -代码格式
  • 颈毛 -快速格式化
  • isort -导入排序
  • autopep8 -PEP 8格式
  • 雅普夫 -代码格式

试车手

  • pytest -测试框架
  • 鼻子2 -单元测试
  • 单位测试 -内置测试

支持的配置文件

  • pyproject.toml -现代Python项目配置
  • setup.cfg -旧版安装工具配置
  • tox.ini -测试自动化
  • pytest.ini -Pytest配置
  • .flake8 -Flake8设置
  • .pylintrc -Pylint配置
  • mypy.ini -MyPy设置
  • requirements.txt -依赖关系
  • .pre-commit-config.yaml -预提交挂钩
  • 还有60多个Python生态系统配置!

发展

设置开发环境

# Install development dependencies
pip install -e ".[dev]"

# Install pre-commit hooks (if available)
pre-commit install

Tox开发工作流

我们使用 毒素 对于标准化的开发工作流程:

# Run tests across all supported Python versions
tox

# Run specific environments
tox -e lint          # Run linting with ruff
tox -e format        # Format code with ruff (includes import sorting)
tox -e format-check  # Check formatting without changes
tox -e type          # Type checking with mypy
tox -e coverage      # Run tests with coverage reporting

# Run comprehensive testing
tox -e all           # Lint + format-check + type + test + coverage

# Test specific Python version
tox -e py39          # Test with Python 3.9
tox -e py312         # Test with Python 3.12

# Clean build artifacts
tox -e clean

# Build package for distribution
tox -e build

手动工具使用

# Run tests
pytest

# Run linting
ruff check .

# Type checking
mypy python_lft/

# Format code  
ruff check --fix .  # Fix linting issues and sort imports
ruff format .       # Format code

# Run tests with coverage
pytest --cov=python_lft

建筑

python_lft/
├── app.py              # MCP server creation
├── tools_api.py        # MCP tool definitions  
├── services/
│   ├── workspace.py    # Configuration detection
│   ├── orchestrator.py # Tool execution coordination
│   └── runners.py      # Command execution
├── executors/          # Tool-specific executors
├── core/              # Core models and interfaces
└── config/            # Constants and configuration

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 添加测试
  5. 运行测试套件: tox -e all
  6. 提交拉取请求

CI/CD

该项目使用GitHub Actions进行持续集成:

  • 棉绒:跑步 ruff check 每次推送/PR
  • 测试:在每次推送/PR时跨Python 3.9-3.12运行测试套件
  • CI公司:全面的质量检查(皮棉+格式+类型+测试+构建)
  • 发布:在版本标签上自动发布到PyPI和GitHub版本

在合并pull请求之前,必须通过所有检查。

许可证

MIT许可证-请参阅 许可证 文件以获取详细信息。

仓库

有关最新更新、问题和贡献,请访问:

目录标签

目录标签

PythonCursor开发工具Python开发本地部署代码检查代码格式化测试工具MCP协议

支持客户端

Cursor

接入字段

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

stdio

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

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

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

0

权限和风险

stdionone部署方式未说明

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

安装前确认

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

来源信息

继续浏览同类 MCP