FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-sdk/docs_src/asgi/tutorial006.py at main · modelcontextprotocol/python-sdk · GitHub
modelcontextprotocol
python-sdk
Repository navigation
Code
Issues
246
(246)
Pull requests
106
(106)
Actions
Projects
Security and quality
12
(12)
Insights
Expand file tree
Breadcrumbs
python-sdk
/
docs_src
/
asgi
/
tutorial006.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (12 loc) · 423 Bytes
Breadcrumbs
python-sdk
/
docs_src
/
asgi
/
tutorial006.py
Copy path
File metadata and controls
20 lines (12 loc) · 423 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from
starlette
.
requests
import
Request
from
starlette
.
responses
import
JSONResponse
,
Response
from
mcp
.
server
import
MCPServer
mcp
=
MCPServer
(
"Notes"
)
@
mcp
.
tool
()
def
add_note
(
text
:
str
)
->
str
:
"""Save a note."""
return
f"Saved:
{
text
}
"
@
mcp
.
custom_route
(
"/health"
,
methods
=
[
"GET"
])
async
def
health
(
request
:
Request
)
->
Response
:
return
JSONResponse
({
"status"
:
"ok"
})
app
=
mcp
.
streamable_http_app
()
Back
|
FazBrowse Home
|
New Git URL