Skip to content

Conversation

IAmSurajBobade
Copy link
Contributor

mcp/protocol: Implement SEP-973 specification

Fixes #552

@IAmSurajBobade
Copy link
Contributor Author

@findleyr, please note - this changes currently do not work with MCP Inspector 0.17.0, as modelcontextprotocol/modelcontextprotocol#1531 is not implemented yet. I have created issue modelcontextprotocol/inspector#861 to track this.

Copy link
Contributor

@findleyr findleyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this change!

Can you add a basic smoke test (perhaps just adding to TestEndToEnd) that verifies the client receives the new metadata correctly?

(I'm sure it works, but good to have at least one end-to-end test).

@findleyr
Copy link
Contributor

@findleyr, please note - this changes currently do not work with MCP Inspector 0.17.0, as modelcontextprotocol/modelcontextprotocol#1531 is not implemented yet. I have created issue modelcontextprotocol/inspector#861 to track this.

Ah, this is a really important point. We need to not return this data based on the client's protocol version!
This definitely warrants a test!

@IAmSurajBobade
Copy link
Contributor Author

Thanks for this change!

Can you add a basic smoke test (perhaps just adding to TestEndToEnd) that verifies the client receives the new metadata correctly?

(I'm sure it works, but good to have at least one end-to-end test).

Yes, was about to ask, if we are good with this changes. I will add tests accordingly.

@IAmSurajBobade
Copy link
Contributor Author

IAmSurajBobade commented Oct 11, 2025

I have updated E2E tests. And updated streamable tests - which were using shared object.

We need to not return this data based on the client's protocol version!

As of now, Inspector integration fails, as specification draft has changed after original changes were incorporated in inspector. I am not sure, if this would still be a braking change for clients implementing '2025-06-18' or earlier protocol.

@findleyr if we have to omit this info from server, could you please suggest, how we should go about it? Considering we may have to implement similar checks for future specs as well.

},
ProtocolVersion: latestProtocolVersion,
ServerInfo: &Implementation{Name: "test", Version: "v1.0.0"},
ServerInfo: testImpl,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to change this.

Can you instead update conformance tests as follows:

  • Update the default server in runServerTest to have icons and website url.
  • Verify that when the client is on an older protocol version, these fields are not sent (existing conformance tests should verify that).
  • Update the logic to accept the protocol version "draft", for testing purposes. See negotiatedVersion. In other words: if the client sends protocol version "draft", we enable draft features. I think this is both necessary and useful for testing.
  • Add a new conformance test that sends protocol version "draft", and verify that it gets icons and website url.

@IAmSurajBobade
Copy link
Contributor Author

modelcontextprotocol/inspector#861 seems to be resolved now. I have tested server with multiple versions (0.16.0, 0.15.0, 0.17.1) of inspector - excluding 0.17.0 - this changes work fine without any errors.

Verify that when the client is on an older protocol version, these fields are not sent (existing conformance tests should verify that).

@findleyr , I actually wanted your input on this. For example, how do we handle older/newer protocol specific behavior throughout the SDK. For instance, if we were to determine client protocol is older, we have to do string compare, will this be a problem, as we need to do this for each initialize and list call. Or should we change the way we are listing protocols from string to may be a costomType int, so the comparison will be straightforward. Additionally, I analyzed the code for other changes required - and it will have considerable impact. For example, currently listTools, listPrompts, listResources methods, do not have direct access to protocol version information.

For now, to avoid updating existing conformance tests - I have added conditional logic to only add icon and websiteUrl info, if test name is version-draft.txtar.

@findleyr
Copy link
Contributor

@IAmSurajBobade you are right, this may be trickier to implement than first thought--I didn't account for the fact that we'd need to suppress these fields from all server features.

Given that clients should ignore extra fields, perhaps it is OK to do nothing. Can you look into how this is done in other SDKs? Do they have special handling for the protocol version? If not, then this CL becomes much simpler.

@IAmSurajBobade
Copy link
Contributor Author

(Just realised, i did not mention this earlier. 🥲) I have checked CSharp, Python, Typescript, Rust SDKs - all of them have implemented draft spec, and there is no special handling basis client version.

Refer 2025-09-18 SDK Implementation (view)

@findleyr
Copy link
Contributor

Ack, thanks @IAmSurajBobade, that's useful. Then I think we can keep it simple. Reviewing now.

protocolVersion20250618 = "2025-06-18"
latestProtocolVersion = protocolVersion20250618

protocolVersionDraft = "draft" // draft protocol version with experimental features for testing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can remove this now, if we're not attempting to gate this functionality on the latest spec.

return nil, incOutput{args.X + 1}, nil
}

var iconObj = Icon{Source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAA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zmQk2RoqBn0tA6gBsev6Vzf40W2CTTKuQO0IebTfCpDkfKgI2WDf+GA/Sn+Bz3ReraStrkl/yXHMAmGLU57HOtryoUfhktwWE60MgMYyNTv+AOge/qqKb4dbD+g/J/AVf65lqU7WK5AAAAAElFTkSuQmCC",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the actual data does not matter, can we please make this "foobar".

I don't want arbitrary, unreviewable data to be checked into the repo (I don't know what this data represents).

s := NewServer(&Implementation{Name: "testServer", Version: "v1.0.0"}, nil)
impl := &Implementation{Name: "testServer", Version: "v1.0.0"}

// TODO(IAmSurajBobade): Remove this hack once we have a client protocol specific handling.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove your self assignment here. We'll probably clean up by adding a more general "settings" file to the test archive.

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.

Implement SEP-973: Icons and metadata support

2 participants