Model Context Protocol (MCP) 1 · Python server
Expose a resource
Share read-only data that clients can load into context, here with a URI template.
@mcp.resource("greeting://{name}")
def greeting(name: str) -> str:
"""Greet someone by name."""
return f"Hello, {name}!"
Official Model Context Protocol (MCP) 1 documentation
More python server commands
- Install the Python SDK
- Create a Python server with a tool
- Expose a prompt template
- Serve over HTTP
- Log without breaking stdio
- Test with the dev server
All python server commands · Model Context Protocol (MCP) 1 cheatsheet