suse-documentation-mcp-server 0.28.0__py3-none-any.whl → 0.29.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- server/search_suse_documentation.py +49 -26
- suse_documentation_mcp_server-0.29.0.dist-info/METADATA +9 -0
- suse_documentation_mcp_server-0.29.0.dist-info/RECORD +6 -0
- suse_documentation_mcp_server-0.28.0.dist-info/METADATA +0 -11
- suse_documentation_mcp_server-0.28.0.dist-info/RECORD +0 -6
- {suse_documentation_mcp_server-0.28.0.dist-info → suse_documentation_mcp_server-0.29.0.dist-info}/WHEEL +0 -0
- {suse_documentation_mcp_server-0.28.0.dist-info → suse_documentation_mcp_server-0.29.0.dist-info}/entry_points.txt +0 -0
- {suse_documentation_mcp_server-0.28.0.dist-info → suse_documentation_mcp_server-0.29.0.dist-info}/top_level.txt +0 -0
@@ -1,11 +1,11 @@
|
|
1
|
-
import
|
2
|
-
import re
|
1
|
+
import asyncio
|
3
2
|
import os
|
3
|
+
import sys
|
4
|
+
import time
|
5
|
+
|
6
|
+
import httpx
|
4
7
|
from dotenv import load_dotenv
|
5
|
-
from typing import Dict, Any
|
6
8
|
from mcp.server.fastmcp import FastMCP
|
7
|
-
from pydantic import Field
|
8
|
-
from concurrent.futures import ThreadPoolExecutor
|
9
9
|
|
10
10
|
load_dotenv()
|
11
11
|
|
@@ -13,7 +13,40 @@ base_url = os.getenv("OI_API_BASE", "") + "/api/v1/retrieval/process/web"
|
|
13
13
|
authorization_token = os.getenv("OI_API_TOKEN", "")
|
14
14
|
|
15
15
|
# Initialize FastMCP server
|
16
|
-
mcp = FastMCP(
|
16
|
+
mcp = FastMCP(
|
17
|
+
"web-search",
|
18
|
+
prompt="""
|
19
|
+
# Web Search MCP Server
|
20
|
+
|
21
|
+
This server provides tools for searching the web using Open WebUI Web search API.
|
22
|
+
It allows you to search web for given search query.
|
23
|
+
|
24
|
+
## Available Tools
|
25
|
+
|
26
|
+
### 1. get_web_search_results
|
27
|
+
Use this tool to search web to gather information about SUSE, Rancher products and projects.
|
28
|
+
|
29
|
+
Example: "HOw to setup Nvidia GPU in RKE2?" or
|
30
|
+
"Does Rancher Desktop support Wasm"
|
31
|
+
|
32
|
+
## Guidelines for Use
|
33
|
+
|
34
|
+
- Always perform a web search even if you think you know the answer
|
35
|
+
- Use the most relevant and specific keywords for your search
|
36
|
+
- Keep queries concise and specific for best results
|
37
|
+
|
38
|
+
## Output Format
|
39
|
+
|
40
|
+
All search results will be formatted as text with clear sections for each
|
41
|
+
result item, including:
|
42
|
+
|
43
|
+
- URL: The link to the source of the information
|
44
|
+
- Content: A brief summary or excerpt from the page
|
45
|
+
|
46
|
+
If the API call fails for any reason, appropriate error messages will be
|
47
|
+
returned.
|
48
|
+
""",
|
49
|
+
)
|
17
50
|
|
18
51
|
def clean_content(content):
|
19
52
|
# Remove excessive blank lines
|
@@ -74,34 +107,25 @@ def get_web_search_results_from_oi(query):
|
|
74
107
|
combined_response += f"Source: {filename}\n\nContent:\n{cleaned_content}\n\n"
|
75
108
|
|
76
109
|
return combined_response
|
77
|
-
|
110
|
+
|
78
111
|
@mcp.tool()
|
79
112
|
async def get_web_search_results(
|
80
|
-
|
81
|
-
description="A dictionary containing a single key 'queries' with a string value representing the search query.",
|
82
|
-
),
|
113
|
+
query: str
|
83
114
|
) -> str:
|
115
|
+
"""Performs a web search using the Open WebUI web search API.
|
116
|
+
|
117
|
+
Args:
|
118
|
+
query: Search query (required)
|
84
119
|
"""
|
85
|
-
|
86
|
-
Use for general search and when the user explicitly tells you to 'fetch' results/information.
|
87
|
-
"""
|
88
|
-
print("Entered get_web_search_results with payload:", payload)
|
120
|
+
print("Entered get_web_search_results with payload:", query)
|
89
121
|
|
90
|
-
try:
|
91
|
-
# Validate payload
|
92
|
-
if not isinstance(payload, Dict) or "queries" not in payload:
|
93
|
-
raise ValueError("Payload must be a dictionary with a 'queries' key.")
|
94
|
-
|
95
|
-
query = payload["queries"]
|
96
|
-
if not isinstance(query, str) or not query.strip():
|
97
|
-
raise ValueError("'queries' must be a non-empty string.")
|
98
|
-
|
122
|
+
try:
|
99
123
|
# Process the query
|
100
124
|
result = get_web_search_results_from_oi(query)
|
101
125
|
|
102
126
|
return result
|
103
127
|
except Exception as e:
|
104
|
-
return f"Error performing web search: {str(e)}\n\
|
128
|
+
return f"Error performing web search: {str(e)}\n\nQuery: {query}"
|
105
129
|
|
106
130
|
def main():
|
107
131
|
"""Main entry point for the script."""
|
@@ -111,5 +135,4 @@ def main():
|
|
111
135
|
|
112
136
|
if __name__ == "__main__":
|
113
137
|
# Initialize and run the server
|
114
|
-
main()
|
115
|
-
|
138
|
+
main()
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: suse-documentation-mcp-server
|
3
|
+
Version: 0.29.0
|
4
|
+
Summary: MCP server implementation for web search using Open WebUI Web search
|
5
|
+
Requires-Python: >=3.12
|
6
|
+
Description-Content-Type: text/markdown
|
7
|
+
Requires-Dist: python-dotenv>=1.0.1
|
8
|
+
Requires-Dist: httpx>=0.28.1
|
9
|
+
Requires-Dist: mcp[cli]>=1.4.1
|
@@ -0,0 +1,6 @@
|
|
1
|
+
server/search_suse_documentation.py,sha256=miEtMejLL8cctUyyWjOIrOIhhoUaiACvf9gw47NJ4T4,4344
|
2
|
+
suse_documentation_mcp_server-0.29.0.dist-info/METADATA,sha256=IG_WZaSypFOyE8XJx-Z0nqXnKf-i9cyf3p0_lf6Ic7g,321
|
3
|
+
suse_documentation_mcp_server-0.29.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
4
|
+
suse_documentation_mcp_server-0.29.0.dist-info/entry_points.txt,sha256=IEM7kH8YFWMMJCcp4hJGv5tHzHWxiR5lZ7jOyzRCHQA,88
|
5
|
+
suse_documentation_mcp_server-0.29.0.dist-info/top_level.txt,sha256=StKOSmRhvWS5IPcvhsDRbtxUTEofJgYFGOu5AAJdSWo,7
|
6
|
+
suse_documentation_mcp_server-0.29.0.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: suse-documentation-mcp-server
|
3
|
-
Version: 0.28.0
|
4
|
-
Summary: Add your description here
|
5
|
-
Requires-Python: >=3.12
|
6
|
-
Description-Content-Type: text/markdown
|
7
|
-
Requires-Dist: httpx>=0.28.1
|
8
|
-
Requires-Dist: mcp[cli]~=1.6.0
|
9
|
-
Requires-Dist: pydantic>=2.10.3
|
10
|
-
Requires-Dist: python-dotenv>=1.1.0
|
11
|
-
Requires-Dist: requests>=2.32.3
|
@@ -1,6 +0,0 @@
|
|
1
|
-
server/search_suse_documentation.py,sha256=iYZLC-o2XiHsom0dX8n8sdifHjQRV0yXFZbkD1uxdhA,4108
|
2
|
-
suse_documentation_mcp_server-0.28.0.dist-info/METADATA,sha256=6nRTr48f_dSzr6w761n-qYpZxN_l3a3UGMPClSDwDIs,344
|
3
|
-
suse_documentation_mcp_server-0.28.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
4
|
-
suse_documentation_mcp_server-0.28.0.dist-info/entry_points.txt,sha256=IEM7kH8YFWMMJCcp4hJGv5tHzHWxiR5lZ7jOyzRCHQA,88
|
5
|
-
suse_documentation_mcp_server-0.28.0.dist-info/top_level.txt,sha256=StKOSmRhvWS5IPcvhsDRbtxUTEofJgYFGOu5AAJdSWo,7
|
6
|
-
suse_documentation_mcp_server-0.28.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|