|
|
||
|---|---|---|
| downloads | ||
| examples | ||
| library | ||
| plan | ||
| src/manuals_mcp | ||
| tests | ||
| .gitignore | ||
| AGENTS.md | ||
| README.md | ||
| pyproject.toml | ||
| status.md | ||
README.md
manufacturer-manuals-mcp
Production-oriented MCP service for manufacturer manual discovery and local manual library management.
Operating modes
- MCP service mode (for agents):
- agents call MCP tools/resources exposed by
ManualsMCPApplication. - RBAC is enforced by role/token (
read,write,admin).
- agents call MCP tools/resources exposed by
- Operator utility mode (manual operations via Python/CLI-style scripts):
- operator runs scripted/manual tool calls through Python (
app.call_tool(...)). - suitable for terminal-driven workflows and automation jobs.
- operator runs scripted/manual tool calls through Python (
- Operator WebUI mode (browser):
- FastAPI + Jinja UI over the same
ManualsMCPApplicationobject and tool set. - routes under
/ui/*, cookie-token auth, role-based action gating.
- FastAPI + Jinja UI over the same
Features
- Search by
product_code,model_name, or free-formquery. - Offline-first search behavior for
find_product_manuals: local library + local content index only. - Legacy external-search inputs (
search_scope,allow_unofficial_fallback,max_external_candidates) are compatibility-only. - Strict version policy: default
latest_non_obsolete. - Obsolete versions are returned only with explicit request.
- Manual ingestion supports exactly one source:
- local file (
file_path) - direct URL download (
download_url)
- local file (
- URL ingest source policy:
- official/portal URL allowed by default
- unofficial URL requires
allow_unofficial_url=true
- Async ingestion pipeline with task tracking.
- RBAC-style permissions (
read,write,admin).
Project structure
Implemented under src/manuals_mcp/:
models/,normalization/,search/,extraction/library/(repository, ingestion, indexing, versioning, checksums)policy/,security/,observability/tools/,resources/,server.py,config.py
Data layout
Library data:
library/vendors/...for documents and metadatalibrary/index.jsonfor catalog summarylibrary/manuals.dbfor SQLite tables + FTSlibrary/indexes/hnsw_chunks.bin+hnsw_labels.jsonfor ANN sidecarlibrary/downloads/...for URL-ingested source files
Main tools
find_product_manualsfind_manual_versionsget_manual_by_versioningest_manual_document(supportsfile_pathORdownload_url)get_ingestion_task_statuslist_library_documentsset_latest_manual_versionmark_manual_obsoletereindex_library_content
MCP service profile
- Primary entrypoint:
manuals_mcp.server.create_app. - Tool execution API:
app.call_tool(tool_name, args, ctx=ToolContext(token=...)). - Resource API:
app.read_resource(resource_uri). - Queue worker API:
app.process_ingestion_queue(). - Search behavior:
- local-only for
find_product_manuals(offline mode). - legacy external-search inputs remain accepted for compatibility and are ignored with warning.
- local-only for
Resources
resource://vendors/catalogresource://vendors/{vendor}/domainsresource://library/catalogresource://library/{vendor}/{model}resource://library/{vendor}/{model}/{doc_type}resource://library/index/stats
Install
python -m venv .venv
. .venv/Scripts/activate
pip install -e .[test]
Optional embedding stack:
pip install -e .[embeddings]
Run
Local app bootstrap
python -c "from manuals_mcp.server import create_app; app = create_app(); print('ready')"
Run WebUI/API process
python -m manuals_mcp.server_api
Open http://127.0.0.1:8080/ui/login (or values from env MANUALS_MCP_WEB_HOST/MANUALS_MCP_WEB_PORT).
Minimal local worker for async ingestion queue
from manuals_mcp.server import create_app
app = create_app()
processed = app.process_ingestion_queue()
print(f"processed tasks: {processed}")
Run worker entrypoint (systemd/timer friendly)
python -m manuals_mcp.worker
Usage
read tools can be called without token context.
write/admin tools require ToolContext(token=...) with mapped role in AuthConfig.
1. Search manuals (offline behavior)
from manuals_mcp.server import create_app
app = create_app()
result = app.call_tool(
"find_product_manuals",
{
"query": "C9300 installation guide",
"version_policy": "latest_non_obsolete",
"search_scope": "hybrid", # compatibility input, external lookup is disabled
"allow_unofficial_fallback": True, # compatibility input, ignored in offline mode
"max_external_candidates": 10, # compatibility input, ignored in offline mode
"max_results": 5,
},
)
print(result["warnings"])
Operator utility workflow (terminal/script)
from manuals_mcp.config import AuthConfig, ManualsMCPConfig
from manuals_mcp.server import ToolContext, create_app
cfg = ManualsMCPConfig(
auth=AuthConfig(token_roles={"writer-token": "write", "admin-token": "admin"})
)
app = create_app(cfg)
writer_ctx = ToolContext(token="writer-token")
# 1) find manuals in local library (offline search)
print(
app.call_tool(
"find_product_manuals",
{"query": "C9300 installation guide", "version_policy": "latest_non_obsolete"},
)
)
# 2) enqueue ingestion from local file or exact URL
accepted = app.call_tool(
"ingest_manual_document",
{
"vendor": "Cisco",
"model": "Catalyst 9300",
"product_code": "C9300-48P",
"title": "Catalyst 9300 Installation Guide",
"doc_type": "installation_guide",
"source_type": "manual_upload_verified",
"file_path": "examples/sample_manual.txt",
},
ctx=writer_ctx,
)
# 3) process queue and inspect status
app.process_ingestion_queue()
print(app.call_tool("get_ingestion_task_status", {"task_id": accepted["task_id"]}, ctx=writer_ctx))
WebUI routes (v1)
GET /health/live- liveness probeGET /ui/login,POST /ui/login,POST /ui/logoutGET /ui/library- browse + filtersGET /ui/search- offline manual search (warnings shown in UI)GET /ui/versions- known versions for query/deviceGET /ui/ingest,POST /ui/ingest- ingest by server-sidefile_pathor exactdownload_urlGET /ui/tasks/{task_id}- ingestion statusPOST /ui/version/set-latest- admin actionPOST /ui/version/mark-obsolete- admin action
WebUI role model
read: library/search/versions pageswrite: ingest page/actions + task statusadmin: all above + version state actions (set-latest,mark-obsolete,reindexvia API/tool)
2. Ingest manual document from local file
from pathlib import Path
from manuals_mcp.config import AuthConfig, ManualsMCPConfig
from manuals_mcp.server import ToolContext, create_app
cfg = ManualsMCPConfig(auth=AuthConfig(token_roles={"writer-token": "write"}))
app = create_app(cfg)
writer_ctx = ToolContext(token="writer-token")
Path("examples/sample_manual.txt").write_text("C9300 installation guide version 17.9", encoding="utf-8")
accepted = app.call_tool(
"ingest_manual_document",
{
"vendor": "Cisco",
"model": "Catalyst 9300",
"product_code": "C9300-48P",
"title": "Catalyst 9300 Installation Guide",
"doc_type": "installation_guide",
"version": "17.9",
"language": "en",
"publication_date": "2025-01-20",
"source_type": "manual_upload_verified",
"file_path": "examples/sample_manual.txt",
"mark_as_latest": True,
"official": True,
},
ctx=writer_ctx,
)
print(accepted)
3. Ingest manual document by exact URL
accepted = app.call_tool(
"ingest_manual_document",
{
"vendor": "Cisco",
"model": "Catalyst 9300",
"product_code": "C9300-48P",
"title": "Catalyst 9300 Installation Guide",
"doc_type": "installation_guide",
"version": "17.9",
"language": "en",
"publication_date": "2025-01-20",
"download_url": "https://www.cisco.com/support/manuals/c9300-installation-guide.pdf",
"allow_unofficial_url": False,
"mark_as_latest": True,
},
ctx=writer_ctx,
)
print(accepted)
4. Check ingestion task status
status = app.call_tool(
"get_ingestion_task_status",
{"task_id": accepted["task_id"]},
ctx=writer_ctx,
)
print(status)
5. Token/RBAC call
from manuals_mcp.config import AuthConfig, ManualsMCPConfig
from manuals_mcp.server import ToolContext, create_app
cfg = ManualsMCPConfig(
auth=AuthConfig(token_roles={"admin-token": "admin", "writer-token": "write"})
)
app = create_app(cfg)
admin_ctx = ToolContext(token="admin-token")
app.call_tool("reindex_library_content", {"vendor": "Cisco"}, ctx=admin_ctx)
Linux deployment examples
See:
examples/deploy/linux/manuals-mcp.env.exampleexamples/deploy/linux/manuals-mcp-api.serviceexamples/deploy/linux/manuals-mcp-worker.serviceexamples/deploy/linux/manuals-mcp-worker.timerexamples/deploy/linux/nginx/manuals-mcp.confexamples/deploy/linux/DEPLOYMENT.md
The sample units are for operator-managed Linux environments (systemd + nginx + env).
Tests
pytest
Notes
- Embedding backend defaults to
intfloat/multilingual-e5-small. - If embedding dependencies are missing, deterministic hash embeddings are used as fallback.
- OCR for scanned PDFs is intentionally deferred in V1.