Skip to content

SEP: Extension Negotiation #1849

Closed
Closed

Description

@tulshi

Extension Negotiation

Track: Standards
Author: Atul Tulshibagwale
Status: WIP

Changelog

  • 2025-11-21:
    • Using the existing extensions field in the capabilities section rather than defining a new field for requesting and choosing extensions.
    • Clarified that only the latest minor version should be requested or chosen.
    • Clarified how failures can handle the situation where the communication is incompatible with the choice of extensions.
    • Added error response details

Abstract

Extensions specify how an optional behavior may be implemented by an MCP server and client. This SEP specifies how a client and server can agree on using a specific set of extensions during a session.

Motivation

As defined in the extensions SEP, the client and the server declare their support for specific extensions in the ClientCapabilities and ServerCapabilities objects and in the case of the MCP server, it is also specified in the server’s Server Card. However, the extensions SEP does not specify how a client and a server may negotiate the use of one or more specific extensions.

An MCP client may have independent sessions with an MCP server. Each such session might require the use of specific extensions. In the “greetings” example (from the Extension Versioning SEP), the same MCP Client and the same MCP Server may operate on behalf of users from different organizations. One organization may only require the client to do the basic greeting with all MCP servers, whereas another organization may require the same client to perform the basic greeting and the birthday greeting with all MCP servers. There may be situations where the client is capable of doing the birthday greeting, but the server is unable to understand the birthday greeting.

Therefore, on a per-session basis, the client and the server should be able to negotiate which extensions and which versions of the extensions they can use. The client and the server may be coded to support a superset of the extensions that they are able to support in a specific session.

Specification

Requesting Extensions

When an MCP client makes an initialization request to the MCP server, it MAY include the names of the extensions it would like to use in that session. To do this, it only includes the extensions in the capabilities field in the InitializeRequest that it intends to use with the server. If a client supports multiple versions of the same extension, it MUST only include the latest minor version of each major version that it supports. If the client is requesting the use of an extension that is under development (see the SEP for “Extension Versioning”), then it MUST NOT include any other version of the same extension.

For example, if a client supports the “io.modelcontextprotocol/greetings/1.0” and the ”io.modelcontextprotocol/greetings/1.1” extensions, it MUST only include the ”io.modelcontextprotocol/greetings/1.1” in the InitializeRequest, if it wants to use any 1.* version of the Greetings extension.

The following is an example of a well formed request, which requests multiple versions of the same extension:

{
  "capabilities" {
    //...
    "extensions": {
      "io.modelcontextprotocol/greetings/1.1": {},
      "io.modelcontextprotocol/greetings/2.0": { "defaultLanguage": "MR-IN"}
    }
  }
}

Choosing Extensions

In response to an InitializeRequest, the MCP server responds with an InitializeResult that MAY choose the extensions it will use with the client for that session. The MCP server chooses extensions by including the extensions it has chosen to use in the extensions field of the capabilities field of the InitializeResult.

The server MAY choose to omit the extensions field in the InitializeResult. This can happen if the server is unaware of extensions, or determines to not use any extensions with the client, but is still OK with establishing the session with the client.

A server MAY choose extensions that were not requested by the client. This is because the server may require the use of certain extensions, regardless of whether a client requests them.

It is possible that a server is unable to use all extensions requested by the client, even if the server is able to use all of them in that specific session. This can happen, for example, when a client requests the use of multiple major versions of the same extension.

Version Compatibility

Multiple Major Versions

When multiple major versions of the same extension are requested, the server MUST choose the highest mutually-supported version that it can use in the session.

Minor Version

For a specific major version of an extension, if the latest minor version that the server supports is lower than the minor version specified in the request, then the server MAY choose the latest minor version that it supports. If the latest minor version that the server supports is greater than the requested minor version, then:

  1. If the server can support the requested lower minor version, then it MAY choose the requested version.
  2. If the server cannot support the lower minor version, it MUST fail the initialization.

Development Versions

Development versions SHOULD only be chosen if explicitly requested. The server MUST choose the specific development version requested by the client. If the server is unable to choose that version, it MUST fail the initialization.

Successful Session Establishment

If the client and server can continue a session with the extensions specified in the extensions field in capabilities field of the InitializeResult, then the session establishment is successful, and the client and server MUST behave as specified in the chosen extensions.

Session Establishment Failure

A client or server MAY fail the initialization and terminate the session due to incompatibility in extension expectations.

Server Failure

A server MAY fail to initialize the session if:

  • The server requires the use of an extension in the current session, but the prior communication that happened before the InitializeRequest was received, e.g., the way the client authenticated with the server, is incompatible with the required extension.

To fail the initialization, the server:

  1. MUST NOT respond with an InitializeResult to the client
  2. Sends an error notification to the client.

