roshan-baaz-mcp
Enables semantic search and retrieval for Persian content through Roshan AI's Baaz service, wrapped as MCP tools with support for multi-instance self-hosted deployments.
README
<div align="center">
<img src="assets/banner.svg" alt="roshan-baaz-mcp" width="100%" />
<img src="assets/icons/baaz.svg" height="100" alt="Baaz icon"/>
roshan-baaz-mcp
A self-hostable Model Context Protocol server for Roshan AI's Baaz (باز) Persian semantic-search service.
<sub>Built from the public API documentation at <a href="https://docs.roshan-ai.ir">docs.roshan-ai.ir</a>. Unofficial community integration.</sub>
</div>
What is this?
Baaz (باز) is Roshan AI's Persian-native semantic search and retrieval service. You give it documents; it chunks them, computes embeddings, and stores them across an Elasticsearch + Weaviate backend. You can then run semantic queries, find similar documents, check document status, fetch full documents, and manage indices — all tuned for Persian (فارسی) content.
roshan-baaz-mcp wraps that HTTP API as MCP tools so Claude — or any
MCP-compatible client — can call Baaz as first-class tools.
Baaz is self-hostable, and a single deployment is rarely enough: teams run
many independent Baaz instances (per region, per tenant, per environment).
This server treats named instances as a core concept — one MCP process can
route every tool call to the right Baaz deployment via an optional instance
argument.
Highlights
- 100% endpoint coverage — every documented Baaz endpoint is a tool.
- Multi-instance / self-hosting first — route by
instance; tokens are never exposed bylist_instances. - Guardrails — http(s) URL validation, ~10MB body cap, pagination clamps, and token redaction in every error path.
- Offline docs tool —
roshan_baaz_docsdescribes the service and tools without any network call.
Tool reference
Every tool accepts an optional instance: str | None selecting which configured
Baaz deployment to call (defaults to default_instance).
| Tool | Method & endpoint | Purpose |
|---|---|---|
baaz_index |
POST /{index}/index |
Index/update a batch of documents (chunked + embedded). |
baaz_semantic_search |
POST /{index}/document/semantic_query |
Semantic query → ranked documents with matching chunks. |
baaz_document_status |
POST /{index}/document_status |
Check whether documents (by URL) already exist. |
baaz_delete_index |
DELETE /{index}/delete_index |
Delete an entire index and all its documents. |
baaz_delete_documents |
DELETE /{index}/delete_index (body {type}) |
Delete only documents of one type. |
baaz_stats |
GET /{index}/stats |
Index statistics keyed by {index}_{type}. |
baaz_similar_documents |
POST /{index}/similar/documents |
Find documents similar to a given document_id. |
baaz_view_document |
GET /{index}/document/view?id= |
Fetch a full document by id. |
healthcheck |
GET /healthcheck |
Check that an instance is up and ready. |
list_instances |
(local) | List configured instances — names + base URLs only, never tokens. |
roshan_baaz_docs |
(local) | Offline docs about Baaz and these tools. |
See the Baaz API guide for full request/response field semantics.
Install
Requires Python 3.10+ (developed and tested on 3.11).
git clone https://github.com/roshan-research/roshan-baaz-mcp.git
cd roshan-baaz-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e . # add ".[dev]" for the test/lint toolchain
Run it (stdio transport by default):
python -m roshan_baaz_mcp # or: roshan-baaz-mcp
python -m roshan_baaz_mcp --help # transports, host/port, log level
Configuration (multi-instance)
Configuration is read from environment variables via pydantic-settings.
Shorthand (single instance)
The fastest way to point at one Baaz deployment. This synthesizes an instance
named default:
| Variable | Default | Description |
|---|---|---|
ROSHAN_BAAZ_BASE_URL |
https://baaz.roshan-ai.ir |
Base URL of the Baaz deployment. |
ROSHAN_BAAZ_TOKEN |
(none) | Token sent as Authorization: Token <token>. |
export ROSHAN_BAAZ_BASE_URL=https://baaz.roshan-ai.ir
export ROSHAN_BAAZ_TOKEN=your-secret-token
Nested (one or many named instances)
Prefix ROSHAN_BAAZ__, nested delimiter __. Each instance under
INSTANCES__<NAME>__:
| Variable | Default | Description |
|---|---|---|
ROSHAN_BAAZ__INSTANCES__<NAME>__BASE_URL |
https://baaz.roshan-ai.ir |
Base URL of that instance. |
ROSHAN_BAAZ__INSTANCES__<NAME>__TOKEN |
(none) | Auth token for that instance. |
ROSHAN_BAAZ__INSTANCES__<NAME>__VERIFY_SSL |
true |
Verify the TLS certificate. |
ROSHAN_BAAZ__INSTANCES__<NAME>__TIMEOUT |
60 |
Per-request timeout (seconds). |
ROSHAN_BAAZ__DEFAULT_INSTANCE |
default |
Instance used when a tool omits instance. |
ROSHAN_BAAZ__LOG_LEVEL |
INFO |
Logging level. |
# Two self-hosted regions behind one MCP server
export ROSHAN_BAAZ__INSTANCES__TEHRAN__BASE_URL=https://baaz.tehran.example.ir
export ROSHAN_BAAZ__INSTANCES__TEHRAN__TOKEN=tehran-token
export ROSHAN_BAAZ__INSTANCES__MASHHAD__BASE_URL=https://baaz.mashhad.example.ir
export ROSHAN_BAAZ__INSTANCES__MASHHAD__TOKEN=mashhad-token
export ROSHAN_BAAZ__DEFAULT_INSTANCE=tehran
Tools then target a deployment with instance="mashhad"; omit it to use the
default. Call list_instances to discover configured names (tokens are never
returned).
Use with an MCP client
Add the server to your MCP client (e.g. Claude Desktop) config:
{
"mcpServers": {
"roshan-baaz": {
"command": "python",
"args": ["-m", "roshan_baaz_mcp"],
"env": {
"ROSHAN_BAAZ_BASE_URL": "https://baaz.roshan-ai.ir",
"ROSHAN_BAAZ_TOKEN": "your-secret-token"
}
}
}
}
Architecture
The MCP client talks to roshan-baaz-mcp over a transport (stdio by default).
The server resolves the requested instance, applies guardrails, and calls the
Baaz HTTP API.

