Quack MCP Server

Quack MCP Server

A continuous integration server that automates Python code analysis, providing linting and static type checking tools for quality assurance.

Category
访问服务器

README

Quack MCP Server

Quack is a continuous integration server built as an MCP server that automates code analysis and testing for Python code. It provides tools for linting and static type analysis of Python code.

Features

  • Linting: Analyzes Python code for style, formatting, and code quality issues using pylint.
  • Static Analysis: Performs static type checking using mypy to identify type errors.
  • Asynchronous Processing: Jobs are processed asynchronously, allowing for concurrent analysis of multiple code submissions.
  • Job Management: Track and retrieve results of submitted jobs.

Installation

  1. Clone the repository:
git clone https://github.com/ahmedmustahid/quack-mcp-server.git
cd quack
  1. Install dependencies:

First, install uv from here

uv pip install -r requirements.txt

The Quack server requires the following dependencies:

mcp[cli]
pylint
mypy
basedpyright
pytest
pytest-asyncio

Usage

Starting the Server

To start the Quack server with stdio transport (default):

uv run quack.py

For debug logging:

uv run quack.py --debug

To start the server with streamable HTTP transport:

#default --host=0.0.0.0 --port=8000
uv run quack.py --streamable-http

Alternatively, you can use the provided shell script:

# For stdio transport (default)
./run_quack.sh

# For Streamable-http transport
./run_quack.sh --streamable-http --host=0.0.0.0 --port=8000

Docker Container

The Quack server can be run in a Docker container, which automatically uses Streamable-http transport:

# Build the Docker image
docker build -t quack-mcp-server .

# Run the container, exposing port 8000
docker run -p 8000:8000 quack-mcp-server

When running in a Docker container, the server automatically starts in Streamable-http mode on port 8000.

Using the MCP Tools

Quack exposes the following MCP tools:

  1. submit_code: Submit code for both linting and static analysis.
  2. submit_code_for_linting: Submit code for linting only.
  3. submit_code_for_static_analysis: Submit code for static analysis only.
  4. submit_code_for_basedpyright: Submit code for basedpyright analysis only.
  5. get_job_results: Get the results of a submitted job.
  6. list_jobs: List all jobs and their status.

Setting Up Quack with Cline/Claude Code

Quack can be integrated with Cline to provide code analysis capabilities directly through the Cline interface.

Configuration Steps

  1. Configure Cline MCP Settings

    The Quack server can be configured in Cline's MCP settings file at:

    ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
    

    For Local Stdio Mode (Default)

    {
      "mcpServers": {
        "quack": {
          "command": "path/to/your/uv",
          "args": ["run","/path/to/your/quack.py"],
          "env": {},
          "disabled": false,
          "autoApprove": []
        }
      }
    }
    

    For Docker Container with Streamable Http

    When running the server in a Docker container, configure Cline to connect via Streamable-http:

    {
      "mcpServers": {
        "quack": {
          "url": "http://localhost:8000/mcp",
          "disabled": false,
          "autoApprove": []
        }
      }
    }
    

    Note: Replace localhost:8000 with the appropriate host and port if you've mapped the Docker container to a different port.

Usage Sample Image

Used with Zed Agent in Zed editor. Model used: Gemini 2.5 Flash

Usage Sample Image

Using Quack with Cline

Once configured, you can use Cline to analyze Python code using the Quack server. Here are some example prompts:

  • Analyze code for linting issues:

    Analyze this Python code for linting issues:
    [paste your code here]
    
  • Check code for type errors:

    Check this Python code for type errors:
    [paste your code here]
    
  • Get comprehensive feedback:

    What's wrong with this Python function?
    [paste your function here]
    

Testing Architecture

Quack has two distinct testing concepts:

  1. Tests OF Quack: The tests in the tests/ directory verify that the Quack server, job manager, and processors are working correctly. When you add a new processor, you should add tests here to verify your processor works.

  2. Tests BY Quack: These are the analyses that Quack performs on submitted code. The lint processor and static analysis processor analyze Python code for issues. Your new processor will do the same on separate code submissions.

Directory Structure

