Skip to content

Commit e3af57e

Browse files
committed
Fix log level validation error preventing server startup
- Add import os statement - Set LOG_LEVEL environment variable to 'INFO' by default - Pass explicit log_level='INFO' parameter to FastMCP constructor This fixes the ValueError: Invalid log level: info. Expected one of: ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] that prevents the server from starting when FastMCP receives lowercase log levels.
1 parent ad4b139 commit e3af57e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pymupdf4llm_mcp/app.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
import os
12
from pathlib import Path
23
from typing import Annotated, Any
34

45
import pymupdf4llm
56
from mcp.server.fastmcp import FastMCP
67
from pydantic import Field
78

8-
mcp = FastMCP("pymupdf4llm-mcp")
9+
# Fix: Set environment variable and explicit log level to prevent validation error
10+
os.environ.setdefault('LOG_LEVEL', 'INFO')
11+
mcp = FastMCP("pymupdf4llm-mcp", log_level='INFO')
912

1013

1114
@mcp.tool(
@@ -73,4 +76,4 @@ def convert_pdf_to_markdown(
7376
return {
7477
"error": f"Failed to convert PDF to markdown: {e!s}",
7578
"success": False,
76-
}
79+
}

0 commit comments

Comments
 (0)