Skip to content
Merged
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
5 changes: 5 additions & 0 deletions src/contextseek/mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class ContextSeekMCPServer:

client: ContextSeek

@classmethod
def with_default_client(cls) -> "ContextSeekMCPServer":
"""Create a server backed by the default ContextSeek settings."""
return cls(client=ContextSeek.from_settings())

def list_tools(self) -> list[dict[str, Any]]:
"""Return MCP tool definitions."""
return [
Expand Down
23 changes: 23 additions & 0 deletions tests/unit_tests/test_mcp_runtime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Tests for MCP runtime/server construction."""

from __future__ import annotations

from io import StringIO

from contextseek.mcp.runtime import run_stdio_server
from contextseek.mcp.server import ContextSeekMCPServer


def test_mcp_server_with_default_client_builds_tools() -> None:
server = ContextSeekMCPServer.with_default_client()

assert isinstance(server, ContextSeekMCPServer)
assert any(tool["name"] == "contextseek_retrieve" for tool in server.list_tools())


def test_stdio_server_falls_back_to_default_client_without_daemon(monkeypatch) -> None:
monkeypatch.setattr("contextseek.mcp.runtime._daemon_available", lambda base: False)
monkeypatch.setattr("sys.stdin", StringIO(""))
monkeypatch.setattr("sys.stdout", StringIO())

assert run_stdio_server() == 0
Loading