You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Note**: SSE transport is being superseded by [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
464
+
392
465
You can mount the SSE server to an existing ASGI server using the `sse_app` method. This allows you to integrate the SSE server with other ASGI applications.
For more information on mounting applications in Starlette, see the [Starlette documentation](https://www.starlette.io/routing/#submounting-routes).
414
524
415
525
## Examples
@@ -584,7 +694,7 @@ if __name__ == "__main__":
584
694
585
695
### Writing MCP Clients
586
696
587
-
The SDK provides a high-level client interface for connecting to MCP servers:
697
+
The SDK provides a high-level client interface for connecting to MCP servers using various [transports](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports):
588
698
589
699
```python
590
700
from mcp import ClientSession, StdioServerParameters, types
@@ -648,6 +758,28 @@ if __name__ == "__main__":
648
758
asyncio.run(run())
649
759
```
650
760
761
+
Clients can also connect using [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http):
762
+
763
+
```python
764
+
from mcp.client.streamable_http import streamablehttp_client
765
+
from mcp import ClientSession
766
+
767
+
768
+
asyncdefmain():
769
+
# Connect to a streamable HTTP server
770
+
asyncwith streamablehttp_client("example/mcp") as (
771
+
read_stream,
772
+
write_stream,
773
+
_,
774
+
):
775
+
# Create a session using the client streams
776
+
asyncwith ClientSession(read_stream, write_stream) as session:
# Simple MCP Server with GitHub OAuth Authentication
2
+
3
+
This is a simple example of an MCP server with GitHub OAuth authentication. It demonstrates the essential components needed for OAuth integration with just a single tool.
4
+
5
+
This is just an example of a server that uses auth, an official GitHub mcp server is [here](https://github.com/github/github-mcp-server)
6
+
7
+
## Overview
8
+
9
+
This simple demo to show to set up a server with:
10
+
- GitHub OAuth2 authorization flow
11
+
- Single tool: `get_user_profile` to retrieve GitHub user information
12
+
13
+
14
+
## Prerequisites
15
+
16
+
1. Create a GitHub OAuth App:
17
+
- Go to GitHub Settings > Developer settings > OAuth Apps > New OAuth App
18
+
- Application name: Any name (e.g., "Simple MCP Auth Demo")
0 commit comments