"""
Transport => mcp 프로토콜의 하위 protocol로는 stdio 와 sse 가 지원된다.
"""
from mcp.server.fastmcp import FastMCP
if __name__ == "__main__":
mcp = FastMCP(
"example-mcp",
"This is an example MCP server.",
host="0.0.0.0",
port=8080,
debug=True
)
mcp.run(transport="sse")
from mcp.server.fastmcp import FastMCP
if __name__ == "__main__":
mcp = FastMCP(
"example-mcp",
"This is an example MCP server.",
host="0.0.0.0",
port=8080,
debug=True
)
mcp.sse_app().add_route("/custom_route", ) ### 엔드 포인 트 확장
mcp.run(transport="sse")

좀더, 응용하면 mcp-server 에서도 mcp-client 에서 설정 정보로부터
api token을 받고 llm api 호출을 할 수 있다는 것을 알 수 있다.
if __name__ == "__main__":
mcp = FastMCP(
"example-mcp",
"This is an example MCP server.",
host="0.0.0.0",
port=8080,
debug=True
)
.
.
def handler(request) :
.
.
.
mcp.sse_app().add_route("/workflow", handler)
mcp.run(transport="sse")
위와 같은 예제로 엔드포인트를 확장하면, llm api(openai-api등) 토큰을 받아서 mcp-server 가 LangGraph 의 workflow를 호출할 수 있다.
(mcp에서 LangGraph와 같은 workflow 또는 agent 기능에 대한 프로토콜은 정해지지 않았기 때문에 대체할 방법은 없는 것 같다..)
