MCP-Node-Duckduckgo
If you are the rightful owner of MCP-Node-Duckduckgo and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MCP Node DuckDuckGo Server is a Node.js application that serves as a Model Context Protocol (MCP) server, providing tools to query DuckDuckGo and fetch webpage content.
MCP Node DuckDuckGo Server
A Node.js application serving as an MCP server that offers two main tools:
- Search: Query DuckDuckGo and retrieve formatted search results.
- Fetch Content: Retrieve and parse text content from any webpage URL.
Table of Contents
Overview
The MCP Node DuckDuckGo Server is a Node.js server that provides a modular interface (via HTTP endpoints) to query DuckDuckGo and fetch webpage content. This project showcases:
- Express for server creation.
- Axios for making HTTP requests.
- Cheerio for parsing HTML.
Features
- DuckDuckGo Search: Uses a POST API to execute search queries and return DuckDuckGo results formatted for further processing.
- Web Content Fetching: Retrieves and parses text content from a given URL.
- Rate Limiting: Provides basic rate limiting to manage the request frequency.
- Extensible MCP Server: Tools are organized as modules, making it easy to add or modify functionality.
Requirements
- Node.js (v12 or higher)
- npm
Installation
-
Clone the Repository
Clone the repository from GitHub:git clone <repository-url>
-
Navigate to the Project Folder
cd mcp-node-duckduckgo-server
-
Install Dependencies
Install required packages using npm:npm install express axios cheerio
Usage
Starting the Server
Run the server by executing:
node mcp-node-duckduckgo-server.js
You should see a log message similar to:
MCP Server "ddg-search" running on port 3000
Available Endpoints
List Tools
To list all available tools, open a new terminal window and run:
curl http://localhost:3000/tools
This should output a JSON list of registered tools (e.g., "search" and "fetchContent").
Search Tool
Execute a search query using the search tool:
curl -X POST http://localhost:3000/run-tool -H "Content-Type: application/json" -d "{\"toolName\":\"search\",\"params\":{\"query\":\"test query\",\"maxResults\":5}}"
The response will contain the formatted search results from DuckDuckGo.
Fetch Content Tool
Fetch content from a specific webpage:
curl -X POST http://localhost:3000/run-tool -H "Content-Type: application/json" -d "{\"toolName\":\"fetchContent\",\"params\":{\"url\":\"https://www.channelnewsasia.com/singapore/ge2025-general-election-may-3-parliament-dissolved-5064316\"}}"
The server will return a text snippet from the fetched webpage.
Logging and Debugging
- The server logs informational and error messages to the terminal.
- Use these logs to debug issues such as timeouts, HTTP errors, or unexpected behavior in responses.
Contributing
Contributions are welcome! If you want to contribute:
- Fork the repository.
- Create your feature branch (
git checkout -b feature/YourFeature
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Open a Pull Request.
License
This project is licensed under the MIT License. See the file for details.