python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

Question: version in `create_initialization_options` is the pkg_ver for "mcp"

Open restlessronin opened this issue 1 year ago • 4 comments

This is more in the nature of a request for clarification.

The sample code in the SDK here:

https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/servers/simple-prompt/mcp_simple_prompt/server.py

shows the use of create_initialization_options to set the initialization options. However this function is setting the version to 'pkg_ver("mcp")' which seems to indicate that it is the protocol version that is being indicated.

In the sqlite example, the version is manually set to 0.1.0, so it won't use the protocol version. Is this a mistake?

Is the version meant to record the version of whatever the actual server program is? or is it mean to be the protocol version.

restlessronin avatar Dec 03 '24 18:12 restlessronin

This version is pure informational and for debugging purposes. The protocol version is exchanged differently and hardcoded into the current version of the SDK.

dsp-ant avatar Dec 04 '24 16:12 dsp-ant

If it's for user visible debugging, perhaps the create_initialization_options could take the version as a parameter? it could be set to the pkg_ver of the server, that's more useful in the Claude Desktop UX than the the mcp version, which is relatively static. it's a small change, but i can submit the PR if that's of interest.

restlessronin avatar Dec 04 '24 17:12 restlessronin

I think that would be an improvement. If you are so kind and create a PR @restlessronin

dsp-ant avatar Dec 04 '24 22:12 dsp-ant

@dsp-ant here it is: https://github.com/modelcontextprotocol/python-sdk/pull/90

restlessronin avatar Dec 05 '24 05:12 restlessronin