google_calendar_mcp.py•1.63 kB
from dotenv import load_dotenv
from fastmcp import FastMCP
from .tools.calendar_tools import list_calendars, get_events, create_event, delete_event
load_dotenv()
def setup_mcp_server():
mcp = FastMCP("Google Calendar MCP Server")
mcp.tool(description="利用可能なGoogleカレンダーの一覧を取得します。引数なし。戻り値: success(bool), calendars(List[Dict]), count(int), error(str)")(
list_calendars
)
mcp.tool(description="指定したカレンダーからイベントを取得します。引数: calendar_id(str, デフォルト:'primary'), time_min(str, デフォルト:現在時刻), time_max(str, デフォルト:7日後), max_results(int, デフォルト:10)。戻り値: success(bool), events(List[Dict]), count(int), error(str)")(
get_events
)
mcp.tool(description="新しいカレンダーイベントを作成します。引数: summary(str, 必須), start_time(str, 必須, ISO形式), end_time(str, 必須, ISO形式), description(str, デフォルト:''), location(str, デフォルト:''), calendar_id(str, デフォルト:'primary'), attendees(List[str], デフォルト:None)。戻り値: success(bool), event_id(str), event_link(str), message(str), error(str)")(
create_event
)
mcp.tool(description="カレンダーイベントを削除します。引数: event_id(str, 必須), calendar_id(str, デフォルト:'primary')。戻り値: success(bool), message(str), error(str)")(
delete_event
)
return mcp
def main():
mcp = setup_mcp_server()
mcp.run()
if __name__ == "__main__":
main()