[{"content":"This is a simple guide on setting up SearXNG locally to have significantly better searching, as opposed to a single search engine, along with setting it up as an MCP Server for LM Studio and the Zed Editor for running local AI models.\nWhy use SearXNG Locally? SearXNG is a metasearch engine, which means it queries multiple search engines instead of querying just a single search engine. You can control exactly what search engines to use and you can integrate SearXNG easily with local tools like LM Studio and the Zed Editor. It\u0026rsquo;s also a lot nicer than a lot of the \u0026ldquo;modern\u0026rdquo; search engines, as there is no AI assitant or summary. If I want an AI summary than I would use a local agent to query accordingly, which I will also go over later in this post.\nSetting up SearXNG using Docker Ensure you have docker installed on your system. If you\u0026rsquo;re running Linux there are instructions here on installing the Docker Engine. Ideally, you should use your system\u0026rsquo;s package manager to install docker to easily receive updates. If you\u0026rsquo;re on Windows or macOS you can refer to this guide on installing Docker Desktop which you can run Docker Engine through.\nOnce you have docker installed, we can create the config and data directories for SearXNG. Ensure you create these in a location that is 1) mounted on system startup and 2) in a place you can easily access and remember:\n1 2 mkdir -p ./searxng/config/ ./searxng/data/ cd ./searxng/ After this we can pull in the docker image of SearXNG to use:\n1 docker pull docker.io/searxng/searxng:latest And once we have pulled the image, created the data and config directories, and navigated to the parent directory of those we can run the container:\n1 2 3 4 5 6 docker run --name searxng -d \\ --restart=always \\ -p 8888:8080 \\ -v \u0026#34;./config/:/etc/searxng/\u0026#34; \\ -v \u0026#34;./data/:/var/cache/searxng/\u0026#34; \\ docker.io/searxng/searxng:latest For this command:\n--name: assigns a name to the container -d: detaches the container from the shell --restart: changes how the container is restarted, there are two options: always: will restart the container when the docker daemon starts even if the container is manually stopped unless-stopped: will restart the container unless it is manually stopped in which case it needs to be manually restarted again -p: Specifies the port that runs on your machine, followed by the port on the container (host_port:container_port) -v: Creates a volume for the container, sets the path for it on your system\u0026rsquo;s disk, and sets the path for it inside the container docker.io/searxng/searxng:latest: Is the container to pull and run After running the container, you should be able to access SearXNG at http://localhost:8888/:\nYou can also right click on the address bar to add this address as an option for default search engines in your browser:\nIf you need more information, here is the documentation for SearXNG on docker container setup, which is the recommended way of installing and using SearXNG.\nOnce SearXNG is running, you can access Preferences in the top right, or configure the settings.yml file in your config directory.\nConfiguring SearXNG, Installing LM Studio, and Setting Up MCP Server Before we install LM Studio, we need to configure SearXNG in order for AI agents to be able to parse the information. Currently, SearXNG only returns results in HTML, but we can configure it to also return JSON which AI agents can easily parse.\nIf you navigate to your config directory that we created previously, there should be a settings.yml file.\nUnder the search section early in the file, you should see:\n1 2 formats: - html You can update this to be:\n1 2 3 formats: - html - json And now SearXNG returns json. You can stop your current container, and restart it, for the changes to take effect. You can also use other formats like csv and rss, so you can get really creative with how you use this metasearch engine.\nMoving on, ensure you have installed LM Studio. You can either, install the LM Studio Desktop app like I did which bundles the lms server, or install llmster which will install LMS without the GUI if you prefer to use LMS only in other applications. For this post, I am using the GUI Desktop App.\nI also recommend install LM Studio via your system\u0026rsquo;s package manager if it is available, so you can easily receive updates. I\u0026rsquo;m on Arch and it was available in the AUR under the lmstudio-bin package.\nLoad up LM Studio and go through its first time setup process and enable developer settings. You can also enable developer settings in the settings menu which will give you access to to the developer menu:\nNavigate to the developer menu, and in the Local Server tab (which should be the default one that appears) click on mcp.json to adjust the json configuration file for MCP servers.\nUpdate your configuration like so:\n1 2 3 4 5 6 7 8 9 10 11 { \u0026#34;mcpServers\u0026#34;: { \u0026#34;searxng\u0026#34;: { \u0026#34;command\u0026#34;: \u0026#34;npx\u0026#34;, \u0026#34;args\u0026#34;: [\u0026#34;-y\u0026#34;, \u0026#34;mcp-searxng\u0026#34;], \u0026#34;env\u0026#34;: { \u0026#34;SEARXNG_URL\u0026#34;: \u0026#34;http://localhost:8888\u0026#34; } } } } This will now be available to use in chats in LM Studio with local models. You can pin this integration by clicking the integrations button and the sub menu for the new SearXNG integration:\nWith this you can download a very small model, such as Qwen3 1.7B or smaller and it can function as a great search engine to get surface level information on topics:\nHowever, always ensure the AI isn\u0026rsquo;t hallucinating as that is can be very common for \u0026ldquo;do it all\u0026rdquo; models that many people use.\nCouple this also with the fact that a lot of content on the internet now is being AI generated and itself may be inaccurate, so even if you check the sources, and it looks fine, it still may not be accurate. In short terms, take AI generated information with a grain of salt.\nZed Editor with LM Studio and SearXNG MCP Server Before we setup Zed, you can start the LM Studio server by either, clicking on the LM Studio icon in your system tray and clicking start server, or running lms server start if you had LM Studio automatically configure your path to include lms. Starting the server allows other applications, like the Zed Editor, to access models LM Studio manages.\nYou can install the Zed Editor through your package manager or directly here. Once you have it installed, if the Zed Editor has not automatically detected LM Studio, you can click on the three dots menu in the right dock that is for AI and then click on settings:\nFrom here, you can select LM Studio from the list and click on connect to connect if it hasn\u0026rsquo;t automatically. Make sure you are running the LM Studio server for this to work.\nFrom this same menu, you can click on Add Server under Model Context Protocol Servers. We need to add SearXNG as a MCP Server for Zed specifically has running agents through this editior, even from another provider, will use their own MCP Servers. We will use the same configuration as before so you can paste the configuration below:\n1 2 3 4 5 6 7 8 9 10 11 { /// The name of your MCP server \u0026#34;searxng\u0026#34;: { /// The command which runs the MCP server \u0026#34;command\u0026#34;: \u0026#34;npx\u0026#34;, /// The arguments to pass to the MCP server \u0026#34;args\u0026#34;: [\u0026#34;-y\u0026#34;, \u0026#34;mcp-searxng\u0026#34;], /// The environment variables to set \u0026#34;env\u0026#34;: { \u0026#34;SEARXNG_URL\u0026#34;: \u0026#34;http://localhost:8888\u0026#34; } } } And congratulations, you now have set up SearXNG as a metasearch engine locally, set up MCP Servers on both LM Studio for chats, and in the Zed Editor for coding questions and code generation. You can select a higher parameter model, such as gpt-oss-20b, if your machine can handle it and with our MCP Server with SearXNG, it can perform better for analyzing and generating code. And likewise, my cautions with AI generated content with LM Studio prompts apply here as well, so keep that in mind.\nRegardless though, Happy Coding!\n","date":"2026-03-26T21:36:17-04:00","image":"/p/searxng-as-an-mcp-server/searxng-search.png","permalink":"/p/searxng-as-an-mcp-server/","title":"SearXNG as an MCP Server"}]