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
3 changes: 2 additions & 1 deletion src/cocoindex_code/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from mcp.server.mcpserver import MCPServer
from pydantic import BaseModel, Field

from ._version import __version__
from .settings import DaemonSettings, load_user_settings

_MCP_INSTRUCTIONS = (
Expand Down Expand Up @@ -60,7 +61,7 @@ class SearchResultModel(BaseModel):

def create_mcp_server(project_root: str) -> MCPServer:
"""Create a lightweight MCP server that delegates to the daemon."""
mcp = MCPServer("cocoindex-code", instructions=_MCP_INSTRUCTIONS)
mcp = MCPServer("cocoindex-code", instructions=_MCP_INSTRUCTIONS, version=__version__)

@mcp.tool(
name="search",
Expand Down
10 changes: 10 additions & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from mcp import Client

from cocoindex_code import client as daemon_client
from cocoindex_code._version import __version__
from cocoindex_code.protocol import SearchResponse
from cocoindex_code.server import create_mcp_server

Expand Down Expand Up @@ -29,3 +30,12 @@ async def test_mcp_server_uses_v2_protocol(monkeypatch: pytest.MonkeyPatch) -> N
"offset": 0,
"message": None,
}


async def test_mcp_server_reports_own_version() -> None:
"""The handshake advertises our version, not the SDK's or an empty string."""
server = create_mcp_server(".")
async with Client(server, raise_exceptions=True) as client:
assert client.server_info is not None
assert client.server_info.name == "cocoindex-code"
assert client.server_info.version == __version__
Loading