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
+
365
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).
387
524
388
525
## Examples
@@ -557,7 +694,7 @@ if __name__ == "__main__":
557
694
558
695
### Writing MCP Clients
559
696
560
-
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):
561
698
562
699
```python
563
700
from mcp import ClientSession, StdioServerParameters, types
@@ -621,6 +758,28 @@ if __name__ == "__main__":
621
758
asyncio.run(run())
622
759
```
623
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