AS Help MCP Server
MCP server for B&R Automation Studio help documentation search. Provides keyword search by default using LanceDB's native full-text search (FTS), and optional hybrid semantic + keyword search using Reciprocal Rank Fusion (RRF) when an embedding API is configured.
Features
- Keyword search (default): Fast full-text search using LanceDB's native FTS — no external dependencies
- Hybrid search (optional): RRF fusion of vector similarity and keyword matching when embeddings are enabled
- API-based embeddings: Works with any OpenAI-compatible endpoint (Ollama, OpenAI, Azure OpenAI, GitHub Models, LiteLLM) — no local ML models required
- Smart ranking: Query-type detection shifts weights between FTS and vectors (identifiers like
MC_MoveAbsolutefavor exact match; natural language favors semantic similarity) - Category filtering and hierarchical browsing
- Auto-generated links to B&R online help (AS4/AS6)
- HelpID lookup for context-sensitive help integration
- Incremental reindexing — only changed pages are re-processed (works with both FTS-only and hybrid tables)
- Graceful degradation — if embedding API fails, keyword search remains available
- Security hardened — path traversal prevention, LIKE wildcard injection protection, UTF-8 safe string handling
Prerequisites
- B&R Automation Studio installed (or its help files copied/mounted on macOS)
- VS Code with GitHub Copilot extension
- For standalone binary: Download the Windows
.exeor macOS Apple Silicon binary from Releases — no build tools required - For building from source: Rust 1.91+
- Optional (for hybrid search): An OpenAI-compatible embedding API (e.g., Ollama with
nomic-embed-text)
Quick Start (VS Code)
Add to .vscode/mcp.json in your workspace:
Option 1: Standalone Binary (Recommended)
Download the platform-appropriate binary from Releases. Windows users should place the .exe in %APPDATA%\as-help-mcp\.
{
"servers": {
"as-help": {
"command": "${env:APPDATA}\\as-help-mcp\\as-help-server.exe",
"args": [
"--help-root",
"C:\\Program Files (x86)\\BRAutomation\\AS6\\Help-en\\Data",
"--db-path",
"${env:APPDATA}\\as-help-mcp\\data\\as6\\.ashelp_lance",
"--metadata-dir",
"${env:APPDATA}\\as-help-mcp\\data\\as6\\.ashelp_metadata",
"--as-version",
"6"
]
}
}
}
Update --help-root to match your AS installation:
- AS 4.x:
C:\\BRAutomation\\AS412\\Help-en\\Data - AS 6.x:
C:\\Program Files (x86)\\BRAutomation\\AS6\\Help-en\\Data
On Apple Silicon macOS, download as-help-server-macos-arm64, make it executable, and place it somewhere on your PATH:
mkdir -p ~/.local/bin
cp ~/Downloads/as-help-server-macos-arm64 ~/.local/bin/
chmod +x ~/.local/bin/as-help-server-macos-arm64
Then use it in .vscode/mcp.json:
{
"servers": {
"as-help": {
"command": "/Users/you/.local/bin/as-help-server-macos-arm64",
"args": [
"--help-root",
"/Users/you/AS6/Help-en/Data",
"--db-path",
"/Users/you/.ashelp/data/as6/.ashelp_lance",
"--metadata-dir",
"/Users/you/.ashelp/data/as6/.ashelp_metadata",
"--as-version",
"6"
]
}
}
}
Option 2: Build from Source
git clone <repository-url>
cd as-help-mcp
On macOS, install the required Protocol Buffers compiler first:
brew install protobuf
Then build:
cargo build --release
The binary is at target/release/as-help-server on macOS or target/release/as-help-server.exe on Windows.
{
"servers": {
"as-help": {
"command": "C:\\path\\to\\as-help-mcp\\target\\release\\as-help-server.exe",
"args": [
"--help-root",
"C:\\Program Files (x86)\\BRAutomation\\AS6\\Help-en\\Data",
"--db-path",
"C:\\path\\to\\data\\.ashelp_lance",
"--metadata-dir",
"C:\\path\\to\\data\\.ashelp_metadata",
"--as-version",
"6"
]
}
}
}
Restart VS Code, then test in Copilot Chat: "Search AS help for mapp Motion"
First run takes 2-3 minutes to build the keyword search index. Subsequent starts are instant (~3s).
Enabling Hybrid Search (Optional)
By default, the server uses keyword-only search (FTS). To enable hybrid semantic + keyword search, configure an OpenAI-compatible embedding API.
Example: Ollama (Local, Free)
- Install Ollama and pull an embedding model:
ollama pull nomic-embed-text
- Add
--create-embeddings trueand embedding environment variables to your MCP config:
{
"servers": {
"as-help": {
"command": "${env:APPDATA}\\as-help-mcp\\as-help-server.exe",
"args": [
"--help-root", "C:\\Program Files (x86)\\BRAutomation\\AS6\\Help-en\\Data",
"--db-path", "${env:APPDATA}\\as-help-mcp\\data\\as6\\.ashelp_lance",
"--metadata-dir", "${env:APPDATA}\\as-help-mcp\\data\\as6\\.ashelp_metadata",
"--as-version", "6",
"--create-embeddings", "true"
],
"env": {
"EMBEDDING_API_ENDPOINT": "http://localhost:11434",
"EMBEDDING_API_KEY": "ollama",
"EMBEDDING_MODEL": "nomic-embed-text",
"EMBEDDING_DIMENSIONS": "768",
"EMBEDDING_BATCH_SIZE": "100",
"EMBEDDING_MAX_CHARS": "4000"
}
}
}
}
Any OpenAI-compatible endpoint works — OpenAI, Azure OpenAI, GitHub Models, LiteLLM, etc.
How Hybrid Search Works
When embeddings are enabled, the server uses Reciprocal Rank Fusion (RRF) to combine four search signals:
Query-type detection automatically selects weights: identifier queries (e.g., MC_MoveAbsolute, X20DI9371) shift toward FTS + title match; natural language queries favor vector similarity.
For a deep dive into the RAG architecture, see RAG.md.
CLI Arguments
Run as-help-server --help for full details.
Transport Configuration (Environment Variables)
Embedding Configuration (Environment Variables)
These are only needed when --create-embeddings true is set:
Development
Building
cargo build # Debug build
cargo build --release # Optimized release build
Testing
cargo test
Project Structure
src/
main.rs # Entry point, transport setup (stdio + StreamableHTTP)
server.rs # FastMCP server, tool/prompt handlers
indexer.rs # XML parsing, HTML text extraction, breadcrumbs
search_engine.rs # LanceDB FTS + hybrid search with RRF
embeddings.rs # Optional API-based embedding service
config.rs # CLI args + env var configuration
models.rs # Shared data types
Performance
Tools
Prompts
Multiple AS Versions
{
"servers": {
"as-help-4": {
"command": "${env:APPDATA}\\as-help-mcp\\as-help-server.exe",
"args": [
"--help-root", "C:\\BRAutomation\\AS412\\Help-en\\Data",
"--db-path", "${env:APPDATA}\\as-help-mcp\\data\\as4\\.ashelp_lance",
"--metadata-dir", "${env:APPDATA}\\as-help-mcp\\data\\as4\\.ashelp_metadata",
"--as-version", "4"
]
},
"as-help-6": {
"command": "${env:APPDATA}\\as-help-mcp\\as-help-server.exe",
"args": [
"--help-root", "C:\\Program Files (x86)\\BRAutomation\\AS6\\Help-en\\Data",
"--db-path", "${env:APPDATA}\\as-help-mcp\\data\\as6\\.ashelp_lance",
"--metadata-dir", "${env:APPDATA}\\as-help-mcp\\data\\as6\\.ashelp_metadata",
"--as-version", "6"
]
}
}
}
License
MIT