
n2-QLN:MCP智能工具路由器与语义搜索层。通过1个接口连接1000+工具。防止AI模型混淆,最大化上下文窗口效率
概览
= **uery **ayer **etwork —— 一个位于 AI 和你的工具之间的语义工具路由器。 AI只看到路由器——而不是所有1000个工具。 每个MCP工具都会消耗上下文代币。10个工具?好吧。100?慢。——在对话开始前,背景已经足够。 1. 所有工具都被索引在QLN的SQLite引擎中 2.AI看到:n2_qln_call(~200个令牌) 3.AI搜索→找到最佳匹配→自动备份执行 扫描连接的MCP服务器并自动索引其工具——QLN变成了。 连续失败3次的工具会自动被禁用。60秒后,QLN尝试恢复。没有连锁失败,没有浪费请求。 自动模式现在最多尝试3名排名候选人。如果顶级对手失败,QLN会自动切换到下一个最佳工具。 通过boostKeywords为工具添加精选搜索词。这些词在BM25排名中获得2×的权重,提升了可发现性,同时不增加上下文负担。
概述(AI 翻译)
🇰🇷 한국어
N2-qln
QLN = Query Layer Network —— 一个位于 AI 和你的工具之间的语义工具路由器。
将1,000+工具路由到一个MCP工具。 AI只看到路由器——而不是全部1,000个工具。
目录
- 为什么是QLN
- v4.1 新增内容
- 快速入门
- 工作原理
- API 参考
- MCP自动发现
- 提供者清单
- 配置
- 项目结构
- 常见问题解答
- 贡献
为什么是昆士兰
每个MCP工具都会消耗上下文代币。10个工具?好吧。100?慢。1,000?不可能——在对话开始前,背景已经足够充分。
QLN解决了这个问题:
- 所有工具都被索引在 QLN 的 SQLite 引擎中
- AI只看到一个工具:
n2_qln_call(~200个令牌) - AI搜索→找到最佳匹配→自动回退执行
结果:~200个代币,而非~50,000。99.6%的减少。
特色
| 特色 | 描述 |
|---|---|
| 1个工具 = 1,000个工具 | AI识别n2_qln_call(~200个令牌),QLN会路由到正确的工具 |
| Sub-5ms 搜索三级引擎:触发匹配→ BM25 关键词 →语义向量 | |
| 自动模式 | 一次性搜索+自信执行门槛和备份链条 |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
🇰🇷 한국어
n2-qln
QLN = Query Layer Network — a semantic tool router that sits between the AI and your tools.
Route 1,000+ tools through 1 MCP tool. The AI sees only the router — not all 1,000 tools.
Table of Contents
- Why QLN
- What’s New in v4.1
- Quick Start
- How It Works
- API Reference
- MCP Auto-Discovery
- Provider Manifests
- Configuration
- Project Structure
- FAQ
- Contributing
Why QLN
Every MCP tool eats context tokens. 10 tools? Fine. 100? Slow. 1,000? Impossible — context is full before the conversation starts.
QLN solves this:
- All tools are indexed in QLN’s SQLite engine
- The AI sees one tool:
n2_qln_call(~200 tokens) - AI searches → finds the best match → executes with automatic fallback
Result: ~200 tokens instead of ~50,000. 99.6% reduction.
Features
| Feature | Description |
|---|---|
| 1 tool = 1,000 tools | AI sees n2_qln_call (~200 tokens), QLN routes to the right one |
| Sub-5ms search | 3-stage engine: trigger match → BM25 keyword → semantic vector |
| Auto mode | One-shot search + execute with confidence gating and fallback chain |
| Circuit Breaker | Auto-disable failing tools, self-recover after timeout |
| MCP Auto-Discovery | Scan external MCP servers and index their tools automatically |
| Boost Keywords | Curated terms with 2× BM25 weight for precision search |
| Self-learning ranking | Usage count + success rate feed back into scores |
| Source weighting | Prioritize tools by origin (mcp > plugin > local) |
| Hot reload | Edit providers/ manifests at runtime — auto re-indexed |
| Bulk inject | Register hundreds of tools in one call |
| Enforced validation | verb_target naming, min description length, category constraints |
| Semantic search | Optional Ollama embeddings for natural language matching |
| Zero native deps | SQLite via sql.js WASM — npm install and done |
| Dual execution | Local function handlers or HTTP proxy — mix and match |
| TypeScript strict | Full strict-mode codebase since v4.0 |
What’s New in v4.1
🔍 MCP Auto-Discovery
Scan connected MCP servers and auto-index their tools — QLN becomes a universal MCP hub.
n2_qln_call({
action: "discover",
servers: [
安装
npx -y n2-qln配置
{
"mcpServers": {
"n2-qln": {
"command": "npx",
"args": ["-y", "n2-qln"]
}
}
}