Skip to content

tvjmohan/servicenow-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SnowLens v2.0

Understand incidents. Decide faster. Β· Sandy Android Works

Note: SnowLens is for ServiceNow (IT Service Management platform), NOT Snowflake (data warehouse). "Snow" refers to ServiceNow, and "Lens" means intelligent visibility.

SnowLens is an AI-powered SRE co-pilot that transforms ServiceNow into an intelligent system. It connects to your ServiceNow instance, understands incidents (not just displays them), summarizes critical information, detects patterns across historical data, and recommends actionable next steps to reduce MTTR (Mean Time To Resolution).

What is ServiceNow?

ServiceNow is an IT service management (ITSM) platform used by organizations to manage incidents, problems, changes, and IT operations. SnowLens makes ServiceNow smarter by adding AI-powered analysis and recommendations.


🎯 What Does SnowLens Do?

  1. Understand & Summarize - Auto-summarize incidents and surface the most relevant worknotes
  2. Detect Patterns - Automatically correlate historical incidents and surface repeating patterns
  3. Recommend Actions - Provide prioritized, actionable next steps and runbook guidance

πŸ“‹ Prerequisites

Before you start, make sure you have these installed on your computer:

Required Software

Check if you have them installed:

python --version    # Should show Python 3.8+
node --version      # Should show v16+
npm --version       # Should show 8+

πŸš€ Installation & Setup

Step 1: Clone or Download the Project

# If using git
git clone <repository-url>
cd servicenow-mcp

# Or just navigate to your project folder
cd /path/to/servicenow-mcp

Step 2: Install Python Dependencies

# Install all Python packages needed for the backend
pip install fastapi uvicorn anthropic requests python-dotenv

What these packages do:

  • fastapi - Web framework for building the API
  • uvicorn - Server to run the FastAPI application
  • anthropic - Claude AI integration
  • requests - Make HTTP requests to ServiceNow
  • python-dotenv - Load environment variables

Step 3: Install UI Dependencies

# Navigate to the UI folder
cd ui

# Install all Node.js packages
npm install

# Go back to the main folder
cd ..

Step 4: Configure Environment Variables

Create a file named .env in the main project folder:

# Create .env file
touch .env

Add these lines to your .env file:

# ServiceNow Configuration
SERVICENOW_INSTANCE=your-instance-name
SERVICENOW_USERNAME=your-username
SERVICENOW_PASSWORD=your-password

# Anthropic API Key (for Claude AI)
ANTHROPIC_API_KEY=your-anthropic-api-key

# Optional: Server Configuration
API_PORT=6001
UI_PORT=5173

Where to get these:

  • ServiceNow credentials: Ask your ServiceNow admin
  • Anthropic API Key: Get from Anthropic Console

🎬 How to Start Everything

Option 1: Start Everything Manually (Recommended for Learning)

Terminal 1 - Start the Backend API Server

# Make sure you're in the main project folder
cd /path/to/servicenow-mcp

# Start the FastAPI backend server
python sre_agent_api.py

What you should see:

INFO:     Started server process [12345]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:6001 (Press CTRL+C to quit)

The backend is now running on: http://localhost:6001


Terminal 2 - Start the UI Development Server

Open a new terminal window (keep the first one running!):

# Navigate to the UI folder
cd /path/to/servicenow-mcp/ui

# Start the React development server
npm run dev

What you should see:

  VITE v5.x.x  ready in 500 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help

The UI is now running on: http://localhost:5173


Option 2: Start Everything in Background

If you want to run everything in the background:

# Start backend in background
nohup python sre_agent_api.py > backend.log 2>&1 &

# Start UI in background
cd ui
nohup npm run dev > ui.log 2>&1 &
cd ..

To check logs:

# View backend logs
tail -f backend.log

# View UI logs
tail -f ui/ui.log

To stop background processes:

# Find process IDs
ps aux | grep "sre_agent_api.py"
ps aux | grep "vite"

# Kill processes (replace PID with actual process ID)
kill <PID>

🌐 Access the Application

  1. Open your web browser
  2. Go to: http://localhost:5173
  3. You'll see the SnowLens landing page

First Time Login

Demo Credentials:

  • Username: demo
  • PIN: 1234

Or create a new account by clicking "Get Started"


πŸ“ Project Structure

