23
23
try :
24
24
# Preferred high-level API (if available)
25
25
from mcp .server .fastmcp import FastMCP # type: ignore
26
+
26
27
_FASTMCP_AVAILABLE = True
27
28
except Exception :
28
29
_FASTMCP_AVAILABLE = False
33
34
from mcp .server .stdio import stdio_server # type: ignore
34
35
35
36
36
-
37
37
client = Client ()
38
38
39
39
@@ -48,7 +48,7 @@ def _web_fetch_impl(url: str) -> Dict[str, Any]:
48
48
49
49
50
50
if _FASTMCP_AVAILABLE :
51
- app = FastMCP (" ollama-search-fetch" )
51
+ app = FastMCP (' ollama-search-fetch' )
52
52
53
53
@app .tool ()
54
54
def web_search (query : str , max_results : int = 3 ) -> Dict [str , Any ]:
@@ -79,11 +79,11 @@ def web_fetch(url: str) -> Dict[str, Any]:
79
79
80
80
return _web_fetch_impl (url = url )
81
81
82
- if __name__ == " __main__" :
82
+ if __name__ == ' __main__' :
83
83
app .run ()
84
84
85
85
else :
86
- server = Server (" ollama-search-fetch" ) # type: ignore[name-defined]
86
+ server = Server (' ollama-search-fetch' ) # type: ignore[name-defined]
87
87
88
88
@server .tool () # type: ignore[attr-defined]
89
89
async def web_search (query : str , max_results : int = 3 ) -> Dict [str , Any ]:
@@ -112,6 +112,5 @@ async def _main() -> None:
112
112
async with stdio_server () as (read , write ): # type: ignore[name-defined]
113
113
await server .run (read , write ) # type: ignore[attr-defined]
114
114
115
- if __name__ == " __main__" :
115
+ if __name__ == ' __main__' :
116
116
asyncio .run (_main ())
117
-
0 commit comments