suse-documentation-mcp-server 0.30.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.30.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.30.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,8 +1,6 @@
1
- import asyncio
1
+ import requests
2
2
  import os
3
- import sys
4
- import time
5
-
3
+ import re
6
4
  from dotenv import load_dotenv
7
5
  from mcp.server.fastmcp import FastMCP
8
6
 
@@ -11,42 +9,6 @@ load_dotenv()
11
9
  base_url = os.getenv("OI_API_BASE", "") + "/api/v1/retrieval/process/web"
12
10
  authorization_token = os.getenv("OI_API_TOKEN", "")
13
11
 
14
- # Initialize FastMCP server
15
- mcp = FastMCP(
16
- "web-search",
17
- prompt="""
18
- # Web Search MCP Server
19
-
20
- This server provides tools for searching the web using Open WebUI Web search API.
21
- It allows you to search web for given search query.
22
-
23
- ## Available Tools
24
-
25
- ### 1. get_web_search_results
26
- Use this tool to search web to gather information about SUSE, Rancher products and projects.
27
-
28
- Example: "HOw to setup Nvidia GPU in RKE2?" or
29
- "Does Rancher Desktop support Wasm"
30
-
31
- ## Guidelines for Use
32
-
33
- - Always perform a web search even if you think you know the answer
34
- - Use the most relevant and specific keywords for your search
35
- - Keep queries concise and specific for best results
36
-
37
- ## Output Format
38
-
39
- All search results will be formatted as text with clear sections for each
40
- result item, including:
41
-
42
- - URL: The link to the source of the information
43
- - Content: A brief summary or excerpt from the page
44
-
45
- If the API call fails for any reason, appropriate error messages will be
46
- returned.
47
- """,
48
- )
49
-
50
12
  def clean_content(content):
51
13
  # Remove excessive blank lines
52
14
  cleaned_content = re.sub(r'\n\s*\n+', '\n\n', content.strip())
@@ -55,6 +17,13 @@ def clean_content(content):
55
17
  return cleaned_content
56
18
 
57
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
+
58
27
  headers = {
59
28
  'Content-Type': 'application/json',
60
29
  'Authorization': f'Bearer {authorization_token}'
@@ -62,8 +31,7 @@ def get_web_search_results_from_oi(query):
62
31
 
63
32
  # Step 1: Get web search results (list of URLs)
64
33
  search_payload = {
65
- "query": query,
66
- "collection_name": "your_collection_name"
34
+ "queries": [query]
67
35
  }
68
36
 
69
37
  print("Inside get_web_search_results_from_oi:", query)
@@ -85,8 +53,7 @@ def get_web_search_results_from_oi(query):
85
53
  # Step 2: Loop through URLs to get page content
86
54
  for filename in filenames:
87
55
  process_payload = {
88
- "url": filename,
89
- "collection_name": search_data["collection_name"]
56
+ "url": filename
90
57
  }
91
58
 
92
59
  process_response = requests.post(base_url, headers=headers, json=process_payload)
@@ -107,31 +74,53 @@ def get_web_search_results_from_oi(query):
107
74
 
108
75
  return combined_response
109
76
 
110
- @mcp.tool()
111
- async def get_web_search_results(
112
- 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"
113
114
  ) -> str:
114
- """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.
115
117
 
116
118
  Args:
117
119
  query: Search query (required)
118
120
  """
119
-
120
- try:
121
+
122
+ try:
121
123
  # Process the query
122
- result = get_web_search_results_from_oi(query)
123
-
124
- return result
124
+ return get_web_search_results_from_oi(query)
125
125
  except Exception as e:
126
- return f"Error performing web search: {str(e)}\n\nQuery: {query}"
127
-
128
- def main():
129
- """Main entry point for the script."""
130
- # Initialize and run the server
131
- print("Starting SUSE Documentation Search Server...")
132
- mcp.run()
133
-
134
- if __name__ == "__main__":
135
- # Initialize and run the server
136
- main()
137
-
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.30.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