MCP AI SOC负责人
一个强大的AI驱动的安全操作中心(SOC)基于Text2SQL框架的MCP服务器(本地和远程),用于将自然语言提示动态转换为SQL查询,并集成安全威胁分析和监控。
特性
- Text2SQL转换:将自然语言查询转换为优化的SQL
- 多个接口:支持STDIO、SSE和REST API
- 安全威胁分析:内置SQL查询安全分析
- 多数据库支持:连接到SQLite或Snowflake数据库
- 流媒体响应:实时查询处理反馈
- SOC监测:安全运营中心监控能力
安装
pip install mcp-ai-soc-sher快速开始
# Set your OpenAI API key
import os
os.environ["OPENAI_API_KEY"] = "your-api-key-here"
# Use as local server
from mcp_ai_soc_sher.local import LocalMCPServer
server = LocalMCPServer()
server.start()
# Or run from command line
# mcp-ai-soc --type local --stdio --sse命令行用法
# Run local server with STDIO interface
mcp-ai-soc --type local --stdio
# Run local server with SSE interface
mcp-ai-soc --type local --sse
# Run remote server with REST API
mcp-ai-soc --type remote配置
创建一个 .env 使用您的配置文件:
OPENAI_API_KEY=your_openai_api_key_here
MCP_DB_URI=sqlite:///your_database.db
MCP_SECURITY_ENABLE_THREAT_ANALYSIS=true请参阅 文档 对于所有配置选项。
示例
import json
import requests
# Query the server
response = requests.post(
"http://localhost:8000/api/sql",
headers={"Content-Type": "application/json", "X-API-Key": "your-api-key"},
json={
"query": "Find all suspicious login attempts in the last 24 hours",
"optimize": True,
"execute": True
}
)
# Process the response
result = response.json()
print(f"SQL Query: {result['sql']}")
if result['results']:
print("Results:")
for row in result['results']:
print(row)安全功能
- 基于规则和人工智能的SQL查询安全分析
- 检测潜在的SQL注入攻击
- 敏感表访问监控
- 可配置的安全级别和操作
许可证
附带附加条件的MIT许可证。版权所有(c)2025阿克兰警长。
看 许可证 了解详情。
贡献
欢迎投稿!请看 贡献.md 作为指导方针。
