Last active
September 26, 2025 14:32
-
-
Save tripplyons/a2f9d8bd553802f9296a7ec3b46760de to your computer and use it in GitHub Desktop.
Free web search MCP using a local SearXNG instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir -p config data | |
| cat > config/settings.yml << 'EOF' | |
| server: | |
| bind_address: "0.0.0.0" | |
| secret_key: "secret" | |
| search: | |
| formats: | |
| - html | |
| - json | |
| EOF | |
| docker run --rm --name searxng \ | |
| -p 8080:8080 \ | |
| -v "./config/:/etc/searxng/" \ | |
| -v "./data/:/var/cache/searxng/" \ | |
| docker.io/searxng/searxng:latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # dependencies for pip: | |
| # pip install requests "mcp[cli]" | |
| from mcp.server.fastmcp import FastMCP | |
| import requests | |
| mcp = FastMCP("searx") | |
| @mcp.tool() | |
| def search_web(query: str) -> str: | |
| """Search the web for information""" | |
| response = requests.get(f"http://localhost:8080/search?format=json&q={query}") | |
| data = response.json() | |
| return "\n\n".join( | |
| [ | |
| result["title"] + "\n" + result["url"] + "\n" + result["content"] | |
| for result in data["results"] | |
| ] | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment