Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fetch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers = [
dependencies = [
"httpx>=0.27",
"markdownify>=0.13.1",
"mcp>=1.1.3",
"mcp>=1.1.3,<2",
"protego>=0.3.1",
"pydantic>=2.0.0",
"readabilipy>=0.2.0",
Expand Down
23 changes: 23 additions & 0 deletions src/fetch/tests/test_server.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""Tests for the fetch MCP server."""

import tomllib
import pytest
from pathlib import Path
from unittest.mock import AsyncMock, patch, MagicMock
from mcp.shared.exceptions import McpError
from packaging.requirements import Requirement

from mcp_server_fetch.server import (
extract_content_from_html,
Expand Down Expand Up @@ -324,3 +327,23 @@ async def test_fetch_with_proxy(self):

# Verify AsyncClient was called with proxy
mock_client_class.assert_called_once_with(proxy="http://proxy.example.com:8080")


class TestDeclaredDependencies:
"""Tests for the dependencies declared in pyproject.toml."""

def test_mcp_requirement_excludes_2x(self):
"""Test that the mcp requirement excludes the 2.x line.

mcp 2.0.0 renamed McpError to MCPError and changed its constructor, so
server.py fails to import against it. Without an upper bound, unpinned
launchers such as uvx resolve 2.x and the server dies on startup.
"""
pyproject = Path(__file__).parent.parent / "pyproject.toml"
with pyproject.open("rb") as f:
dependencies = tomllib.load(f)["project"]["dependencies"]

requirements = [Requirement(dep) for dep in dependencies]
mcp_requirement = next(req for req in requirements if req.name == "mcp")

assert not mcp_requirement.specifier.contains("2.0.0")
2 changes: 1 addition & 1 deletion src/fetch/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading