suse-documentation-mcp-server 0.29.0__tar.gz → 0.31.0__tar.gz

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.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: suse-documentation-mcp-server
3
- Version: 0.29.0
3
+ Version: 0.31.0
4
4
  Summary: MCP server implementation for web search using Open WebUI Web search
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
7
7
  Requires-Dist: python-dotenv>=1.0.1
8
- Requires-Dist: httpx>=0.28.1
9
8
  Requires-Dist: mcp[cli]>=1.4.1
9
+ Requires-Dist: requests>=2.28
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "suse-documentation-mcp-server"
3
- version = "0.29.0"
3
+ version = "0.31.0"
4
4
  description = "MCP server implementation for web search using Open WebUI Web search"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
7
7
  dependencies = [
8
8
  "python-dotenv>=1.0.1",
9
- "httpx>=0.28.1",
10
9
  "mcp[cli]>=1.4.1",
10
+ "requests>=2.28"
11
11
  ]
12
12
 
13
13
  [project.scripts]
@@ -1,9 +1,6 @@
1
- import asyncio
1
+ import requests
2
2
  import os
3
- import sys
4
- import time
5
-
6
- import httpx
3
+ import re
7
4
  from dotenv import load_dotenv
8
5
  from mcp.server.fastmcp import FastMCP
9
6
 
@@ -12,42 +9,6 @@ load_dotenv()
12
9
  base_url = os.getenv("OI_API_BASE", "") + "/api/v1/retrieval/process/web"
13
10
  authorization_token = os.getenv("OI_API_TOKEN", "")
14
11
 
15
- # Initialize FastMCP server
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
- )
50
-
51
12
  def clean_content(content):
52
13
  # Remove excessive blank lines
53
14
  cleaned_content = re.sub(r'\n\s*\n+', '\n\n', content.strip())
@@ -56,6 +17,13 @@ def clean_content(content):
56
17
  return cleaned_content
57
18
 
58
19
  def get_web_search_results_from_oi(query):
20
+
21
+ if not base_url or not authorization_token:
22
+ return (
23
+ "Error: OI_API_BASE and/or not OI_API_TOKEN not set. Please set the "
24
+ "environment variables."
25
+ )
26
+
59
27
  headers = {
60
28
  'Content-Type': 'application/json',
61
29
  'Authorization': f'Bearer {authorization_token}'
@@ -63,8 +31,7 @@ def get_web_search_results_from_oi(query):
63
31
 
64
32
  # Step 1: Get web search results (list of URLs)
65
33
  search_payload = {
66
- "query": query,
67
- "collection_name": "your_collection_name"
34
+ "queries": [query]
68
35
  }
69
36
 
70
37
  print("Inside get_web_search_results_from_oi:", query)
@@ -86,8 +53,7 @@ def get_web_search_results_from_oi(query):
86
53
  # Step 2: Loop through URLs to get page content
87
54
  for filename in filenames:
88
55
  process_payload = {
89
- "url": filename,
90
- "collection_name": search_data["collection_name"]
56
+ "url": filename
91
57
  }
92
58
 
93
59
  process_response = requests.post(base_url, headers=headers, json=process_payload)
@@ -108,31 +74,53 @@ def get_web_search_results_from_oi(query):
108
74
 
109
75
  return combined_response
110
76
 
111
- @mcp.tool()
112
- async def get_web_search_results(
113
- query: str
77
+ # Initialize FastMCP server
78
+ server = FastMCP(
79
+ "open-webui-web-search",
80
+ prompt="""
81
+ # Open WebUI Search MCP Server
82
+
83
+ This server provides tools for searching the web using Microsoft Open WebUI's API.
84
+ It allows you to search for web pages, news articles, and images.
85
+
86
+ ## Available Tools
87
+
88
+ ### 1. open_webui_web_search
89
+ Use this tool for general web searches. Best for finding information,
90
+ websites, articles, and general content.
91
+
92
+ Example: "What is the capital of France?" or
93
+ "recipe for chocolate chip cookies"
94
+
95
+ ## Guidelines for Use
96
+
97
+ - Keep queries concise and specific for best results
98
+
99
+ ## Output Format
100
+
101
+ All search results will be formatted as text with clear sections for each
102
+ result item, including:
103
+
104
+ - Web search: Title, URL, and Description
105
+
106
+ If the API key is missing or invalid, appropriate error messages will be
107
+ returned.
108
+ """,
109
+ )
110
+
111
+ @server.tool()
112
+ async def get_web_search_results_from_oi(
113
+ query: str, count: int = 10, offset: int = 0, market: str = "en-US"
114
114
  ) -> str:
115
- """Performs a web search using the Open WebUI web search API.
115
+ """Performs a web search using the Open WebUI Web Search API for general information
116
+ and websites.
116
117
 
117
118
  Args:
118
119
  query: Search query (required)
119
120
  """
120
- print("Entered get_web_search_results with payload:", query)
121
-
122
- try:
121
+
122
+ try:
123
123
  # Process the query
124
- result = get_web_search_results_from_oi(query)
125
-
126
- return result
124
+ return get_web_search_results_from_oi(query)
127
125
  except Exception as e:
128
- return f"Error performing web search: {str(e)}\n\nQuery: {query}"
129
-
130
- def main():
131
- """Main entry point for the script."""
132
- # Initialize and run the server
133
- print("Starting SUSE Documentation Search Server v0.19.0")
134
- mcp.run()
135
-
136
- if __name__ == "__main__":
137
- # Initialize and run the server
138
- main()
126
+ return f"Error performing web search: {str(e)}\n\nPayload: {query}"
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: suse-documentation-mcp-server
3
- Version: 0.29.0
3
+ Version: 0.31.0
4
4
  Summary: MCP server implementation for web search using Open WebUI Web search
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
7
7
  Requires-Dist: python-dotenv>=1.0.1
8
- Requires-Dist: httpx>=0.28.1
9
8
  Requires-Dist: mcp[cli]>=1.4.1
9
+ Requires-Dist: requests>=2.28
@@ -1,3 +1,3 @@
1
1
  python-dotenv>=1.0.1
2
- httpx>=0.28.1
3
2
  mcp[cli]>=1.4.1
3
+ requests>=2.28