MCP Server Tools and Local Database#
Squirro provides both a generic approach to agent-based search and the flexibility to fine-tune solutions for highly specific use cases. This page illustrates that second capability by showing how a custom deployment can pair the MCP Server Tools with a local, SQL-based database to give agents reliable, high-performance access to structured data loaded from CSV files or other tabular sources.
For structured data with strict column semantics and numeric precision requirements, that approach complements Elasticsearch by providing a dedicated query layer optimized for tabular data.
Note
The integration described on this page is an example of a custom deployment pattern. It is not a productized or officially supported Squirro feature. The third-party components involved are maintained by their respective communities, and Squirro does not provide support for them.
How It Works#
The setup involves four components that form a chain between your data and the agent:
DuckDB
A third-party lightweight, analytical SQL database. Data is loaded from CSV files or other tabular sources into a
.duckdbfile that the MCP server accesses in read-only mode.A DuckDB-compatible MCP server
A third-party MCP server that reads the
.duckdbfile and exposes query capabilities over the MCP protocol. The server speaks the stdio transport by default, so an HTTP proxy is needed to make it reachable over the network. - mcp-server-motherduckA third-party MCP server published by MotherDuck, the
managed DuckDB cloud service. Although it is designed to connect to the MotherDuck cloud, it also operates entirely against a local .duckdb file when given a –db-path flag — no cloud account or token is needed in that mode. Launched with –read-only, it exposes SQL query capabilities over the MCP protocol. Like most MCP servers it speaks the stdio transport by default, so an HTTP proxy is needed to make it reachable over the network.
An MCP proxy
A third-party lightweight proxy that wraps the MCP server and exposes it over HTTP using the Streamable HTTP transport. That HTTP endpoint is what Squirro connects to. Because the connection is HTTP-based, the DuckDB stack does not need to run on the same host as Squirro. You can deploy it on a separate system and reach it over the network.
MCP Server Tools
The Squirro agent tool that connects to the MCP proxy endpoint and exposes the database query capabilities to the agent.
When a user submits a question in natural language, the agent calls the MCP Server Tools, which forwards the request to the MCP proxy. The proxy passes the request to the MCP server, which queries the DuckDB database and returns the results to the agent.
Example Docker Setup#
The following example shows how to package the MCP server and its HTTP proxy together in a Docker container. The .duckdb file is copied into the image at build time, so the container is self-contained and portable.
Building the database file#
Before building the container, you need a .duckdb file populated with your data. The DuckDB Python library provides a straightforward way to load CSV files:
import duckdb
conn = duckdb.connect("your_data.duckdb")
conn.execute("CREATE TABLE my_table AS SELECT * FROM read_csv_auto('data.csv')")
conn.close()
For multiple files or more complex schemas, repeat the CREATE TABLE statement for each source. The DuckDB CLI is an alternative for quick one-off imports:
duckdb your_data.duckdb "CREATE TABLE my_table AS SELECT * FROM read_csv_auto('data.csv');"
Dockerfile#
The Dockerfile installs both third-party tools at build time and starts the proxy wrapping the MCP server at container startup. The --read-only flag restricts the server to read queries only.
FROM python:3.11-slim
RUN pip install --no-cache-dir uv
WORKDIR /app
COPY your_data.duckdb /app/your_data.duckdb
ENV PATH="/root/.local/bin:${PATH}"
RUN uv tool install mcp-proxy && \
uv tool install mcp-server-motherduck
EXPOSE 8000
CMD ["mcp-proxy", \
"--port", "8000", \
"--host", "0.0.0.0", \
"--transport", "streamablehttp", \
"--", \
"mcp-server-motherduck", \
"--db-path", "/app/your_data.duckdb", \
"--read-only"]
Docker Compose file#
services:
mcp-server:
build:
context: .
dockerfile: Dockerfile
container_name: your-mcp-server
ports:
- "8000:8000"
restart: unless-stopped
environment:
- PYTHONUNBUFFERED=1
Once the container starts, the MCP server is reachable at http://<host>:8000/mcp. The server must be on the same network as Squirro, or accessible via port forwarding.
Configuring MCP Server Tools#
Once the container is running, follow the steps on the MCP Server Tools page to add MCP Server Tools to your agent. Set Server URL to the MCP proxy endpoint, for example http://<host>:8000/mcp, and use the Include Tools field to expose only the tools relevant to your use case.
Getting Assistance#
For assistance with MCP Server Tools configuration, visit the Squirro Support website and submit a technical support request.