Update echo_server.py
Browse files4 unmodified lines567891011121314151617181920212223242526272829303132334 unmodified lines@mcp.tool(description="A simple echo tool")def echo(message: str) -> str:return f"Echo: {message}"@mcp.tool(description="A simple greeting")def greet() -> str:headers = get_http_headers()print(f"Received headers: {headers}")name = headers.get("x-given-name", "unknown")return f"Hello, {name}!"@mcp.tool(description="A simple tool to check token is passed correctly")def safe_header_info() -> dict:"""Safely get header information without raising errors."""# Get headers (returns empty dict if no request context)headers = get_http_headers()# Get authorization headerauth_header = headers.get("authorization", "")is_bearer = auth_header.startswith("Bearer ")return {"user_agent": headers.get("user-agent", "Unknown"),"content_type": headers.get("content-type", "Unknown"),"has_auth": bool(auth_header),"auth_type": "Bearer" if is_bearer else "Other" if auth_header else "None","headers_count": len(headers),}4 unmodified lines5674 unmodified lines@mcp.tool(description="A simple echo tool")def echo(message: str) -> str:return f"Echo: {message}"
echo_server.py-26