The MCP (Model Context Protocol) server enables search capabilities using Duck Duck Go as the backend search engine. It leverages SSE (Server-Sent Events) transport and is based on Open-WebUI's web search functionality.
git clone https://github.com/username/mcp-server.git
cd mcp-server
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
pip install -r requirements.txt
To start the MCP server with default settings:
python server.py
By default, the server runs on port 8000. You can specify a different port using the -p
or --port
flag:
python server.py --port 8080
You can configure the server using the following environment variables:
MCP_PORT
: The port on which the server will listen (default: 8000)MCP_HOST
: The host address to bind the server (default: 0.0.0.0)SEARCH_LIMIT
: Maximum number of search results to return (default: 5)Example:
export MCP_PORT=8080
export SEARCH_LIMIT=10
python server.py
To perform a search, send a POST request to the /search
endpoint:
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-d '{"query": "climate change solutions"}'
The server supports SSE (Server-Sent Events) for streaming search results. You can connect to the streaming endpoint using compatible clients:
// JavaScript example
const eventSource = new EventSource('http://localhost:8000/search/stream?query=climate+change');
eventSource.onmessage = function(event) {
const data = JSON.parse(event.data);
console.log(data);
};
You can customize your search with additional parameters:
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-d '{
"query": "renewable energy",
"limit": 3,
"region": "us-en",
"time_range": "d"
}'
Supported parameters:
limit
: Number of results to returnregion
: Search region codetime_range
: Time filter (d=day, w=week, m=month)The server outputs logs to the console that can help diagnose issues. Run with higher verbosity for more detailed logs:
python server.py --debug
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.