tests/
  ├── server/          # Tests OF the server functionality
  │   ├── test_server_direct.py    # Direct testing of job manager
  │   ├── test_server_auto.py      # Auto-starts and stops the server
  │   └── test_server_client.py    # Tests the MCP client interface
  ├── processors/      # Tests OF the processors
  │   ├── test_lint_processor.py        # Tests for lint processor
  │   └── test_static_analysis_processor.py  # Tests for static analysis
  └── examples/        # Example submissions for testing BY the server
      └── example_code.py          # Contains intentional issues for testing

When implementing a new processor (e.g., a test coverage processor):

  1. Create your processor in quack/processors/
  2. Add tests for your processor in tests/processors/
  3. Use code in tests/examples/ to test what your processor analyzes

Running Tests

The repository includes a comprehensive test suite in the tests directory. All tests are managed using pytest.

  1. Run all tests:
python -m pytest tests/ --asyncio-mode=auto
  1. Run a specific test file:
python -m pytest tests/server/test_server_direct.py -v --asyncio-mode=auto
  1. Run tests for a specific processor:
python -m pytest tests/processors/test_lint_processor.py -v
  1. Run tests with verbose output and show test progress:
python -m pytest tests/ -v --asyncio-mode=auto
  1. Run tests and stop on the first failure:
python -m pytest tests/ -x --asyncio-mode=auto

Automatic Server Management

Many of the tests automatically start and stop the Quack server as needed, so you don't need to manually manage the server process during testing. This is handled by pytest fixtures in the conftest.py file.

The server tests in tests/server/test_server_auto.py demonstrate how to automatically start and stop the server for testing. These tests verify that:

  1. The server starts up correctly
  2. The server can process jobs
  3. The server shuts down properly

Sample Code for Testing

You can use the following sample code with intentional issues to test the Quack server:

# Linting issues
unused_var = 42  # Unused variable
x = 10  # Single-letter variable name

# Type issues
def add(a: int, b: int) -> int:
    return a + b

# Function with both linting and type issues
def calculate_average(numbers):  # Missing type annotations
    total = 0
    for num in numbers:
        total += num
    unused_result = total * 2  # Unused variable
    return total / len(numbers)

# Call with wrong type
result = add("5", 10)  # Type error: str + int

How It Works

  1. When you ask Cline to analyze Python code, Cline will use the Quack MCP server
  2. The Quack server will process the code through its linting and static analysis tools
  3. The results will be returned to Cline, which will present them to you in a readable format

Troubleshooting

If Cline doesn't seem to be using the Quack server:

  1. Make sure the Quack server is properly configured in the MCP settings file
  2. Check that the path to the quack.py file is correct (for stdio mode)
  3. Verify the URL is correct and the server is running (for Streamable-http mode)
  4. Ensure all dependencies are installed
  5. Restart VSCode to reload the MCP settings

Docker-Specific Issues

When running in Docker:

  1. Port Mapping: Ensure the container's port 8000 is properly mapped to a host port:

    docker run -p 8000:8000 quack-mcp-server
    
  2. Network Access: If running Docker in a complex network environment, make sure the host can access the container's port.

  3. Container Logs: Check the container logs for any startup issues:

    docker logs <container_id>
    
  4. Testing the Connection: You can test if the Streamable http endpoint is accessible:

    curl http://localhost:8000
    

    This should return a 404 response (since there's no root endpoint), but confirms the server is running.

Architecture

Quack is built using the Model Context Protocol (MCP) and consists of the following components:

  • Server: The main MCP server that handles client connections and tool invocations.
  • Job Manager: Manages the lifecycle of jobs, including submission, processing, and result retrieval.
  • Processors: Specialized components that perform the actual code analysis:
    • Lint Processor: Uses pylint to analyze code style and quality.
    • Static Analysis Processor: Uses mypy to perform static type checking.

Development

Adding New Processors

To add a new processor:

  1. Create a new processor class in the quack/processors directory.
  2. Implement the process method to perform the analysis.
  3. Register the processor in the server.
  4. Add tests for your processor in tests/processors/.

Example: Adding a Test Coverage Processor

  1. Create quack/processors/coverage.py with your processor implementation
  2. Add the processor to the server in quack/server.py
  3. Create tests in tests/processors/test_coverage_processor.py
  4. Test your processor with example code in tests/examples/

Logs are written to both the console and logs/quack.log.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选