A Model Context Protocol (MCP) server that utilizes a machine learning model to detect phishing attempts in email text. This server exposes a tool that can be used by LLMs to analyze email content and determine if it is "Normal" or "Phishing".
- Phishing Detection: Uses a pre-trained ONNX model (
tfidf_logistic_regression.onnx) to classify emails. - MCP Interface: Exposes a standard MCP tool
PhishingDetectionfor easy integration with AI assistants. - TypeScript: Built with modern TypeScript for type safety and maintainability.
- Docker Support: Includes a Dockerfile for easy containerization and deployment.
- Node.js (v18 or higher recommended)
- npm
-
Clone the repository:
git clone https://github.com/Geoff-Robin/Email-Phishing-Detection-MCP.git cd Email-Phishing-Detection-MCP -
Install dependencies:
npm install
To run the server in development mode with hot-reloading:
npm run devThe server will start on port 3000.
To build the TypeScript code and run the compiled JavaScript:
-
Build the project:
npm run build
Note: Currently, the build process compiles TypeScript but may not copy the model file. Ensure
dist/modelscontains the.onnxmodel if running fromdist. -
Start the server:
npm start
You can also run the server using Docker:
-
Build the image:
docker build -t phishing-mcp-server . -
Run the container:
docker run -p 3000:3000 phishing-mcp-server
The server exposes the following MCP tool:
Analyzes the provided email text and returns a classification.
- Input:
emailText(string): The content of the email to analyze.
- Output:
- Returns a text content block with either
"Normal Email"or"Phishing Email".
- Returns a text content block with either
src/: Source codeindex.ts: Server entry point and HTTP setup.mcp.ts: MCP server definition and model inference logic.models/: Directory containing the ONNX model.
PhishingDetection.ipynb: Jupyter notebook containing the model training and evaluation process.
The phishing detection is powered by a Logistic Regression model trained on TF-IDF features. The model is exported to ONNX format for efficient inference in the Node.js environment. See PhishingDetection.ipynb for the training code.
ISC