Content
# Project Name: FLYsecAgent
This is a network security intelligent assistant project based on large language models, MCP (Model-Controller-Plugin), and Rag architecture. It aims to assist users in performing penetration testing tasks, querying security information, analyzing traffic packets, and more through natural language interaction.
## Features
- **Natural Language Interaction**: Users can ask questions and issue commands to the AI assistant using natural language.
- **MCP Server Integration**: Multiple MCP servers can be flexibly integrated and managed through the `mcp.json` configuration file, expanding the assistant's capabilities.
- **Tool Invocation**: The AI assistant can invoke tools provided by the configured MCP servers based on user requests (e.g., nmap, gobuster, fofa, tavily-search, etc.).
- **Conversation History Memory**: Supports multi-turn conversations and can remember previous interactions.
- **Streaming Output**: The AI's responses can be streamed, providing a better user experience.
- **Knowledge Base Enhancement (Optional)**: Supports enhancing the quality of AI responses through a local knowledge base Rag (in the `knowledge_base_docs` directory).
- **Configurable Model**: Supports configuring different language model parameters.
**Startup Effect**

**sqlmap Invocation Effect**:


Additionally, tools like dirsearch and nmap can also be invoked.
## Installation Guide
1. **Clone the Repository**:
```bash
git clone https://github.com/hnking-star/FlySecAgent.git
cd agent
```
2. **Create and Activate a Virtual Environment** (Recommended):
```bash
python -m venv .venv
```
- Windows:
```bash
.venv\Scripts\activate
```
- macOS/Linux:
```bash
source .venv/bin/activate
```
3. **Install Dependencies**:
```bash
pip install -r requirements.txt
```
4. **Install `uv` (Important)**:
This project uses `uv` as the runner for Python packages and as an installer in certain scenarios.
- The `start.bat` script will automatically attempt to install `uv` for you.
- If you wish to install it manually or use it in other environments, you can run:
```bash
pip install uv
```
or refer to the official documentation for `uv` for installation.
Ensure that `uv` is successfully installed and can be called from the command line.
## Usage Instructions
1. **Configure MCP Server**:
Modify the `mcp.json` file to configure the MCP servers according to your environment and needs. Ensure that the startup commands and parameters for each server are correct. For example, you may need to update `TAVILY_API_KEY` or other server-specific paths/parameters.
2. **Prepare Knowledge Base (Optional)**:
If you wish to use the knowledge base enhancement feature, place the relevant text files (e.g., `.txt`) into the `knowledge_base_docs` folder.
3. **Run the Main Program**:
```bash
python main.py
```
After the program starts, you can enter your questions or commands based on the prompts.
## File Structure
```
agent/
├── .venv/ # Python virtual environment (ignored by .gitignore)
├── knowledge_base_docs/ # Directory for knowledge base documents
│ └── ...
├── .gitignore # Git ignore file configuration
├── main.py # Main program entry
├── mcp.json # MCP server configuration file
├── rag_embedding.py # RAG embedding related (if used)
├── rag_split.py # RAG text splitting related (if used)
├── README.md # Project description file
├── requirements.txt # Python dependency list
├── LICENSE # Project license
└── ... (other scripts or configuration files)
```
## Configuration File (`.env`)
```json
BASE_URL=https://api.302.ai
API_KEY=your_r_api_key
MODEL_NAME=gpt-4o
EMBEDDING_API_KEY=your_embedding_api_key
OPENAI_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
```
The above corresponds to the model API and key used, while the below corresponds to the embedding key and URL (using Alibaba Cloud).
## Configuration File (`mcp.json`)
This file is used to define the MCP servers that the AI assistant can connect to and use. Each server entry should include:
- `name`: The unique name of the server.
- `params`: The parameters required to start the server, usually including `command` and `args`.
- `cache_tools_list`: Whether to cache the tool list.
**Example MCP Server Configuration**:
**stdio**
```json
{
"name": "tavily-search",
"params": {
"command": "uv",
"args": [
"--directory",
"F:\\ai\\mcp\\mcp_tool\\mcp-server-tavily",
"run",
"tavily-search"
],
"env": {
"TAVILY_API_KEY": "your_tavily_api_key_here",
"PYTHONIOENCODING": "utf-8"
}
},
"cache_tools_list": true
}
```
Please ensure to replace the paths and API keys in the example with your own configuration.
**sse**
```json
{"name":"mcpname",
"url":"http://127.0.0.1:8009/sse"
},
```
## Knowledge Base Configuration
Simply add the corresponding files to the `knowledge_base_docs` folder.
Connection Info
You Might Also Like
Git
Model Context Protocol Servers
TrendRadar
🎯 Say goodbye to information overload. AI helps you understand news hotspots...
repomix
Repomix packages your codebase into AI-friendly formats for seamless integration.
Mastra
The TypeScript AI agent framework. ⚡ Assistants, RAG, observability....
Blender
BlenderMCP integrates Blender with Claude AI for enhanced 3D modeling.
cua
Open-source infrastructure for Computer-Use Agents. Sandboxes, SDKs, and...