Files
basicmachines-co-basic-memory/test-int/mcp/test_ui_sdk_integration.py
Paul Hernandez 55d675e278 feat: min_similarity override, cloud promo improvements (#570)
Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:44:02 -06:00

77 lines
2.4 KiB
Python

"""
Integration tests for MCP-UI Python SDK embedded resources.
NOTE: UI tools are temporarily disabled (not registered with MCP server)
while MCP client rendering is being sorted out. These tests are skipped
until the tools are re-enabled in basic_memory.mcp.tools.__init__.
"""
import pytest
from fastmcp import Client
pytest.importorskip("mcp_ui_server")
pytestmark = pytest.mark.skip(reason="UI tools temporarily disabled")
@pytest.mark.asyncio
async def test_search_notes_ui_embedded_resource(mcp_server, app, test_project):
async with Client(mcp_server) as client:
await client.call_tool(
"write_note",
{
"project": test_project.name,
"title": "SDK Note",
"directory": "notes",
"content": "# SDK Note\n\nThis is for embedded UI.",
"tags": "sdk,ui",
},
)
result = await client.call_tool(
"search_notes_ui",
{
"project": test_project.name,
"query": "SDK",
},
)
assert len(result.content) == 1
block = result.content[0]
assert block.type == "resource"
assert block.resource.mimeType == "text/html"
assert "<!doctype html>" in block.resource.text.lower()
assert block.resource.meta is not None
assert "mcpui.dev/ui-initial-render-data" in block.resource.meta
@pytest.mark.asyncio
async def test_read_note_ui_embedded_resource(mcp_server, app, test_project):
async with Client(mcp_server) as client:
await client.call_tool(
"write_note",
{
"project": test_project.name,
"title": "SDK Note Preview",
"directory": "notes",
"content": "# SDK Note Preview\n\nPreview for embedded UI.",
"tags": "sdk,ui",
},
)
result = await client.call_tool(
"read_note_ui",
{
"project": test_project.name,
"identifier": "SDK Note Preview",
},
)
assert len(result.content) == 1
block = result.content[0]
assert block.type == "resource"
assert block.resource.mimeType == "text/html"
assert "<!doctype html>" in block.resource.text.lower()
assert block.resource.meta is not None
assert "mcpui.dev/ui-initial-render-data" in block.resource.meta