Skip to content

Add example for stateless server with JSON response#704

Merged
ihrpr merged 3 commits into
modelcontextprotocol:mainfrom
5enxia:main
May 15, 2025
Merged

Add example for stateless server with JSON response#704
ihrpr merged 3 commits into
modelcontextprotocol:mainfrom
5enxia:main

Conversation

@5enxia

@5enxia 5enxia commented May 13, 2025

Copy link
Copy Markdown
Contributor

Add example for stateless server with JSON response

Motivation and Context

There was no documentation on how to use it.

How Has This Been Tested?

I haven not tested due to only changes in documentation.

Breaking Changes

No

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

ihrpr
ihrpr previously approved these changes May 14, 2025

@ihrpr ihrpr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thank you!

@ihrpr

ihrpr commented May 14, 2025

Copy link
Copy Markdown
Contributor

The test needs to be fixed before merging:

____________________ test_docs_examples[README.md:394-408] _____________________
black failed:
  --- before
  +++ after
  @@ -398,404 +398,404 @@
   mcp = FastMCP("StatefulServer")
 
   # Stateless server (no session persistence)
   mcp = FastMCP("StatelessServer", stateless_http=True)
 
  -# Stateless server (no session persistence, no sse stream with supported client) 
  +# Stateless server (no session persistence, no sse stream with supported client)
   mcp = FastMCP("StatelessServer", stateless_http=True, json_response=True)
 
   # Run server with streamable_http transport
   mcp.run(transport="streamable-http")

                              Summary of Failures                               
┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃  File           ┃  Function       ┃  Function Line  ┃  Error Line  ┃  Error  ┃
┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━┩
│  tests/test_e…  │  test_docs_ex…  │  [76](https://github.com/modelcontextprotocol/python-sdk/actions/runs/14996876491/job/42133173327?pr=704#step:5:77)             │              │         │
└─────────────────┴─────────────────┴─────────────────┴──────────────┴─────────┘
Results (9.18s):
         1 failed
       297 passed
         1 skipped

@5enxia

5enxia commented May 14, 2025

Copy link
Copy Markdown
Contributor Author

Thank you for your review!
Sorry, I didn't know tests for docs.
I fixed it!

@ihrpr ihrpr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thank you!

@ihrpr
ihrpr merged commit 0a388b6 into modelcontextprotocol:main May 15, 2025
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