RA-Nested-MCP
A two-layer nested MCP server that acts as a telecom Revenue Assurance knowledge agent. It uses an orchestrator LLM (Llama 3.3 70B via Groq) to decompose questions, retrieve from a local vector store of RA documents, and synthesize answers, all running on free tiers.
README
RA-Nested-MCP
A two-layer nested MCP (Model Context Protocol) system demonstrating MCP composition over HTTP/SSE — a server that is simultaneously a client to another MCP server.
This is a fork/extension of Origin-Digital-LLC/nested-mcps, adapted from a generic "Acme Robotics" demo into a telecom Revenue Assurance knowledge agent, and re-plumbed to run without Azure:
| Original | This fork | |
|---|---|---|
| Knowledge base | Acme Robotics (fictional company) | Telecom Revenue Assurance concepts (leakage, CDRs, CRMS/RMS, ETL, CPI) |
| Embeddings | Azure OpenAI (text-embedding-3-small) |
Local sentence-transformers (all-MiniLM-L6-v2) — no API key |
| Orchestrator LLM | GPT-4.1 via Azure AI Foundry | Llama 3.3 70B via Groq's free API tier (OpenAI-compatible tool calling) |
| Cost to run | Requires Azure billing | $0 — entirely free tiers, no credit card needed |
The architecture, agentic loop, and stdio↔HTTP proxy pattern are unchanged from the original.
Architecture
Claude Desktop
│ stdio
▼
[stdio proxy] ← spawned by Claude Desktop, bridges stdio ↔ HTTP
│ HTTP/SSE (:8002)
▼
MCP 2: Orchestrator ← FastAPI/uvicorn, runs on the server
│ HTTP/SSE (:8001)
▼
MCP 1: Vector Store ← FastAPI/uvicorn, internal only
MCP 1 (mcp1_vectorstore) is a low-level in-memory vector store. On startup it embeds 10 Revenue Assurance documents locally via sentence-transformers, then serves semantic search using numpy cosine similarity. It runs as a standalone HTTP service and is never exposed to Claude Desktop directly.
MCP 2 (mcp2_orchestrator) runs an agentic reasoning loop using Llama 3.3 70B via Groq's free API tier. It exposes a single ask tool via HTTP/SSE, decomposes questions into tasks, retrieves against MCP 1 over HTTP, and synthesizes a final answer. Independent tasks are dispatched in parallel via asyncio.gather.
The proxy (extension/server/proxy.py) is a thin stdio↔HTTP bridge. Claude Desktop spawns it locally; it connects to MCP 2 over the network. This is the only piece that runs on client machines.
Project Structure
src/
├── mcp1_vectorstore/
│ ├── documents.py # Revenue Assurance knowledge base (10 docs)
│ ├── settings.py # embedding_model, port
│ └── server.py # FastAPI/SSE: search + list_documents tools
└── mcp2_orchestrator/
├── settings.py # groq_api_key, groq_model, mcp1_url
├── mcp1_client.py # HTTP/SSE client wrapping MCP 1
├── agent.py # Agentic loop: scratchpad, task planning, parallel search
└── server.py # FastAPI/SSE: exposes the ask tool
extension/
├── manifest.json # Claude Desktop Extension manifest
└── server/
└── proxy.py # stdio ↔ HTTP/SSE bridge (runs on client machines)
Server Setup
1. Install dependencies
uv sync
The first run of MCP 1 will download the all-MiniLM-L6-v2 model (~90MB) from Hugging Face automatically — this requires network access once, then it's cached locally and runs fully offline.
2. Configure environment
cp .env.example .env
# Fill in your GROQ_API_KEY (free — get one at https://console.groq.com, no card required)
No Azure account, no paid API billing — this project runs entirely on free tiers (Groq's free API + a locally-run embedding model).
3. Start the servers
In two separate terminals:
make run-mcp1 # vector store on http://0.0.0.0:8001
make run-mcp2 # orchestrator on http://0.0.0.0:8002
Connecting Claude Desktop (local dev)
Run make claude-config to print the config block, then paste it into %APPDATA%\Claude\claude_desktop_config.json and restart Claude Desktop.
This spawns proxy.py via WSL, which connects to MCP 2 over HTTP. Both servers must be running first.
Enterprise Deployment (claude.ai)
For enterprise claude.ai, no proxy or client-side installation is needed:
- Deploy MCP 2 on an internal server with a publicly reachable HTTPS URL
- An org admin adds the URL once: claude.ai → Settings → Connectors → Add custom connector
- Users click to enable it — no URL entry, no configuration
MCP 1 stays internal; only MCP 2 needs to be reachable from Claude's servers (claude.ai's connector infrastructure).
Distributing via Claude Desktop Extension (.mcpb)
Any Claude Desktop user — not just local dev — needs the proxy to connect to an internal server, since Claude Desktop only speaks stdio. The .mcpb packages the proxy and all Python dependencies into a one-click install.
make pack # produces ra-orchestrator-proxy.mcpb
Before packing, update MCP2_URL in extension/manifest.json to point at your internal server. Distribute the .mcpb to users — they double-click it in Windows Explorer and Claude Desktop installs it automatically.
Tools
MCP 1 tools (internal, HTTP only)
| Tool | Input | Output |
|---|---|---|
search |
query: str, top_k: int = 3 |
[{doc_id, content, score}] |
list_documents |
— | [{doc_id, content}] |
MCP 2 tool (exposed via HTTP/SSE)
| Tool | Input | Output |
|---|---|---|
ask |
question: str |
synthesized answer string |
Agentic Loop
The agent in agent.py maintains a per-request scratchpad:
{
"question": str,
"tasks": [{"id", "description", "status", "depends_on", "result"}],
"final_answer": str | None
}
The LLM drives the loop using four internal tools: add_task, complete_task, search_knowledge, and finish. Tasks with satisfied dependencies are dispatched concurrently. The loop is hard-capped at 10 iterations.
Test Questions
These questions require multi-hop retrieval over the Revenue Assurance knowledge base. The answers are not derivable from any LLM's training data alone — they depend on the specific document set in documents.py.
Sequential (two-hop):
"What is the relationship between CRMS and RMS, and how does a mismatch between them lead to revenue leakage?"
Parallel + synthesis:
"Compare where leakage originates in rating/mediation versus what CPI validation is meant to prevent — how do these two failure points differ?"
Multi-hop stretch:
"Walk through how a duplicate CDR moves through the ETL pipeline and which stage should catch it, then explain how that failure would show up in the RA KPIs."
Credits
Original architecture and implementation: Origin-Digital-LLC/nested-mcps. This fork adapts the domain to telecom Revenue Assurance and swaps Azure OpenAI for local embeddings (sentence-transformers) + Groq's free API tier — the whole project runs at zero cost.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。