← Back to MCP Pytest Server

Install MCP Pytest Server

Pick your client, copy the command, done.

Manual setup required. We don't have a verified install command for this server. Follow the maintainer README and use the raw config below as a starting point.
1

Prepare the server locally

Run this once before adding it to Claude Code.

pip install -r requirements.txt
2

Add it to Claude Code

Paste the maintainer's config below, then edit any placeholder values.

~/.claude.json
{
  "mcp_servers": {
    "pytest_server": {
      "command": "python",
      "args": [
        "-m",
        "src.main"
      ],
      "env": {
        "DATABASE_URL": "sqlite:///./test_results.db"
      }
    }
  }
}

See the mcp-pytest-server README for full setup instructions.

Required:DATABASE_URL

Environment Variables

Set these before running MCP Pytest Server.

VariableDescriptionRequired
DATABASE_URLDatabase connection string for storing test resultsYes

Available Tools (3)

Once configured, MCP Pytest Server gives your AI agent access to:

run_pytest_testsExecutes pytest tests and returns the results and report.
test_pathoptions
store_test_resultsStores test results into the database.
test_results
get_test_historyRetrieves historical test records from the database.
limitproject

Try It Out

After setup, try these prompts with your AI agent:

Run the pytest tests located in the /tests directory and summarize the failures.
Store the latest test execution results into the QA database.
Show me the history of the last 10 test runs for the current project.
Execute the test suite with verbose output enabled.
Prerequisites & system requirements
  • An MCP-compatible client (Claude Code, Cursor, Windsurf, Claude Desktop, or Codex)
  • Python 3.8+ with pip installed
  • DATABASE_URL — Database connection string for storing test results
Alternative installation methods

Manual

python -m src.main

Keep this setup from going cold

Save the docs, env vars, and workflow around MCP Pytest Server in Conare so Claude Code, Codex, and Cursor remember it next time.

Remember this setup