Skip to content

Conversation

@the-ayyi
Copy link

@the-ayyi the-ayyi commented Dec 17, 2025

This PR is based on another draft PR.

Core Type Changes

  • src/mcp/types.py: Added description: str | None field to Implementation class

Server Model Changes

  • src/mcp/server/models.py: Added title and description fields to InitializationOptions

Low-Level Server Changes

  • src/mcp/server/lowlevel/server.py:
    • Updated Server.__init__() to accept title and description parameters
    • Updated create_initialization_options() to include these fields

Session Changes

  • src/mcp/server/session.py: Updated to pass title and description to serverInfo in InitializeResult

FastMCP Changes

  • src/mcp/server/fastmcp/server.py:
    • Added title and description parameters to __init__()
    • Added @property methods for read access
    • Passes values through to underlying MCPServer

Github-Issue:#1783

Motivation and Context

The MCP specification defines an Implementation schema (used for both clientInfo and serverInfo in initialization) that includes both title and description fields for providing human-readable metadata to MCP hosts. However, the Python SDK had several gaps:

  1. Missing description field: While Implementation inherited title from BaseMetadata, it was missing the description field entirely, even though the MCP spec supports it.

  2. Server initialization limitations: The server only accepted InitializationOptions which didn't support setting title or description, making it impossible for servers to provide this metadata to clients.

  3. Inconsistent support: Clients could at least set title via clientInfo (an Implementation object), but servers had no way to set either field.

This PR addresses the server-side implementation, allowing MCP servers to provide human-readable titles and descriptions that can be displayed by MCP hosts in their user interfaces, improving the user experience when working with multiple MCP servers.

How Has This Been Tested?

Tests

  • tests/server/test_session.py: Added test for low-level server title/description
  • tests/server/fastmcp/test_server.py: Added tests for FastMCP with and without title/description

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@the-ayyi the-ayyi marked this pull request as ready for review December 17, 2025 23:50
@the-ayyi the-ayyi marked this pull request as draft December 17, 2025 23:50
@the-ayyi the-ayyi force-pushed the feat/server-client-title-description-1783 branch 3 times, most recently from b832792 to c6247a6 Compare December 18, 2025 00:20
@the-ayyi the-ayyi marked this pull request as ready for review December 18, 2025 00:21
@the-ayyi the-ayyi force-pushed the feat/server-client-title-description-1783 branch from c6247a6 to 39145f3 Compare December 18, 2025 08:06
async def message_handler(
message: RequestResponder[types.ServerRequest, types.ClientResult] | types.ServerNotification | Exception,
) -> None:
if isinstance(message, Exception): # pragma: no cover
Copy link
Contributor

Choose a reason for hiding this comment

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

remove all pragmas from the test suite, instead use asserts

Copy link
Author

Choose a reason for hiding this comment

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

Since those pragmas are already used extensively throughout this file, removing them all would significantly expand the scope of this PR. I'm happy to stick to the 'no new pragmas' rule for this change to keep the focus on the title and description support.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry yea that is what I mean, just removing the ones you added, not the existing one!

@maxisbey maxisbey added improves spec compliance When a change improves ability of SDK users to comply with spec definition P3 Nice to haves, rare edge cases labels Dec 18, 2025
@the-ayyi the-ayyi force-pushed the feat/server-client-title-description-1783 branch from 39145f3 to 777141e Compare December 18, 2025 22:27
@the-ayyi the-ayyi marked this pull request as draft December 18, 2025 23:46
@the-ayyi the-ayyi force-pushed the feat/server-client-title-description-1783 branch 3 times, most recently from 555e72e to ee18a6f Compare December 19, 2025 01:13
@the-ayyi the-ayyi force-pushed the feat/server-client-title-description-1783 branch from ee18a6f to e05c684 Compare December 19, 2025 01:14
@the-ayyi the-ayyi marked this pull request as ready for review December 19, 2025 01:15
if present).
"""

description: str | None = None
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't have a description field, only Implementation should. Check the spec schema here: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/6e924e6f587f30aa810325c0985e2da0b257d4eb/schema/draft/schema.ts#L526

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

Labels

improves spec compliance When a change improves ability of SDK users to comply with spec definition P3 Nice to haves, rare edge cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants