Skip to main content
Glama

PEP MCP Server

MCP server that exposes on-demand Python PEP lookup tools backed by the live PEP index.

Features

  • list_peps: list only active PEPs

  • search_peps: search active PEP titles

  • get_pep: fetch a PEP document by number, optionally returning focused excerpts for a query

Related MCP server: PyPI Package MCP Server

Data Sources

  • PEP index JSON: https://peps.python.org/api/peps.json

  • PEP content:

    • https://raw.githubusercontent.com/python/peps/main/peps/pep-XXXX.rst

    • Fallback: https://github.com/python/peps/blob/main/peps/pep-XXXX.rst?plain=1

Setup

python -m venv .venv
.venv/bin/pip install -e ".[dev]"

Run

.venv/bin/pep-mcp-server

or:

.venv/bin/python -m pep_mcp_server

Docker

Build and tag:

docker build -t pep-mcp-server:latest .

MCP uses stdio, so the container must keep stdin open (-i). Example:

docker run --rm -i pep-mcp-server:latest

Cursor MCP (Docker)

You do not put PEP or GitHub URLs in mcp.json. Cursor only needs the command that runs the server; listing and fetching PEPs happens inside the process when tools run.

Use -i (required for stdio). Optional -e lines silence the startup banner and pin transport:

{
  "mcpServers": {
    "pep": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "FASTMCP_TRANSPORT=stdio",
        "-e",
        "FASTMCP_SHOW_SERVER_BANNER=false",
        "pep-mcp-server:latest"
      ]
    }
  }
}

If the image is not on this machine yet, build it once from the project directory (see above).

If the MCP log shows Found 0 tools but listOfferingsForUI / Not connected warnings, that is often a Cursor UI race or a separate UI listing path; try reloading the window or invoking a tool from chat. The server still exposes three tools over stdio (verified with the MCP Python client).

Tool Contracts

list_peps() -> list[dict]

Returns active PEPs with:

  • number

  • title

  • type

  • topic

  • created

  • url

(status is omitted; every row is active.)

search_peps(query: str) -> list[dict]

Case-insensitive substring search on active PEP titles.

get_pep(pep, query=None, max_full_content_chars=None) -> dict

  • Accepts 8, 0008, or pep-0008.

  • Returns metadata and:

    • content when query is not provided (capped by default for token efficiency)

    • excerpt when query is provided and matches

    • content fallback when query has no matches (also capped by default)

  • Optional max_full_content_chars: omit or None for the default cap; use 0 for the full document (can be very large).

Tests

.venv/bin/pytest -q

Available Tools

3 tools
get_pepA

Get a PEP by number. Use query for excerpts; full body is capped by default.

Pass max_full_content_chars=0 for an uncapped full document (can be very large).

NameRequiredDescriptionDefault
pepYes
queryNo
max_full_content_charsNo

Output Schema

NameRequiredDescription

No output parameters

list_pepsA

List active Python PEPs with compact metadata.

NameRequiredDescriptionDefault

No parameters

Output Schema

NameRequiredDescription
resultYes
search_pepsB

Search active PEP titles for a query string.

NameRequiredDescriptionDefault
queryYes

Output Schema

NameRequiredDescription
resultYes

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedget_pep
    • First observedlist_peps
    • First observedsearch_peps

TDQS

A3.8/5.0

Scored across 3 tools

Disambiguation5/5

The three tools have clearly distinct purposes: 'get' retrieves a specific PEP by number, 'list' enumerates all active PEPs, and 'search' finds PEPs by title query. No functional overlap exists between them.

Naming Consistency5/5

All tools follow a consistent snake_case verb_noun pattern (get_pep, list_peps, search_peps). The pluralization appropriately matches the return cardinality (singular for single retrieval, plural for collection operations).

Tool Count5/5

Three tools is the ideal minimum for a read-only document server, covering the essential access patterns: enumeration, search, and specific retrieval. The scope is tightly focused without bloat.

Completeness3/5

While the basic read operations are present, notable gaps exist: list_peps and search_peps are restricted to 'active' PEPs only with no way to access other statuses, search_peps only searches titles (not content or authors), and there are no filtering options for metadata like author or Python version.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to fetch, explore, and analyze source code from any Python package on PyPI, including listing files, reading specific code, and searching packages across all published versions.
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to search PyPI packages and retrieve detailed metadata, version history, and download statistics. It provides a standardized interface for interacting with the Python Package Index through the Model Context Protocol.
    2
    -