Client Failure

A client MAY terminate the session if:

  • It requested the use of specific extensions in a session, and the extensions field of the capabilities field in the InitializeResult does not contain an extension that it requires for the session to continue.
  • If the server has chosen a specific extension, but the prior communication of the session is incompatible with the choice of extensions.

To terminate a session as a result of extension failure, the client:

  • MUST NOT send the Initialized notification to the server
  • MUST terminate the underlying communication channel with the server.

Error Response

The client and server can send the following error responses to the each to indicate a failure in choosing extensions:

Incompatible Communication

The client or server can send this error to the other party if the required or chosen extension is incompatible with the prior communication of the session:

{
  "message": "Unable to continue because it requires the use of an extension that is incompatible with prior communication of this session",
  "data": {
    "requested": "io.modelcontextprotocol/oauth-client-credentials"
   }
}

Unsupported Extension

The client can send this error to the server, if the server chooses an extension that the client cannot support:

{
  "message": "Client unable to support choice of extensions",
  "data": {
    "unsupported": { "io.modelcontextprotocol/oauth-client-credentials" }
  }
}

Example

Say a client would like to use the “greetings” extension with a server. It prefers using the “greetings/1.1” version, but it is OK to use the “greetings/1.0” extension. The InitializeRequest then includes the extensions field in the capabilities field that has the following content:

"extensions": { "io.modelcontextprotocol/greetings/1.1": {} }

If the server can only use the “greetings/1.0” extension within this specific session, then it responds with an InitializeResult that has a capabilities field with the following extensions field:

"extensions": { "io.modelcontextprotocol/greetings/1.0": {} }

If the server also requires the use of the “oauth-client-credentials” extension, then it responds with:

"extensions": { "io.modelcontextprotocol/oauth-client-credentials/1.0": {}, "io.modelcontextprotocol/greetings/1.0": {} }

If the client cannot support this additional extension (which it did not request), then it terminates the session. However, if it does support the extension, then it can continue the session, but in that case, it MUST behave according to that extension specification.

Rationale

Why negotiation during initialization?

Extension selection must occur before any protocol operations to ensure consistent behavior throughout the session.

Why allow servers to add unrequested extensions?

Servers may require certain extensions for compliance, security, or operational reasons.

Why preference ordering?

Allows clients to express priorities when multiple compatible versions exist.

What happens if a chosen extension is incompatible with the way the communication has been set up?

The server can fail the initialization if it requires the use of a particular extension, and the way the prior communication of the session has taken place is incompatible with that extension. The client can terminate the session if the server chooses an extension that is incompatible with the way the prior communication of the session has taken place.

Backward Compatibility

This SEP is fully backward compatible:

  • Clients that don't support extension negotiation can omit extensions in the InitializeRequest
  • Servers that don't support extension negotiation can omit extensions in the InitializeResult
  • The session can continue normally without extensions if both parties do not require them
  • Existing MCP implementations continue to work unchanged

Security Considerations

  • Servers MUST validate that requested extensions come from trusted sources
  • Extension names MUST be validated against the pattern defined in the Extension Versioning SEP
  • Clients MUST validate server-chosen extensions against their security policies

Activity

  1. added
    enhancement
    on Nov 19, 2025
  2. pja-ant commented on Nov 21, 2025

    @pja-ant
    Contributor

    This makes sense for some forms of extensions, but one of the reasons I somewhat punted on specifying negotiation approaches for extensions is that I'm not sure this really works in general for some of the kinds of extensions we're imagining.

    For example:

    For extensions that are introducing new post-init features then yes this should work, but what do we do about the other extensions? Does this negotiation not apply to them? When do we say that the negotiation applies and when it does not?

    Assuming we do want to proceed with using something like this on a subset of extensions where it makes set, I think we'd want to specify version constraints using standard package manager constraints.

    Using you example:

    requestedExtensions: ["io.modelcontextprotocol/greetings/1.1", "io.modelcontextprotocol/greetings/1.0"]
    

    doing this would be very tedious if you supported all 1.x versions (which you should, that's the whole point of backwards compatibility on minor versions!). The original SEP only had major versions for this reason: they're the only ones you actually care about.

    If we want to keep minor versions then probably you want something like https://gist.github.com/jonlabelle/706b28d50ba75bf81d40782aa3c84b3e - though not sure we need the whole complexity of that.

  3. tulshi commented on Nov 21, 2025

    @tulshi
    Author

    Hi @pja-ant, thanks for the feedback. I'll review your feedback in detail tomorrow, but just quickly, the server can fail the connection if the way the client has established the session is incompatible with a required extension.

  4. tulshi commented on Nov 22, 2025

    @tulshi
    Author

    Hey @pja-ant , I've taken a slightly different approach here, so that we don't replicate what is in the "capabilities" field again as a standalone "extensions" field. I've addressed both your comments above, and the negotiation related comment in the Versioning SEP.

  5. pja-ant commented on Nov 26, 2025

    @pja-ant
    Contributor

    Why allow servers to add unrequested extensions?

    A problem with this is that it makes extension negotiation a multiple-round-trip process. In a stateless setup, the extensions the server sends back to the client has no value since they'll be forgotten by the next message. I know it isn't actually legal in the current spec to skip initialization... but many production servers do. There's a good chance we standardize this soon in some form (moving capabilities into every request).

    The use case is valid though: the server may require something without the client requiring it.

    I feel this comes down to a distinction between what extensions the client requests versus what the client supports. At the risk of overcomplicating things, it feels like there's a range of declarations here:

    1. Client requires an extension: e.g. my client only supports foo/1.0 and will fail without it.
    2. Client requests an extension: e.g. my client would like to use foo/1.0, but it's ok if the server doesn't support it.
    3. Client supports an extension: e.g. my client can use foo/1.0 IF the server asks for it, but it's also ok if the server doesn't support it.

    Then the same applies for servers: they may have extensions that they require/request/support.

    It could get further complicated still: what if some extensions are only needed for certain tools? (Not that far-fetched: MCP Apps likely only apply to a subset of tools). This actually applies to capabilities as well, and it's something we haven't really solved: i.e. what happens if a tool call requires elicitations but the client doesn't support it? I guess you just fail the tool call, but it would have been nice to have disabled the tool entirely. This isn't captured in the protocol, but I guess servers are allowed to filter tools/list based on client capabilities (probably...).

    I'm starting to lean back towards my initial position of just letting extensions define their own negotiation semantics, i.e. we provide this place in the protocol (capabilities/extensions/...) for extensions to put any necessary negotiation metadata and then the extension itself defines what it means to do negotiation.

    A few examples of what this could look like on more realistic extensions:

    1. oauth-client-credentials: this all happens outside of the MCP message flow, so the extension just defines how the auth flow works and any backwards compatibility requirements. There's no value in using capabilities/extensions/... at all.
    2. ext-apps: has negotiation language already and has more nuance about enabling different tools based on capabilities exposed in the extensions section.
    3. A new transport: this would also need to happen outside of the MCP message flow. For example if we were to introduce Websockets then that extension would need to define a quite specific negotiation flow where e.g. clients
    4. Interceptors (a possible new extension): this also has quite a unique deployment style that wouldn't involve client/server negotiation.

    Looking at all this, I'm quite worried that the design of the negotiation isn't really fitting with what we're seeing from real upcoming extensions. Curious to hear your thoughts.

  6. tulshi commented on Dec 1, 2025

    @tulshi
    Author

    Hi @pja-ant ,
    Here are a few thoughts:

    • Stateless: There can probably be no negotiation in a stateless protocol, so if we're thinking of going stateless (for other reasons), then we will have to assume that there is no ability to negotiate extensions. The rest of this comment assumes we aren't going stateless.
    • Required / requested / supported: We could use the server's Server Card to specify what it supports, and within those, what it requires. The client doesn't advertise what it supports, but it requests based on what it supports / requires, and its reading of the Server Card. The list of extensions in the server's InitializeResult are still the chosen ones. If that is unacceptable to the client then the negotiation fails. BTW, we have a similar capability in the OpenID Shared Signals Framework for events. See "events_supported", "events_requested", "events_delivered" etc. here
    • Multi-roundtrip: The above scheme reduces the need for multi-roundtrip negotiation (i.e. the client will know in advance from the server card, and can act accordingly).
    • Per-tool capabilities / extensions: One possible way is that the "tools/list" call could potentially specify which extensions are required for each tool (similar to how it can specify what parameters it requires). The client can terminate the connection after the list tools call if it doesn't think it can proceed.
    • Specific extension related issues:
      • Client credentials: If we use Server Cards to advertise the required extensions, then that is still helpful. In that case, there's probably no value in including that extension after the channel has been established.
      • Ext-apps: I suppose you are referring to this section? As stated, that is achievable through this negotiation mechanism with a slight modification. I.e., we could have parameters to the extensions that are requested or chosen.
      • Interceptors: I think this is more like a feature that alters internal client and server behavior, rather than being an extension on its own. I would consider it orthogonal to the extensions being used / negotiated. Maybe I'm wrong here, but please clarify.
  7. ragsvasan commented on Apr 21, 2026

    @ragsvasan
  8. localden commented on Jun 24, 2026

    @localden
    Contributor

    @tulshi closing this as SEPs have since moved to pull requests. If this is still a relevant project to pursue, feel free to create a new SEP PR and build support in our contributor Discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions