Skip to content

fix(mcp): report our own version in the MCP handshake - #266

Merged
georgeh0 merged 1 commit into
cocoindex-io:mainfrom
junzh0u:fix/mcp-server-version
Aug 5, 2026
Merged

fix(mcp): report our own version in the MCP handshake#266
georgeh0 merged 1 commit into
cocoindex-io:mainfrom
junzh0u:fix/mcp-server-version

Conversation

@junzh0u

@junzh0u junzh0u commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #242.

MCPServer's version parameter defaults to "" and create_mcp_server never passed one, so the handshake advertises an empty serverInfo.version — Claude Code's /mcp and MCP Inspector show nothing.

This predates #242: v1's FastMCP took no version argument and filled the field with the SDK's own release, so the handshake reported 1.29.0. #242 turned a wrong value into an empty one; this reports the right one.

It now passes _version.__version__ — the same value ccc version prints (#245) and the daemon handshake compares against — so it can't drift. Single MCPServer(...) call site, so ccc mcp and the legacy cocoindex-code entry point both pick it up.

Try it

$ uv run python -c "
import asyncio
from mcp import Client
from cocoindex_code.server import create_mcp_server
async def m():
    async with Client(create_mcp_server('.')) as c: print(repr(c.server_info.version))
asyncio.run(m())"

''                          # main @ 1a56d0f
'0.2.40.dev7+gc51a93e78'    # this branch, matching `ccc version`

test_mcp_server_reports_own_version asserts the handshake value equals __version__.

Operational impact

None — handshake metadata only. No protocol, settings, or on-disk change; no migration.

🤖 Generated with Claude Code

`MCPServer`'s `version` parameter defaults to `""`, so the daemon-backed
server advertised an empty `serverInfo.version`. Under the v1 SDK the
field was auto-filled with the SDK's own version, which was already the
wrong number to report — clients saw the MCP SDK release, not ours.

Pass `_version.__version__`, the same value `ccc version`, the daemon
handshake, and the version-mismatch check already use.
@georgeh0
georgeh0 merged commit 0c18fe3 into cocoindex-io:main Aug 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants