test updates
This commit is contained in:
@@ -4,7 +4,7 @@ from pathlib import PurePosixPath
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from personal_mcp.registry.models.common import parse_docs_path
|
from personal_mcp.registry.models import parse_docs_path
|
||||||
|
|
||||||
pytestmark = pytest.mark.unit
|
pytestmark = pytest.mark.unit
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
from pathlib import PurePosixPath
|
from pathlib import PurePosixPath
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from personal_mcp.registry.models.registry import DocsRegistry
|
|
||||||
|
|
||||||
from personal_mcp.registry.load import read_docs_markdown_path
|
from personal_mcp.registry.load import read_docs_markdown_path
|
||||||
|
from personal_mcp.registry.models import DocsRegistry
|
||||||
|
|
||||||
pytestmark = pytest.mark.unit
|
pytestmark = pytest.mark.unit
|
||||||
|
|
||||||
|
|||||||
@@ -35,23 +35,15 @@ class TestMcpHttpEndpoints:
|
|||||||
"""Covers MCP transport endpoint smoke behavior."""
|
"""Covers MCP transport endpoint smoke behavior."""
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_tools_bridge_native_skill_resources(self, mcp_session_factory) -> None:
|
async def test_does_not_publish_legacy_resource_bridge_tools(self, mcp_session_factory) -> None:
|
||||||
"""Ensures tool-only clients can discover and read native skill resources."""
|
"""Ensures deprecated compatibility tools are not exposed on the MCP route."""
|
||||||
async with mcp_session_factory() as mcp_session:
|
async with mcp_session_factory() as mcp_session:
|
||||||
tools_result = await mcp_session.list_tools()
|
tools_result = await mcp_session.list_tools()
|
||||||
list_result = await mcp_session.call_tool("list_resources")
|
|
||||||
read_result = await mcp_session.call_tool(
|
|
||||||
"read_resource",
|
|
||||||
{"uri": "skill://mcp-details/SKILL.md"},
|
|
||||||
)
|
|
||||||
|
|
||||||
assert {tool.name for tool in tools_result.tools} == {
|
tool_names = {tool.name for tool in tools_result.tools}
|
||||||
"list_resources",
|
assert "search_skills" not in tool_names
|
||||||
"read_resource",
|
assert "list_resources" not in tool_names
|
||||||
"search_skills",
|
assert "read_resource" not in tool_names
|
||||||
}
|
|
||||||
assert "skill://mcp-details/SKILL.md" in list_result.content[0].text
|
|
||||||
assert "# MCP Details" in read_result.content[0].text
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_accepts_initialize_jsonrpc_request(
|
async def test_accepts_initialize_jsonrpc_request(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from mcp.types import PromptReference
|
from mcp_types import PromptReference
|
||||||
|
|
||||||
pytestmark = pytest.mark.smoke
|
pytestmark = pytest.mark.smoke
|
||||||
|
|
||||||
|
|||||||
@@ -10,49 +10,19 @@ pytestmark = pytest.mark.smoke
|
|||||||
class TestMcpSkillsSurface:
|
class TestMcpSkillsSurface:
|
||||||
"""Covers native skill resources over the HTTP MCP surface."""
|
"""Covers native skill resources over the HTTP MCP surface."""
|
||||||
|
|
||||||
class TestCompatibilityTools:
|
class TestTools:
|
||||||
"""Covers metadata for tool-only MCP clients."""
|
"""Covers absence of deprecated compatibility tools."""
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_exposes_safe_human_readable_tools(self, mcp_session_factory) -> None:
|
async def test_does_not_expose_resource_bridge_tools(self, mcp_session_factory) -> None:
|
||||||
"""Ensures clients receive display titles and complete safety hints."""
|
"""Ensures native resources are not projected through legacy compatibility tools."""
|
||||||
async with mcp_session_factory() as mcp_session:
|
async with mcp_session_factory() as mcp_session:
|
||||||
result = await mcp_session.list_tools()
|
result = await mcp_session.list_tools()
|
||||||
|
|
||||||
tools = {tool.name: tool for tool in result.tools}
|
tool_names = {tool.name for tool in result.tools}
|
||||||
assert tools["search_skills"].title == "Search Skills"
|
assert "search_skills" not in tool_names
|
||||||
assert tools["list_resources"].title == "List Resources"
|
assert "list_resources" not in tool_names
|
||||||
assert tools["read_resource"].title == "Read Resource"
|
assert "read_resource" not in tool_names
|
||||||
assert all(tool.annotations is not None for tool in tools.values())
|
|
||||||
assert all(tool.annotations.read_only_hint for tool in tools.values() if tool.annotations is not None)
|
|
||||||
assert all(tool.annotations.idempotent_hint for tool in tools.values() if tool.annotations is not None)
|
|
||||||
assert all(
|
|
||||||
tool.annotations.open_world_hint is False for tool in tools.values() if tool.annotations is not None
|
|
||||||
)
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
|
||||||
async def test_searches_skill_metadata_without_loading_content(self, mcp_session_factory) -> None:
|
|
||||||
"""Ensures search returns bounded canonical skill pointers ranked by metadata."""
|
|
||||||
async with mcp_session_factory() as mcp_session:
|
|
||||||
result = await mcp_session.call_tool(
|
|
||||||
"search_skills",
|
|
||||||
{"query": "FastMCP protocol", "limit": 1},
|
|
||||||
)
|
|
||||||
|
|
||||||
assert result.is_error is False
|
|
||||||
assert result.structured_content == {
|
|
||||||
"results": [
|
|
||||||
{
|
|
||||||
"name": "mcp-details",
|
|
||||||
"description": (
|
|
||||||
"Reference hub for MCP and FastMCP source documentation links. Use when you need "
|
|
||||||
"authoritative protocol, SDK, transport, and deployment docs without loading broad "
|
|
||||||
"implementation guidance."
|
|
||||||
),
|
|
||||||
"uri": "skill://mcp-details/SKILL.md",
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
class TestResources:
|
class TestResources:
|
||||||
"""Covers native skill resources, manifests, and file templates."""
|
"""Covers native skill resources, manifests, and file templates."""
|
||||||
|
|||||||
Reference in New Issue
Block a user