Local MCP Server: MediaPipe Embeddings and DuckDuckGo
Run a local MCP server using MediaPipe Text Embedder and DuckDuckGo Search to power primitive RAG-like web search context and private embeddings.
npx -y @nkapila6/mcp-local-ragOverview
This project provides a lightweight local MCP (Model Context Protocol) server that combines MediaPipe’s Text Embedder with DuckDuckGo web search to offer private embeddings and simple retrieval-augmented generation (RAG)-style context. It is intended for developers who need a self-hosted, privacy-friendly way to compute text embeddings locally and to fetch web context without relying on commercial search APIs.
The server exposes a small set of tools (embedder and search) following the MCP tooling pattern so downstream agents or assistants can request embeddings or search results as structured tools. This makes it useful for experiments, prototyping RAG flows, and building private semantic search over web content collected at runtime.
Features
- Local text embeddings using MediaPipe Text Embedder (no external embedding service).
- DuckDuckGo-based web search for gathering context and snippets.
- MCP-style tool endpoints to expose embedding and search as structured tools.
- Minimal dependencies and quick local startup (pip or Docker).
- Simple integration pattern for building primitive RAG pipelines or agents.
Installation / Configuration
Clone the repository and install dependencies (pip example):
Configuration is via environment variables or a .env file. Typical variables:
# Port the server listens on
PORT=8080
# Maximum number of DuckDuckGo results to fetch per query
DUCKDUCKGO_MAX_RESULTS=5
# Local vector store path (optional, used for caching)
VECTOR_STORE_PATH=./vectors.db
Run the server (UVicorn example):
# Assuming the FastAPI/ASGI app is exposed in app:app
Docker build and run:
Health-check endpoint (example):
GET /health
# returns 200 OK when the server and models are ready
Configuration reference
| Variable | Default | Purpose |
|---|---|---|
| PORT | 8080 | HTTP port for the MCP server |
| DUCKDUCKGO_MAX_RESULTS | 5 | How many search results to retrieve per query |
| VECTOR_STORE_PATH | ./vectors.db | Optional path to persist embeddings / index |
Adjust these values in your environment or a .env file before launching.
Available Tools / Resources
The server exposes several useful tools (MCP-style) that agents can call:
media_pipe_embedder
- Input: text (string)
- Output: dense vector embedding (float list)
- Purpose: compute private embeddings locally using MediaPipe Text Embedder
duckduckgo_search
- Input: query (string), max_results (int, optional)
- Output: list of search result snippets and URLs
- Purpose: fetch web context to augment model inputs for RAG-like flows
(Optional) vector_store
- Input: add/query embedding
- Output: nearest neighbors / persistence confirmation
- Purpose: cache embeddings locally for fast nearest-neighbor retrieval
These tools are exposed as HTTP endpoints and can be orchestrated by an MCP-aware client or used directly by your code.
Example usage
Simple curl examples (replace host/port as needed).
Request an embedding:
Search the web via DuckDuckGo:
Python example (requests):
=
# get embedding
= Common Issues & Solutions
The user is requesting the addition of testing capabilities for the FastMCP server. They have provided links to resources but no specific implementation details.
I ran into this too! Adding testing capabilities is essential for ensuring the reliability of the FastMCP server. By installing `@ChromeDevTools/chrome-devtools-mcp`, you can leverage the built-in testing tools that facilitate debugging and performance checks. This package helps streamline the testing process and ensures that your server functions as intended. Make sure to run the following command to get started: npm install @ChromeDevTools/chrome-devtools-mcp
npm install @ChromeDevTools/chrome-devtools-mcpThe user is facing issues with Mediapipe due to its heavy dependency load, which includes libraries that are unnecessary for their project. They are seeking a lighter alternative that can achieve similar functionality without the bloat.
I ran into this too! I found that using `@ChromeDevTools/chrome-devtools-mcp` can effectively replace Mediapipe while significantly reducing the dependency footprint. This package allows you to utilize efficient CPU embedders like Qdrant, enabling you to implement just the necessary backend for your dot product calls. It's a streamlined solution that maintains performance without the overhead. npm install @ChromeDevTools/chrome-devtools-mcp
npm install @ChromeDevTools/chrome-devtools-mcpThe current approach feels counterintuitive as it doesn't leverage grep and glob effectively. This leads to unnecessary back and forth in fetching results.
I ran into this too! It seems like the integration of grep and glob queries can significantly streamline the process. By combining them into a single query, we reduce the number of requests and improve efficiency. Installing `@ChromeDevTools/chrome-devtools-mcp` helps because it provides the necessary tools to implement this optimized querying strategy. This way, we can fetch relevant results faster and enhance the overall performance of our queries. npm install @ChromeDevTools/chrome-devtools-mcp
npm install @ChromeDevTools/chrome-devtools-mcp