rag-tool-agent
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@rag-tool-agentWhat does the FordA dataset contain? Search the notes."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RAG Tool Agent — MCP Server
Exposes the two tools behind the
rag-tool-agent-demo
project (retrieval-grounded Q&A over FordA dataset notes, and a safe
arithmetic calculator) as a proper Model Context
Protocol server, so any MCP-compatible
client — Claude Desktop, an MCP-aware agent harness, or a custom host —
can call them directly instead of only through that project's own CLI or
through the Flask HTTP wrapper in
rag-tool-api-docker.
Built to close a specific, named gap: several current AI-engineer/agentic application postings explicitly ask for hands-on experience with MCP (and related agent-to-agent/agent-to-UI protocols). This is a small, real, tested implementation, not a claim of protocol experience without evidence behind it.
Why it's structured this way
The original agent does its own routing internally — a hand-rolled if/else that decides "calculator" vs. "retrieval" vs. "direct answer" for each incoming question. MCP inverts that: the client (the LLM/agent host) does the routing, by reading each tool's name, description, and JSON-schema parameters and deciding which one to call. So this server doesn't reimplement the original routing logic — it exposes the two underlying capabilities as standalone, independently-callable MCP tools and lets any MCP client route to them itself. That's the actual point of the protocol: tools become host-agnostic instead of hardwired into one agent's dispatch logic.
search_notes(query: str) -> str— retrieval-style lookup over a small inlined notes corpus about the FordA dataset, returned with the same[Grounded in N retrieved chunk(s) from ...]provenance suffix the original agent uses, so a client can tell a grounded answer from an ungrounded one. Uses a small keyword-overlap ranker rather than re-deriving the original project's FAISS/embeddings index — the point of this project is the MCP exposure layer, not duplicating that work.calculate(expression: str) -> str— arithmetic tool, restricted to+ - * / ()and numeric literals via anast-based safe evaluator (not a bareeval()on arbitrary input). Verified to reject both non-arithmetic input and injection attempts like__import__('os').system(...).Built with the official
mcpPython SDK (FastMCP), the same SDK Anthropic publishes for building MCP servers.
Related MCP server: mcp-toolserver
Running it
pip install -r requirements.txt
python server.pyRuns over stdio — the standard local transport MCP clients like Claude Desktop use to launch and talk to a server as a subprocess. To point Claude Desktop at it, add to its MCP server config:
{
"mcpServers": {
"rag-tool-agent": {
"command": "python",
"args": ["/absolute/path/to/server.py"]
}
}
}Running the tests
pytest tests/ -v11 tests, all passing — call the tool functions directly (no MCP transport needed for unit-level coverage of the tool logic itself): grounded retrieval answers, the grounding-count contract, arithmetic correctness (including a division example matching the original agent's own documented example), rejection of non-arithmetic and injection input, division-by-zero handling, and tool self-registration with descriptions.
Verified as a real MCP server, not just as functions
Beyond the unit tests, this was verified end-to-end using the real
mcp client SDK (ClientSession + stdio_client) — spawning server.py
as an actual subprocess, completing the MCP initialize handshake,
calling list_tools(), and calling both tools over the real protocol:
TOOLS: ['search_notes', 'calculate']
calculate -> 1320 / (3601 + 1320) = 0.2682381629750051
search_notes -> The FordA dataset is a univariate time-series
classification dataset... [Grounded in 3 retrieved chunk(s) from
forda_dataset_notes.md]
calculate(injection) -> Error: could not evaluate "__import__('os')" ...That confirms the server speaks real MCP (handshake, tool discovery, tool invocation) and not just that the underlying Python functions work in isolation.
Relationship to the other two projects
rag-tool-agent-demo— the original CLI agent: LangChain, FAISS, Ollama, LCEL retrieval chain, calculator tool, LLM-driven routing.rag-tool-api-docker— that agent wrapped as a Flask HTTP API, containerized (Docker, multi-stage build, non-root user, health check), verified with real HTTP requests against a running container.This project — the same underlying capabilities (retrieval, calculator) exposed over MCP instead of HTTP, so they're callable by any MCP host rather than only by a REST client.
This server cannot be deployed
Maintenance
Related MCP Connectors
Free OpenAI-compatible inference with signed provenance receipts and 3 focused MCP tools.
Find, vet, and run MCP tools through a secure audited gateway with prompt-injection risk scoring
Agentic search over your Dewey document collections from any MCP-compatible client.
Multiple MCP tools, persistent graph memory, token-saving data pointers, and more.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables local document question-answering and retrieval via MCP, supporting multi-turn conversation, intent recognition, and tools for document search, Q&A, and summarization.5-
- FlicenseNot gradedqualityCmaintenanceEnables document search, read-only SQL querying, arithmetic calculation, and corpus introspection through MCP tools, allowing Claude to dynamically discover and chain these tools together to answer multi-step questions.-
- FlicenseNot gradedqualityCmaintenanceEnables querying local documents via retrieval-augmented generation, along with current UTC datetime and safe arithmetic evaluation through MCP tools over HTTP.-
- AlicenseAqualityCmaintenanceProvides a document store, web search, and safe calculator as MCP tools, enabling both offline and LLM-driven clients to discover and call them over the Model Context Protocol.6MIT