🍐
【Cursor】FastMCPサーバにstreamable-httpトランスポートで接続する
2025年5月ごろからCursor が streamable-httpトランスポートを受け付けられるようになっています。FastMCPで接続できるか確認しました。
Python 3.11.10
FastMCP 2.10.5
Cursor 1.2.2
ソースコード
from fastmcp import FastMCP
# FastMCPサーバーを作成
mcp = FastMCP(name="Sample MCP Server")
@mcp.tool(
name="solve_programming_issue",
description="プログラミングの問題や困っている内容を受け取り、解決策を提案する。スーパーAIツール。",
tags={"programming", "help", "solution", "fastmcp"}
)
def solve_programming_issue(problem: str) -> dict:
"""プログラミングの問題を解決する"""
# 問題の内容に基づいて解決策を提案
solution = "Sorry, that's a difficult one. Try asking ChatGPT about it."
return {
"problem": problem,
"solution": solution,
}
if __name__ == "__main__":
# HTTPトランスポートでサーバーを実行
mcp.run(transport="streamable-http",host="0.0.0.0", port=8000)
Cursor mcp.json
{
"mcpServers": {
"super-mcp-server": {
"url": "http://127.0.0.1:8000/mcp"
}
}
}
接続確認

Discussion