first commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
from summary_mcp.core.pipeline import extract_content
|
||||
from summary_mcp.models.item import Item
|
||||
from summary_mcp.models.summary_io import ExtractionInput
|
||||
|
||||
|
||||
mcp = FastMCP(name="content-extract-mcp")
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def extract_url_content(url: str, language_hint: str | None = None) -> dict:
|
||||
"""Extract structured article content from a single URL."""
|
||||
result = extract_content(
|
||||
ExtractionInput(
|
||||
url=url,
|
||||
language_hint=language_hint,
|
||||
)
|
||||
)
|
||||
return result.model_dump(mode="json")
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
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)
|
||||
)
|
||||
return result.model_dump(mode="json")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
mcp.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user