Request flow
A typical retrieval session: index documents, run a semantic query, read the ranked results, then optionally expand with similar documents.

Self-hosting & scaling
Because Baaz is self-hosted, one MCP process can front many Baaz deployments,
routing each tool call by its instance argument (region / tenant / environment).

Scaling notes:
- Stateless — the server holds no per-request state; run as many replicas as you need behind your scheduler. Configuration comes entirely from the environment.
- One process, many instances — add instances by setting more
ROSHAN_BAAZ__INSTANCES__<NAME>__*variables; no code changes. - Rate limits — Baaz limits to ~100 requests/minute per deployment; spread
heavy load across instances and back off on
429. - Body cap — requests are capped at ~10MB (enforced client-side before the call); batch large indexing jobs accordingly.
- Horizontal autoscaling — a Kubernetes HPA manifest and Helm chart ship in
deploy/.
Deployment
Ready-to-use manifests live in deploy/:
- Docker —
Dockerfileand a two-instancedocker-compose.yml. - Kubernetes — raw manifests in
deploy/kubernetes/(namespace, configmap, secret, deployment, service, ingress, hpa, kustomization). - Helm — chart in
deploy/helm/roshan-baaz-mcp/. - Terraform — example in
deploy/terraform/.
See deploy/README.md for details.
Testing
pip install -e ".[dev]"
python -m pytest -q # all HTTP is mocked with respx; no network
ruff check src tests
Optional live tests run against a real Baaz deployment when you opt in:
export ROSHAN_BAAZ_LIVE=1
export ROSHAN_BAAZ_BASE_URL=https://baaz.roshan-ai.ir
export ROSHAN_BAAZ_TOKEN=your-secret-token
python -m pytest tests/live -q
There is also a no-network smoke test that asserts every tool has a non-empty
description and an instance parameter:
python scripts/smoke_test.py
Examples
examples/inspect_server.py prints the
registered tools and their schemas without any network call. See
examples/README.md.
License
MIT. Baaz (باز) and Roshan AI are products/trademarks of Roshan AI; this is an unofficial, community-maintained integration built from public docs.
<div align="center">
<img src="assets/icons/roshan.svg" alt="roshan-logo" width="40%"/>
</div>
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。