MCP Transport Streamable HTTP
- This mechanism suggests is designed to support over standard HTTP infrastructure
- request/response
- streaming responses
- bi-directional event-style communication
- tool execution progress
- long-running opertions
Building simple mcp server with Streamable http transport
-
Watch the video for steps
-
Create a simple python project with server.py, ensure
mcp[cli]package is added to venv
from mcp.server.fastmcp import FastMCP
mcp = FastMCP(
name="streamable-mcp-demo",
host="localhost",
port=18000,
)
@mcp.tool(name="add")
def add(a: int, b: int) -> int:
"""Add two numbers together."""
return a + b
if __name__ == "__main__":
mcp.run(transport="streamable-http")
- Now create a launch configuration
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
- Now start debugging
-
open a new terminal and execute
npx @modelcontextprotocol/inspector

-
Refer Here for changes
Lets Build our library mcp-server
- Refer Here for the changes done
- Refer Here for complete code of library-mcp implemented so far
