feat: add freshrss openclaw pipeline and clean repo

This commit is contained in:
zhuyongxin
2026-03-26 16:48:19 +08:00
parent 27fe1e8882
commit 100044e1f7
143 changed files with 1776 additions and 7293 deletions
+68 -4
View File
@@ -1,4 +1,9 @@
from __future__ import annotations
from __future__ import annotations
import json
import tempfile
from datetime import date
from pathlib import Path
from mcp.server.fastmcp import FastMCP
@@ -9,6 +14,7 @@ from summary_mcp.models.filtering import FilterContext, FilterInput
from summary_mcp.models.item import Item
from summary_mcp.models.llm_result import LlmSummaryResult
from summary_mcp.models.summary_io import ExtractionInput
from summary_mcp.workflows import run_freshrss_pipeline
mcp = FastMCP(name="content-extract-mcp")
@@ -30,9 +36,7 @@ def extract_url_content(url: str, language_hint: str | None = None) -> dict:
def extract_item_content(item: dict) -> dict:
"""Extract structured article content from a normalized item object."""
parsed_item = Item.model_validate(item)
result = extract_content(
ExtractionInput(item=parsed_item)
)
result = extract_content(ExtractionInput(item=parsed_item))
return result.model_dump(mode="json")
@@ -61,6 +65,66 @@ def filter_summary_result(
return decision.model_dump(mode="json")
@mcp.tool()
def run_freshrss_openclaw_pipeline(
limit: int = 5,
mark_read: bool = False,
include_read: bool = False,
debug_artifacts: bool = False,
continuation: str | None = None,
timeout_seconds: float = 60.0,
max_retries: int = 2,
stream_id: str = "user/-/state/com.google/reading-list",
api_base_url: str | None = None,
username: str | None = None,
api_password: str | None = None,
llm_api_key: str | None = None,
llm_model: str | None = None,
llm_api_url: str | None = None,
context: dict | None = None,
run_id: str | None = None,
date_value: str | None = None,
output_dir: str | None = None,
include_item_reports: bool = False,
) -> dict:
"""Run the full FreshRSS -> extract -> LLM -> filter -> OpenClaw payload pipeline."""
temp_context_path: Path | None = None
try:
if context is not None:
with tempfile.NamedTemporaryFile("w", encoding="utf-8", suffix=".json", delete=False) as handle:
json.dump(context, handle, ensure_ascii=False, indent=2)
temp_context_path = Path(handle.name)
result = run_freshrss_pipeline(
api_base_url=api_base_url,
username=username,
api_password=api_password,
stream_id=stream_id,
limit=limit,
continuation=continuation,
include_read=include_read,
mark_read=mark_read,
debug_artifacts=debug_artifacts,
context_path=temp_context_path,
max_retries=max_retries,
timeout_seconds=timeout_seconds,
llm_api_key=llm_api_key,
llm_model=llm_model,
llm_api_url=llm_api_url,
run_id=run_id,
delivery_date=date.fromisoformat(date_value) if date_value else None,
output_dir=Path(output_dir) if output_dir else None,
)
finally:
if temp_context_path and temp_context_path.exists():
temp_context_path.unlink()
if not include_item_reports:
result = {key: value for key, value in result.items() if key != "items"}
return result
def main() -> None:
mcp.run()