servicenow-mcp/
β”œβ”€β”€ sre_agent_api.py          # Main FastAPI backend server
β”œβ”€β”€ sre_agent.py              # Core SRE agent logic
β”œβ”€β”€ servicenow_server.py      # ServiceNow MCP integration
β”œβ”€β”€ test_client.py            # Testing utilities
β”œβ”€β”€ test_snow.py              # ServiceNow connection tests
β”œβ”€β”€ conversations.json        # Stored conversation history
β”œβ”€β”€ users.json                # User accounts and PINs
β”œβ”€β”€ .env                      # Environment variables (create this!)
β”œβ”€β”€ README.md                 # This file
└── ui/                       # React frontend
    β”œβ”€β”€ package.json          # UI dependencies
    β”œβ”€β”€ vite.config.js        # Vite configuration
    β”œβ”€β”€ index.html            # HTML entry point
    └── src/
        β”œβ”€β”€ main.jsx          # React entry point
        β”œβ”€β”€ App.jsx           # Main React component
        └── index.css         # Tailwind CSS styles

πŸ”§ Troubleshooting

Problem: "Port already in use"

Solution:

# Find what's using port 6001
lsof -i :6001

# Kill the process (replace PID with actual number)
kill -9 <PID>

# Or use a different port by editing sre_agent_api.py
# Change: uvicorn.run(app, host="0.0.0.0", port=6001)
# To:     uvicorn.run(app, host="0.0.0.0", port=6002)

Problem: "Module not found" error

Solution:

# Reinstall Python dependencies
pip install --upgrade fastapi uvicorn anthropic requests python-dotenv

# Reinstall UI dependencies
cd ui
rm -rf node_modules package-lock.json
npm install
cd ..

Problem: UI won't connect to backend

Solution:

  1. Make sure backend is running on port 6001
  2. Check ui/src/App.jsx - API_BASE_URL should be http://localhost:6001
  3. Check browser console (F12) for CORS errors

Problem: "Invalid credentials" when testing ServiceNow

Solution:

  1. Verify your .env file has correct credentials
  2. Test ServiceNow connection:
python test_snow.py

Problem: Can't see any incidents

Solution:

  1. Make sure ServiceNow credentials are correct
  2. Check that your ServiceNow instance is accessible
  3. Verify you have permission to read incidents in ServiceNow

πŸ§ͺ Testing the Setup

Test 1: Check Backend API

# In your browser or using curl
curl http://localhost:6001/health

# Should return: {"status":"healthy"}

Test 2: Check ServiceNow Connection

python test_snow.py

Test 3: Test Full Flow

  1. Open http://localhost:5173
  2. Login with demo/1234
  3. Type a question like "Show me recent incidents"
  4. Should see incidents from ServiceNow

πŸ›‘ How to Stop Everything

If running in foreground:

  • Press CTRL + C in each terminal window

If running in background:

# Find and kill backend
pkill -f "sre_agent_api.py"

# Find and kill UI server
pkill -f "vite"

# Or find process IDs and kill manually
ps aux | grep "python"
ps aux | grep "node"
kill <PID>

πŸ“ Development Tips

Making Changes to the UI

  • Edit files in ui/src/
  • Changes automatically reload in browser (hot reload)
  • No need to restart the server

Making Changes to the Backend

  • Edit sre_agent_api.py or related files
  • Must restart the backend server (CTRL+C then run again)

Viewing Logs

# Backend logs (if running with nohup)
tail -f backend.log

# UI logs (if running with nohup)
tail -f ui/ui.log

# Or just watch the terminal where you started them

πŸš€ Features

βœ… Current Features

  • πŸ” User authentication with PIN
  • πŸ’¬ Conversational AI interface powered by Claude
  • πŸ“Š ServiceNow incident summarization
  • πŸ” Pattern detection across historical ServiceNow incidents
  • πŸ“ ServiceNow worknote analysis
  • πŸ’‘ Resolution recommendations based on similar incidents
  • πŸ“œ Conversation history persistence
  • 🎯 Full analysis mode for deep incident investigation
  • πŸ”— Real-time ServiceNow integration via MCP

πŸš€ Tech Stack

  • Backend: FastAPI, Python 3.8+, Anthropic Claude AI
  • Frontend: React 18, Vite, Tailwind CSS
  • Integration: ServiceNow via Model Context Protocol (MCP)
  • Platform: ServiceNow (ITSM), NOT Snowflake

πŸ“ž Support

Having issues? Here's what to check:

  1. βœ… Python and Node.js installed?
  2. βœ… All dependencies installed?
  3. βœ… .env file configured?
  4. βœ… Both servers running?
  5. βœ… Correct ports (6001 for API, 5173 for UI)?
  6. βœ… ServiceNow credentials valid?

πŸ“„ License

Β© 2025 Sandy Android Works. All rights reserved.


πŸ™ Credits

Built with ❀️ using:


SnowLens v2.0 - Turn ServiceNow into an intelligent system πŸš€

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors