ddgs-mcp-server 0.1.0__py3-none-any.whl → 0.2.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.
- ddgs_mcp_server/server.py +19 -75
- ddgs_mcp_server-0.2.0.dist-info/METADATA +84 -0
- ddgs_mcp_server-0.2.0.dist-info/RECORD +8 -0
- ddgs_mcp_server-0.1.0.dist-info/METADATA +0 -65
- ddgs_mcp_server-0.1.0.dist-info/RECORD +0 -8
- {ddgs_mcp_server-0.1.0.dist-info → ddgs_mcp_server-0.2.0.dist-info}/WHEEL +0 -0
- {ddgs_mcp_server-0.1.0.dist-info → ddgs_mcp_server-0.2.0.dist-info}/entry_points.txt +0 -0
- {ddgs_mcp_server-0.1.0.dist-info → ddgs_mcp_server-0.2.0.dist-info}/licenses/LICENSE +0 -0
ddgs_mcp_server/server.py
CHANGED
|
@@ -18,11 +18,17 @@ async def list_tools() -> list[types.Tool]:
|
|
|
18
18
|
return [
|
|
19
19
|
types.Tool(
|
|
20
20
|
name="search_text",
|
|
21
|
-
description="Perform a
|
|
21
|
+
description="Perform a metasearch using various backends (DuckDuckGo, Google, Bing, etc.). Use this to find APIs, libraries, developer tools, and general information.",
|
|
22
22
|
inputSchema={
|
|
23
23
|
"type": "object",
|
|
24
24
|
"properties": {
|
|
25
25
|
"query": {"type": "string", "description": "Search query"},
|
|
26
|
+
"backend": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": ["auto", "html", "lite", "bing", "brave", "duckduckgo", "google", "grokipedia", "mojeek", "yandex", "yahoo", "wikipedia"],
|
|
29
|
+
"default": "auto",
|
|
30
|
+
"description": "Search engine backend to use."
|
|
31
|
+
},
|
|
26
32
|
"region": {"type": "string", "default": "us-en", "description": "e.g., us-en, uk-en"},
|
|
27
33
|
"safesearch": {"type": "string", "enum": ["on", "moderate", "off"], "default": "moderate"},
|
|
28
34
|
"timelimit": {"type": "string", "enum": ["d", "w", "m", "y"], "default": None},
|
|
@@ -30,63 +36,6 @@ async def list_tools() -> list[types.Tool]:
|
|
|
30
36
|
},
|
|
31
37
|
"required": ["query"]
|
|
32
38
|
}
|
|
33
|
-
),
|
|
34
|
-
types.Tool(
|
|
35
|
-
name="search_images",
|
|
36
|
-
description="Perform an image search using DuckDuckGo.",
|
|
37
|
-
inputSchema={
|
|
38
|
-
"type": "object",
|
|
39
|
-
"properties": {
|
|
40
|
-
"query": {"type": "string"},
|
|
41
|
-
"region": {"type": "string", "default": "us-en"},
|
|
42
|
-
"safesearch": {"type": "string", "default": "moderate"},
|
|
43
|
-
"timelimit": {"type": "string", "default": None},
|
|
44
|
-
"max_results": {"type": "integer", "default": 10}
|
|
45
|
-
},
|
|
46
|
-
"required": ["query"]
|
|
47
|
-
}
|
|
48
|
-
),
|
|
49
|
-
types.Tool(
|
|
50
|
-
name="search_videos",
|
|
51
|
-
description="Perform a video search using DuckDuckGo.",
|
|
52
|
-
inputSchema={
|
|
53
|
-
"type": "object",
|
|
54
|
-
"properties": {
|
|
55
|
-
"query": {"type": "string"},
|
|
56
|
-
"region": {"type": "string", "default": "us-en"},
|
|
57
|
-
"safesearch": {"type": "string", "default": "moderate"},
|
|
58
|
-
"timelimit": {"type": "string", "default": None},
|
|
59
|
-
"max_results": {"type": "integer", "default": 10}
|
|
60
|
-
},
|
|
61
|
-
"required": ["query"]
|
|
62
|
-
}
|
|
63
|
-
),
|
|
64
|
-
types.Tool(
|
|
65
|
-
name="search_news",
|
|
66
|
-
description="Perform a news search using DuckDuckGo.",
|
|
67
|
-
inputSchema={
|
|
68
|
-
"type": "object",
|
|
69
|
-
"properties": {
|
|
70
|
-
"query": {"type": "string"},
|
|
71
|
-
"region": {"type": "string", "default": "us-en"},
|
|
72
|
-
"safesearch": {"type": "string", "default": "moderate"},
|
|
73
|
-
"timelimit": {"type": "string", "default": None},
|
|
74
|
-
"max_results": {"type": "integer", "default": 10}
|
|
75
|
-
},
|
|
76
|
-
"required": ["query"]
|
|
77
|
-
}
|
|
78
|
-
),
|
|
79
|
-
types.Tool(
|
|
80
|
-
name="search_books",
|
|
81
|
-
description="Perform a book search using DuckDuckGo (Anna's Archive backend).",
|
|
82
|
-
inputSchema={
|
|
83
|
-
"type": "object",
|
|
84
|
-
"properties": {
|
|
85
|
-
"query": {"type": "string"},
|
|
86
|
-
"max_results": {"type": "integer", "default": 10}
|
|
87
|
-
},
|
|
88
|
-
"required": ["query"]
|
|
89
|
-
}
|
|
90
39
|
)
|
|
91
40
|
]
|
|
92
41
|
|
|
@@ -94,7 +43,11 @@ async def list_tools() -> list[types.Tool]:
|
|
|
94
43
|
async def call_tool(name: str, arguments: dict) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
|
|
95
44
|
logger.info(f"Calling tool: {name} with args: {arguments}")
|
|
96
45
|
|
|
46
|
+
if name != "search_text":
|
|
47
|
+
raise ValueError(f"Unknown tool: {name}")
|
|
48
|
+
|
|
97
49
|
query = arguments.get("query")
|
|
50
|
+
backend = arguments.get("backend", "auto")
|
|
98
51
|
region = arguments.get("region", "us-en")
|
|
99
52
|
safesearch = arguments.get("safesearch", "moderate")
|
|
100
53
|
timelimit = arguments.get("timelimit")
|
|
@@ -102,23 +55,14 @@ async def call_tool(name: str, arguments: dict) -> list[types.TextContent | type
|
|
|
102
55
|
|
|
103
56
|
try:
|
|
104
57
|
with DDGS() as ddgs:
|
|
105
|
-
results =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
results = ddgs.news(keywords=query, region=region, safesearch=safesearch, timelimit=timelimit, max_results=max_results)
|
|
114
|
-
elif name == "search_books":
|
|
115
|
-
if hasattr(ddgs, 'books'):
|
|
116
|
-
results = ddgs.books(keywords=query, max_results=max_results)
|
|
117
|
-
else:
|
|
118
|
-
return [types.TextContent(type="text", text="Error: 'books' search backend not available in this version of python-ddgs.")]
|
|
119
|
-
else:
|
|
120
|
-
raise ValueError(f"Unknown tool: {name}")
|
|
121
|
-
|
|
58
|
+
results = ddgs.text(
|
|
59
|
+
keywords=query,
|
|
60
|
+
region=region,
|
|
61
|
+
safesearch=safesearch,
|
|
62
|
+
timelimit=timelimit,
|
|
63
|
+
max_results=max_results,
|
|
64
|
+
backend=backend
|
|
65
|
+
)
|
|
122
66
|
return [types.TextContent(type="text", text=json.dumps(results, indent=2))]
|
|
123
67
|
|
|
124
68
|
except Exception as e:
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ddgs-mcp-server
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: DuckDuckGo Search MCP Server
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Requires-Dist: duckduckgo-search>=6.0.0
|
|
8
|
+
Requires-Dist: mcp>=1.0.0
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# DDGS MCP Server
|
|
12
|
+
|
|
13
|
+
A Model Context Protocol (MCP) server that provides DuckDuckGo Search capabilities to AI agents.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **search_text**: advanced metasearch using `bing`, `brave`, `duckduckgo`, `google`, `mojeek`, `yahoo`, `yandex`, `wikipedia`.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Installation & Usage
|
|
21
|
+
|
|
22
|
+
You can run this server directly using `uvx` without installing it globally.
|
|
23
|
+
|
|
24
|
+
### VS Code (Claude Desktop / Cline)
|
|
25
|
+
|
|
26
|
+
Add this to your MCP settings file (e.g., `cline_mcp_settings.json` or `claude_desktop_config.json`):
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"ddgs-search": {
|
|
32
|
+
"command": "uvx",
|
|
33
|
+
"args": [
|
|
34
|
+
"ddgs-mcp-server"
|
|
35
|
+
],
|
|
36
|
+
"disabled": false,
|
|
37
|
+
"alwaysAllow": []
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Manual Execution
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uvx ddgs-mcp-server
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Secrets & Configuration
|
|
51
|
+
|
|
52
|
+
This project technically **does not require API keys** to run locally, as it scrapes DuckDuckGo. However, for **publishing** or **proxy usage**, you should configure your environment.
|
|
53
|
+
|
|
54
|
+
### 1. Set up Secrets
|
|
55
|
+
Copy the example file:
|
|
56
|
+
```bash
|
|
57
|
+
cp .env.example .env
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 2. Required Tokens
|
|
61
|
+
|
|
62
|
+
| Token | Purpose | How to Get It |
|
|
63
|
+
| :--- | :--- | :--- |
|
|
64
|
+
| **PyPI API Token** | Publishing to PyPI | 1. Go to [PyPI Account Settings](https://pypi.org/manage/account/token/)<br>2. Select "Add API Token"<br>3. Scope to "Entire account" (for first publish)<br>4. Set as `TWINE_PASSWORD` in `.env` |
|
|
65
|
+
| **Proxy URL** | Bypassing Blocks (Optional) | Use any HTTP/SOCKS5 proxy provider if you encounter rate limits. |
|
|
66
|
+
|
|
67
|
+
## Development / Publishing
|
|
68
|
+
|
|
69
|
+
To build and publish this package to PyPI (using the secrets from above):
|
|
70
|
+
|
|
71
|
+
1. **Build**:
|
|
72
|
+
```bash
|
|
73
|
+
pip install build twine
|
|
74
|
+
python -m build
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
2. **Publish** (loads secrets from .env if you export them, or prompts you):
|
|
78
|
+
```bash
|
|
79
|
+
# If using .env variables (PowerShell)
|
|
80
|
+
# $env:TWINE_USERNAME = "__token__"
|
|
81
|
+
# $env:TWINE_PASSWORD = "pypi-..."
|
|
82
|
+
|
|
83
|
+
python -m twine upload dist/*
|
|
84
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
ddgs_mcp_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
ddgs_mcp_server/main.py,sha256=hqJl7UoGQoL9a-2hX24srZYFGdatheJfgkn5wz5Od70,492
|
|
3
|
+
ddgs_mcp_server/server.py,sha256=OsDMz-4ZwrZTY6GmPeQpAZhLC_4M5ZPd6coH42V9h0M,2832
|
|
4
|
+
ddgs_mcp_server-0.2.0.dist-info/METADATA,sha256=1Zb3qJOYXgZtCLDmKsIIrE8ESqflZDoE7D8HTkSFylM,2174
|
|
5
|
+
ddgs_mcp_server-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
+
ddgs_mcp_server-0.2.0.dist-info/entry_points.txt,sha256=8YvtzhkNDMvAy2CdIx8VppBFjiBSJ56JtLX-v8SUHGc,62
|
|
7
|
+
ddgs_mcp_server-0.2.0.dist-info/licenses/LICENSE,sha256=vLPKcNOa4dGBRPq4I_mIBKyVSbIlzrOdinbwXFeKb88,1091
|
|
8
|
+
ddgs_mcp_server-0.2.0.dist-info/RECORD,,
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: ddgs-mcp-server
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: DuckDuckGo Search MCP Server
|
|
5
|
-
License-File: LICENSE
|
|
6
|
-
Requires-Python: >=3.10
|
|
7
|
-
Requires-Dist: duckduckgo-search>=6.0.0
|
|
8
|
-
Requires-Dist: mcp>=1.0.0
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
|
|
11
|
-
# DDGS MCP Server
|
|
12
|
-
|
|
13
|
-
A Model Context Protocol (MCP) server that provides DuckDuckGo Search capabilities to AI agents.
|
|
14
|
-
|
|
15
|
-
## Features
|
|
16
|
-
|
|
17
|
-
- **Text Search**: General web search (`search_text`)
|
|
18
|
-
- **Image Search**: Find images (`search_images`)
|
|
19
|
-
- **Video Search**: Find videos (`search_videos`)
|
|
20
|
-
- **News Search**: Get latest news (`search_news`)
|
|
21
|
-
- **Book Search**: Search for books (`search_books`)
|
|
22
|
-
|
|
23
|
-
## Installation & Usage
|
|
24
|
-
|
|
25
|
-
You can run this server directly using `uvx` without installing it globally.
|
|
26
|
-
|
|
27
|
-
### VS Code (Claude Desktop / Cline)
|
|
28
|
-
|
|
29
|
-
Add this to your MCP settings file (e.g., `cline_mcp_settings.json` or `claude_desktop_config.json`):
|
|
30
|
-
|
|
31
|
-
```json
|
|
32
|
-
{
|
|
33
|
-
"mcpServers": {
|
|
34
|
-
"ddgs-search": {
|
|
35
|
-
"command": "uvx",
|
|
36
|
-
"args": [
|
|
37
|
-
"ddgs-mcp-server"
|
|
38
|
-
],
|
|
39
|
-
"disabled": false,
|
|
40
|
-
"alwaysAllow": []
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Manual Execution
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
uvx ddgs-mcp-server
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Development / Publishing
|
|
53
|
-
|
|
54
|
-
To build and publish this package to PyPI:
|
|
55
|
-
|
|
56
|
-
1. **Build**:
|
|
57
|
-
```bash
|
|
58
|
-
pip install build twine
|
|
59
|
-
python -m build
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
2. **Publish**:
|
|
63
|
-
```bash
|
|
64
|
-
python -m twine upload dist/*
|
|
65
|
-
```
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
ddgs_mcp_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
ddgs_mcp_server/main.py,sha256=hqJl7UoGQoL9a-2hX24srZYFGdatheJfgkn5wz5Od70,492
|
|
3
|
-
ddgs_mcp_server/server.py,sha256=Zv7v9H7nA1ZY8l8Ltw6OojdkYxj35COZxruY02av3f8,5531
|
|
4
|
-
ddgs_mcp_server-0.1.0.dist-info/METADATA,sha256=ILZeHuWCe4qJm6zW9McrdbiKHjKyF-wplHUlH0XvueU,1356
|
|
5
|
-
ddgs_mcp_server-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
-
ddgs_mcp_server-0.1.0.dist-info/entry_points.txt,sha256=8YvtzhkNDMvAy2CdIx8VppBFjiBSJ56JtLX-v8SUHGc,62
|
|
7
|
-
ddgs_mcp_server-0.1.0.dist-info/licenses/LICENSE,sha256=vLPKcNOa4dGBRPq4I_mIBKyVSbIlzrOdinbwXFeKb88,1091
|
|
8
|
-
ddgs_mcp_server-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|