You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.0 KiB
Python
67 lines
2.0 KiB
Python
from __future__ import annotations
|
|
|
|
from mcp.server.fastmcp import Context, FastMCP
|
|
|
|
from app.config import get_settings
|
|
from app.mcp.tools import (
|
|
check_availability as check_availability_impl,
|
|
execute_unsubscribe as execute_unsubscribe_impl,
|
|
list_unsubscribe_candidates as list_unsubscribe_candidates_impl,
|
|
scan_mailbox as scan_mailbox_impl,
|
|
)
|
|
|
|
settings = get_settings()
|
|
mcp = FastMCP(
|
|
"Personal Agent MCP",
|
|
streamable_http_path="/",
|
|
)
|
|
|
|
|
|
@mcp.tool(description="Check Google Calendar availability for a time range.")
|
|
def check_availability(
|
|
start: str,
|
|
end: str,
|
|
calendar_ids: list[str] | None = None,
|
|
ctx: Context | None = None,
|
|
) -> dict[str, object]:
|
|
return check_availability_impl(
|
|
start=start,
|
|
end=end,
|
|
calendar_ids=calendar_ids,
|
|
ctx=ctx,
|
|
)
|
|
|
|
|
|
if settings.mcp_enable_mutation_tools:
|
|
|
|
@mcp.tool(
|
|
description="Scan unread root-inbox Gmail messages and apply classification labels."
|
|
)
|
|
def scan_mailbox(max_results: int = 100, ctx: Context | None = None) -> dict[str, object]:
|
|
return scan_mailbox_impl(max_results=max_results, ctx=ctx)
|
|
|
|
@mcp.tool(
|
|
description="List unsubscribe candidates discovered from advertising emails."
|
|
)
|
|
def list_unsubscribe_candidates(
|
|
max_results: int = 500,
|
|
ctx: Context | None = None,
|
|
) -> dict[str, object]:
|
|
return list_unsubscribe_candidates_impl(max_results=max_results, ctx=ctx)
|
|
|
|
@mcp.tool(
|
|
description="Execute unsubscribe actions for selected candidate IDs."
|
|
)
|
|
def execute_unsubscribe(
|
|
selected_candidate_ids: list[str],
|
|
max_results: int = 500,
|
|
remember_selection: bool = True,
|
|
ctx: Context | None = None,
|
|
) -> dict[str, object]:
|
|
return execute_unsubscribe_impl(
|
|
selected_candidate_ids=selected_candidate_ids,
|
|
max_results=max_results,
|
|
remember_selection=remember_selection,
|
|
ctx=ctx,
|
|
)
|