Skip to content

@server.list_prompts() removed from MCP SDK — server crashes with AttributeError #31

Description

@PabloJustDevelops

Describe the bug

docker-mcp crashes on startup with:

AttributeError: 'Server' object has no attribute 'list_prompts'

Root cause

The pyproject.toml declares mcp>=1.0.0 without an upper bound. The MCP Python SDK removed the @server.list_prompts() and @server.get_prompt() decorators in recent versions — list_prompts is no longer a method on the Server class.

The affected code is in src/docker_mcp/server.py:

@server.list_prompts()
async def handle_list_prompts() -> List[types.Prompt]:
    ...

@server.get_prompt()
async def handle_get_prompt(name: str, ...) -> types.GetPromptResult:
    ...

Suggested fix (either one)

Option A — pin the SDK version in pyproject.toml:

dependencies = [
    ...
    "mcp>=1.0.0,<1.10",
    ...
]

Option B — remove the prompt decorators since prompts are optional per the MCP spec and the tools (create-container, deploy-compose, get-logs, list-containers) work fine without them.

Workaround for users until fix is released

{
  "mcpServers": {
    "docker-mcp": {
      "command": "uvx",
      "args": ["--from", "docker-mcp", "--with", "mcp<1.10", "docker-mcp"]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions