from mcp.server.fastmcp import FastMCP from fastapi import FastAPI from smoldocling.cli import process_files import json # app = FastAPI() mcp = FastMCP("Smoldocling Document Extractor") @mcp.tool() def extract_document(file_path: str) -> dict: """ Extract text and structure from a document at the given file path. Returns a dictionary with the extracted document information as JSON. """ result = process_files([file_path], output_dir=None, output_format="json", verbose=False) return result # app.mount("/mcp", mcp) if __name__ == "__main__": mcp.run(transport='stdio')