Brainrot MCP 是一个模型上下文协议(MCP)服务器,它解决了 AI 编码会话之间上下文丢失的关键问题。你只需存储一次项目决策、待办事项和架构模式,就可以通过任何兼容 MCP 的 AI 助手无缝访问它们。
git clone https://github.com/KnowHow-Software-Inc/brainrot-mcp.git
cd brainrot-mcp
# 创建虚拟环境
uv venv
uv pip install -r backend/requirements.txt
uv pip install -r mcp_server/requirements.txt
python backend/server.py
若要启用向量搜索,请设置 ENABLE_VECTOR_SEARCH=true:
ENABLE_VECTOR_SEARCH=true uv run python server.py
API 服务器将在 http://localhost:8000 启动。
将以下内容添加到 ~/.config/claude/claude_desktop_config.json 文件中:
{
"mcpServers": {
"brainrot": {
"command": "uv",
"args": ["run", "python", "/path/to/brainrot-mcp/mcp_server/server.py"],
"env": {
"BACKEND_URL": "http://localhost:8000"
}
}
}
}
重启 Claude Desktop,即可开始使用!🎉
按照“快速开始”部分的步骤进行操作。
push_context("auth-strategy",
"Using JWT with refresh tokens, 15min access token expiry, Redis for token storage",
tags=["architecture", "security"],
priority="high")
push_context("optimize-database",
"Add database indexes for user queries - currently taking 2+ seconds",
tags=["todo", "performance", "backend"],
priority="high")
pop_context("auth-strategy")
# Returns: Architecture decision with smart instructions
# 📐 ARCHITECTURE DECISION: Apply this pattern consistently...
list_contexts(tag="performance")
# Lists all performance-related contexts with summaries
第 1 天:存储数据库模式决策
push_context("db-schema",
"Users table: id, email, password_hash. Posts table: id, user_id, content, created_at",
tags=["database", "schema"],
priority="high")
第 5 天:Claude 会根据智能指令记住你的模式
pop_context("db-schema")
# Returns with instructions: "📌 STORED CONTEXT: Apply this information as appropriate..."
push_context("error-handling",
"Always use custom AppError class with error codes. Log to structured JSON format",
tags=["standards", "errors", "pattern"],
priority="medium")
push_context("slow-query-fix",
"User dashboard query optimized from 3s to 200ms using compound index on (user_id, created_at)",
tags=["performance", "solved"],
priority="low") # Low priority since it's already solved
| 工具 | 描述 | 示例 |
|---|---|---|
push_context |
存储上下文并自动生成摘要 | 存储编码模式、决策、待办事项 |
pop_context |
检索带有智能指令的上下文 | 获取带有使用指导的架构决策 |
list_contexts |
过滤并列出所有上下文 | 显示所有待办事项或与安全相关的项目 |
delete_context |
删除过时的上下文 | 清理已完成的待办事项 |
brainrot-mcp/
├── backend/ # FastAPI server + SQLite database
├── mcp_server/ # MCP server implementation
├── data/ # SQLite database storage
└── frontend/ # Optional web dashboard
流程:MCP 客户端 → MCP 服务器 → HTTP API → SQLite 数据库
# 后端测试
cd backend && pytest tests/
# 测试 MCP 服务器
npx @modelcontextprotocol/inspector uv run python mcp_server/server.py
# 代码检查
ruff check .
# 类型检查
mypy .
本项目采用 MIT 许可证,详情请参阅 LICENSE 文件。
为那些厌倦了反复向 AI 助手解释相同内容的开发者们精心打造 ❤️
如果 Brainrot MCP 为你节省了时间,请给这个仓库点个星 ⭐!