OpsLens AI MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpsLens AI MCP ServerAirflow pipeline failed with duplicate key on retry"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpsLens AI
OpsLens AI is an MCP-powered RAG assistant for engineering incident investigation.
It helps engineers search troubleshooting runbooks and historical incidents, retrieve relevant evidence, and generate a cautious investigation plan with sources, confidence, and limitations.
Problem Statement
During a production incident, engineers often spend significant time searching for information across different systems and documents, including:
engineering runbooks
historical incident records
database troubleshooting guides
API and data-pipeline documentation
operational notes
knowledge held by individual team members
The information may exist, but it is often difficult to locate quickly.
Traditional keyword search can also miss relevant information when an incident is described using different terminology.
For example:
The scheduled job reran after partially completing and attempted to
write the same database records again.may describe the same underlying problem as:
An Airflow retry caused a duplicate-key violation.The wording is different, but the meaning is similar.
An engineer must normally:
identify the affected service
search multiple runbooks
compare the symptoms with previous incidents
determine possible root causes
decide what logs, metrics, or records to inspect
verify that the proposed actions are safe
This manual process can delay the beginning of an effective investigation.
Related MCP server: Markdown RAG MCP
What OpsLens AI Does
OpsLens AI provides one interface where an engineer can describe an incident in natural language.
The application then:
searches engineering runbooks using semantic vector retrieval
searches for similar historical incidents
removes weak or unrelated retrieval results
sends only relevant evidence to the language model
generates a structured troubleshooting response
displays the documents and incidents used as evidence
The generated response includes:
incident summary
likely causes
investigation steps
suggested diagnostic commands
similar historical incidents
evidence sources
confidence and limitations
OpsLens AI does not automatically resolve incidents or replace engineering judgment.
Its purpose is to reduce the time spent locating relevant information and help engineers begin an investigation with traceable evidence.
Example
A user enters:
The Airflow campaign-data pipeline partially loaded records before
failing. After its automatic retry, it now receives a duplicate-key
error.OpsLens AI can retrieve:
the Airflow pipeline failure runbook
database duplicate-record guidance
a similar historical incident
It can then explain:
why a partial insert may have caused the retry failure
why idempotency matters
which task attempts and database records should be inspected
whether the pipeline uses
INSERT,UPSERT, orMERGEwhich sources support the investigation
Features
RAG-based engineering runbook search
semantic retrieval using ChromaDB
semantic historical-incident search
MCP server and client integration
MCP tool discovery and invocation
retrieval-distance relevance filtering
evidence-grounded LLM responses
source attribution
unsupported-question detection
retrieval evaluation suite
user-friendly error handling
Streamlit-based portfolio interface
Application Screenshots
Landing Page
Generated Incident Investigation
Retrieved Runbook Evidence
Similar Historical Incidents
Unsupported Incident Handling
Architecture
User
|
v
Streamlit UI
|
v
Incident Analyzer / MCP Client
|
v
MCP Server
|----------------------------|
v v
search_runbooks search_incidents
| |
v v
Runbook ChromaDB Incident ChromaDB
| |
|-------- Retrieved Evidence |
|
v
Relevance Filtering
|
v
Prompt Augmentation
|
v
OpenAI LLM
|
v
Grounded Incident AnalysisHow RAG Works
RAG stands for Retrieval-Augmented Generation.
OpsLens AI uses RAG through the following process:
Engineering runbooks are loaded from Markdown files.
Each runbook is divided into overlapping chunks.
An embedding model converts each chunk into a numerical vector.
ChromaDB stores the document text, vectors, source names, and metadata.
The user’s incident description is converted into a query vector.
ChromaDB retrieves the semantically closest chunks.
Weak matches are removed using a vector-distance threshold.
The remaining evidence is added to the language-model prompt.
The language model generates an evidence-grounded investigation.
Without RAG, the language model would answer using only its general training knowledge.
With RAG, the model receives project-specific evidence before generating the response.
How MCP Is Used
MCP stands for Model Context Protocol.
OpsLens AI runs a local MCP server that exposes the following tools:
search_runbookssearch_incidentsread_runbook
The application acts as an MCP client. It:
starts the MCP server
initializes an MCP session
discovers the tools exposed by the server
invokes tools using structured arguments
receives structured retrieval results
passes the results into the RAG generation workflow
MCP does not replace RAG.
RAG retrieves relevant knowledge and grounds the model response.
MCP standardizes how the AI application accesses tools and data sources.
The current implementation uses deterministic tool orchestration. The application explicitly calls the runbook and historical-incident search tools for each investigation.
MCP Tools
search_runbooks
Searches engineering runbook chunks using semantic vector similarity.
Example input:
{
"query": "Airflow retry caused duplicate records",
"limit": 3,
"max_distance": 0.95
}search_incidents
Searches historical incidents using semantic vector similarity.
Example input:
{
"query": "A scheduled job reran and wrote the same rows again",
"limit": 2,
"max_distance": 1.25
}read_runbook
Reads the complete content of a selected Markdown runbook.
The tool validates the requested filename to prevent access outside the runbook directory.
Technology Stack
Python 3.12
Streamlit
Model Context Protocol Python SDK
ChromaDB
local embedding model
OpenAI Responses API
python-dotenv
Git and GitHub
Project Structure
opslens-ai/
├── app.py
├── config.py
├── evaluation.py
├── incident_analyzer.py
├── incident_retrieval.py
├── llm_service.py
├── mcp_client.py
├── mcp_server.py
├── rag.py
├── requirements.txt
├── README.md
├── docs/
│ └── screenshots/
│ ├── Airflow-Historical-incident.png
│ ├── Airflow-incident-investigation.png
│ ├── Airflow-incident-response.png
│ ├── Landing-page.png
│ └── Unsupported-Incident.png
└── data/
├── incidents.json
└── runbooks/
├── airflow_failures.md
├── api_timeouts.md
└── database_errors.mdLocal Setup
Prerequisites
Install or configure:
Python 3.10 or newer
Git
an OpenAI API key
a terminal
a modern web browser
Check your Python version:
python3 --version1. Clone the repository
git clone https://github.com/vp1410/opslens-ai.git
cd opslens-ai2. Create a virtual environment
python3 -m venv .venvActivate it on macOS or Linux:
source .venv/bin/activateActivate it on Windows PowerShell:
.venv\Scripts\Activate.ps1After activation, the terminal should begin with:
(.venv)3. Install dependencies
python -m pip install --upgrade pip
python -m pip install -r requirements.txt4. Configure environment variables
Create a .env file in the project root:
touch .envAdd:
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL=gpt-5-miniThe .env file must not be committed to GitHub.
The repository’s .gitignore should include:
.env
.venv/
__pycache__/
*.pyc
chroma_db/
.DS_Store
.streamlit/5. Build and test the runbook index
python rag.pyThis command:
loads the Markdown runbooks
divides them into chunks
generates local embeddings
stores the chunks in ChromaDB
runs a sample semantic search
6. Build and test the historical-incident index
python incident_retrieval.pyThis command:
loads the synthetic incident records
creates one searchable document per incident
generates embeddings
stores them in a separate ChromaDB collection
runs a sample semantic search
The generated vector database is stored in:
chroma_db/This directory is generated locally and is excluded from Git.
7. Validate the MCP server
python -c "import mcp_server; print('MCP server valid')"Expected output:
MCP server valid8. Test the MCP client
python mcp_client.pyThis validates:
MCP server startup
session initialization
tool discovery
tool schemas
tool invocation
structured tool responses
9. Test the complete analysis workflow
python incident_analyzer.pyThis runs:
Incident description
|
v
MCP retrieval tools
|
v
Semantic evidence retrieval
|
v
Relevance filtering
|
v
Prompt augmentation
|
v
OpenAI generation10. Run the evaluation suite
python evaluation.pyExpected output:
Evaluation result: 4/4 passedThe evaluation suite tests:
Airflow duplicate-retry retrieval
API-timeout retrieval
duplicate-source-file retrieval
unsupported Kubernetes incident rejection
11. Start the application
python -m streamlit run app.pyThe application should open at:
http://localhost:8501Example Incidents
Airflow Duplicate-Key Failure
The Airflow campaign-data pipeline partially loaded records before
failing. After its automatic retry, it now receives a duplicate-key
error.Expected retrieval:
airflow_failures.mdINC-1001potentially other duplicate-record evidence that passes the threshold
API Timeout
The reporting API returns HTTP 504 errors during high traffic.
Database requests are slow and the application connection pool appears
exhausted.Expected retrieval:
api_timeouts.mdINC-1002
Duplicate Source File
The ingestion service processed the same source file twice and created
duplicate rows.Expected retrieval:
INC-1003relevant duplicate-record guidance when it passes the threshold
Unsupported Kubernetes Incident
A Kubernetes pod cannot be scheduled because every node reports
insufficient memory.Expected behavior:
unrelated runbook chunks are removed
unrelated historical incidents are removed
the model reports insufficient evidence
unsupported Kubernetes commands are not generated
Retrieval Relevance Filtering
Vector databases return nearest neighbors even when none of the available documents are genuinely relevant.
OpsLens AI applies maximum-distance thresholds before retrieved content is sent to the language model.
Current thresholds:
Runbook maximum distance: 0.95
Historical incident maximum distance: 1.25Smaller distances indicate stronger semantic similarity.
Results exceeding the configured threshold are removed.
The current values were selected using supported and unsupported evaluation queries.
Retrieval Evaluation
The evaluation suite checks whether:
at least one acceptable runbook is retrieved
an acceptable historical incident is retrieved when required
supported queries receive evidence
unsupported queries receive no evidence
The evaluation intentionally accepts multiple valid retrieval results rather than requiring one exact document ordering.
Run it with:
python evaluation.pySafety and Reliability
The project includes:
synthetic knowledge-base content only
API keys stored outside source control
path-traversal protection for runbook access
retrieval relevance thresholds
explicit insufficient-evidence behavior
separation between evidence and hypotheses
no automatic execution of generated commands
no destructive production actions without review
user-friendly API and application error handling
retrieval tests for supported and unsupported queries
Current Limitations
small synthetic knowledge base
local embedding model
local ChromaDB storage
MCP server uses stdio
MCP server starts as a subprocess for each analysis
limited historical-incident dataset
no authentication or user accounts
no direct access to production logs or monitoring systems
recommendations still require human review
response latency may be noticeable during local execution
Future Improvements
persistent Streamable HTTP MCP server
response streaming
faster model configuration
concurrent MCP tool calls
retrieval caching
hybrid keyword and vector retrieval
reranking
automated RAG-quality metrics
LangGraph workflow orchestration
Amazon Bedrock support
S3-based document ingestion
OpenTelemetry or CloudWatch observability
Jira, PagerDuty, Datadog, or ServiceNow integrations
user authentication and role-based access controls
Interview Summary
OpsLens AI is an MCP-powered RAG incident investigation assistant. Engineering runbooks and historical incidents are embedded and stored in ChromaDB. When a user describes an incident, the application invokes MCP tools to retrieve semantically relevant evidence. It applies vector-distance thresholds to remove weak matches, augments the LLM prompt with the retrieved context, and generates a cautious investigation with likely causes, diagnostic steps, sources, confidence, and limitations.
Disclaimer
OpsLens AI is a portfolio prototype.
Generated recommendations must be reviewed by a qualified engineer before they are used in a production environment.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceProvides a semantic search interface that enables discovery and routing across over 1,000 local MCP tools using natural language queries. It leverages hybrid search and embeddings to accurately match user intent with tool names and descriptions.Last updated231MIT
- Alicense-qualityDmaintenanceProvides semantic search over markdown documentation using RAG, allowing natural language queries and integration with MCP clients.Last updated1MIT
- Alicense-qualityDmaintenanceProvides RAG (Retrieval Augmented Generation) access to technical documentation through MCP, enabling LLMs to search and retrieve relevant documentation on-demand.Last updated4MIT
- Alicense-qualityDmaintenanceEnables AI coding assistants to semantically search and retrieve relevant code patterns, documentation, and implementations from a codebase via MCP tools.Last updated6MIT
Related MCP Connectors
Query any docs site via MCP. Submit a URL, ask questions, get cited answers.
Apple Developer Documentation with Semantic Search, RAG, and AI reranking for MCP clients
Multi-engine search for AI agents. Trust scoring, local corpus, MCP-native. Self-hostable, BYOK.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/vp1410/opslens-ai'
If you have feedback or need assistance with the MCP directory API, please join our Discord server