MCP对齐论坛服务器
MCP(模型上下文协议)服务器,提供对LessRong和对齐论坛中与对齐相关的帖子的访问。该服务器充当研究导师,帮助您快速理解AI对齐概念,并通过语义搜索和内容检索发现未知的未知因素。
特性
- 语义搜索:使用自然语言查询搜索60多个对齐帖子
- 近期文章:按时间顺序浏览最新的对齐研究
- 完整文章访问权限:检索完整的文章内容,包括HTML、元数据和图像
- 每日更新:通过GitHub操作自动与LessRong同步
- 高效存储:基于CSV的明文描述方法
- 高质量内容:包括Eliezer Yudkowsky、Paul Christiano、Nate Soares等人的主要作品
快速入门(推荐)
使用此MCP服务器的最简单方法是使用托管部署。只需将此添加到您的Claude Desktop配置中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"alignment-forum": {
"url": "https://alignmentforum.fastmcp.app/mcp",
"transport": "sse"
}
}
}然后 完全退出并重新启动Claude Desktop就是这样!现在,您可以直接在Claude中搜索和阅读对齐论坛帖子。
本地安装(可选)
先决条件
- Python 3.10或更高版本
- pip或uv包管理器
设置
- 克隆仓库:
cd ~/Github
git clone https://github.com/YOUR_USERNAME/mcp-alignmentforum.git
cd mcp-alignmentforum- 安装依赖项:
pip install -e .或使用 uv (推荐):
uv pip install -e .- 更新配置:
- 编辑 src/mcp_alignmentforum/server.py - 替换 YOUR_USERNAME 在CSV_URL常量中包含您的GitHub用户名
- 运行初始数据收集 (可选):
export OPENROUTER_API_KEY="your-api-key-here"
python scripts/update_posts.py测试服务器
在配置Claude Desktop之前,您可以使用MCP检查器测试MCP服务器:
# Test remote server (recommended)
npx @modelcontextprotocol/inspector sse \
https://alignmentforum.fastmcp.app/mcp
# Test local server
npx @modelcontextprotocol/inspector \
/usr/local/bin/uv \
--directory /Users/ram/Github/mcp-alignmentforum \
run \
mcp-alignmentforum这将:
- 启动MCP服务器
- 打开web界面
http://localhost:5173 - 允许您交互式测试所有三个工具:
- search_posts -通过对齐帖子进行语义搜索 - list_recent_posts -按时间顺序浏览最近的帖子 - fetch_article_content -获取完整文章内容
使用Claude Desktop
远程服务器(推荐)
看 快速开始 在上面的部分中使用托管部署 https://alignmentforum.fastmcp.app/mcp.
本地服务器(高级)
如果您已在本地安装了服务器,请将以下内容添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"alignment-forum": {
"command": "/usr/local/bin/uv",
"args": [
"--directory",
"/Users/ram/Github/mcp-alignmentforum",
"run",
"mcp-alignmentforum"
]
}
}
}备注:替换 /Users/ram/Github/mcp-alignmentforum 使用克隆存储库的实际路径。
重新启动克劳德桌面
在更新配置之后, 完全退出并重新启动 Claude Desktop使更改生效。
远程部署(铁路)
备注:公开部署已在以下位置可用 https://alignmentforum.fastmcp.app/mcp (参见 快速开始).以下说明用于部署您自己的自定义实例。
部署到铁路

或者手动部署:
- 将代码推送到GitHub (如果尚未完成)
- 在铁路上创建新项目:
- 首选 railway应用程序 - 点击“新建项目” - 选择“从GitHub仓库部署” - 选择 mcp-alignmentforum
- 铁路将自动:
- 检测Dockerfile - 从安装依赖项 pyproject.toml - 使用Procfile启动服务器 - 分配一个公共URL(例如。, https://your-app.railway.app)
- 获取您的部署URL:
- 转到铁路项目设置 - 复制公共域URL - 您的SSE端点将是: https://your-app.railway.app/mcp
在Claude Desktop中使用自定义远程部署
更新您的Claude Desktop配置以使用您的自定义部署:
{
"mcpServers": {
"alignment-forum-custom": {
"url": "https://your-app.railway.app/mcp",
"transport": "sse"
}
}
}替换 your-app.railway.app 使用您的实际铁路部署URL。
环境变量(可选)
铁路部署不需要任何环境变量,但您可以添加:
PORT-铁路会自动设置此值(默认值:8000)HOST-默认为0.0.0.0
监控
- 铁路仪表板:监控日志、指标和部署
- 健康检查:铁路自动检查
/端点 - 自动部署:推送到GitHub会自动触发重新部署
可用的MCP工具
1. search_posts
使用语义搜索的自然语言查询搜索对齐论坛帖子。
参数:
query(字符串,必填):自然语言搜索查询(例如,“台面优化风险”)limit(整数,可选):返回的最大结果数(默认值:20,最大值:100)offset(整数,可选):分页时跳过的结果(默认值:0)
退货:具有匹配帖子和相似性分数的JSON对象
Claude中的示例用法:
Search for posts about mesa-optimizers and inner alignment
Find articles discussing deceptive alignment2. list_recent_posts
按时间顺序列出最近的对齐论坛帖子(最新的第一个)。
参数:
limit(整数,可选):返回的最大结果数(默认值:20,最大值:100)offset(整数,可选):分页时跳过的结果(默认值:0)
退货:带有posts数组和分页信息的JSON对象
Claude中的示例用法:
Show me the 10 most recent alignment forum posts
What are the latest posts on the alignment forum?3. fetch_article_content
获取特定对齐论坛文章的完整内容。
参数:
post_id(string,必填):帖子ID(_id字段)或数据库中的slugurl(字符串,可选):帖子的直接URL(用作回退)
退货:包含HTML内容、元数据和统计信息的完整文章
Claude中的示例用法:
Fetch the full article content for post ID abc123xyz456789ab
Get the complete text of the article with slug "risks-from-learned-optimization"每日更新
GitHub操作工作流
该存储库包括一个GitHub Actions工作流,每天自动更新CSV文件:
- 日程:UTC每天凌晨3:47
- 手动触发:可以从“操作”选项卡手动运行
自动更新设置
- 转到您的GitHub存储库设置 → 秘密和变量→ 行动
- 添加新密码:
- 姓名: OPENROUTER_API_KEY - 值:您的OpenRouter API密钥来自https://openrouter.ai/
- 启用GitHub操作:
- 转到“操作”选项卡 - 如果系统提示,启用工作流
工作流程将:
- 从对齐论坛获取所有帖子
- 使用OpenRouter生成摘要(或使用回退描述)
- 写给
data/alignment-forum-posts.csv - 承诺并推动变革
发展
项目结构
mcp-alignmentforum/
├── README.md # This file
├── pyproject.toml # Python project configuration
├── .gitignore # Git ignore rules
├── src/
│ └── mcp_alignmentforum/
│ ├── __init__.py # Package initialization
│ └── server.py # MCP server with 3 tools
├── scripts/
│ └── update_posts.py # Daily update script
├── data/
│ ├── .gitkeep # Track directory in git
│ └── alignment-forum-posts.csv # Generated by GitHub Actions
└── .github/
└── workflows/
└── update-posts.yml # Daily GitHub Actions workflow本地运行
启动MCP服务器:
python src/mcp_alignmentforum/server.py服务器将在stdio上运行并等待MCP协议消息。
运行更新脚本:
# Without OpenRouter (uses plaintext descriptions)
python scripts/update_posts.py
# With OpenRouter (generates AI summaries)
export OPENROUTER_API_KEY="your-key"
python scripts/update_posts.py测试
您可以直接在以下位置测试GraphQL查询: https://www.alignmentforum.org/graphiql
代码质量
# Install dev dependencies
pip install -e ".[dev]"
# Format code
black src/ scripts/
# Lint code
ruff check src/ scripts/
# Type check
mypy src/API详细信息
对齐论坛GraphQL API
- 端点:
https://www.alignmentforum.org/graphql - GraphiQL浏览器:
https://www.alignmentforum.org/graphiql - 速率限制:尊重他人,增加请求之间的延迟
- 文档:基于LessRong代码库
OpenRouter API
- 端点:
https://openrouter.ai/api/v1/chat/completions - 使用的型号:
openai/gpt-3.5-turbo(可靠且经济高效) - 目的:生成2-3句的帖子摘要
- 后备方案:用途
plaintextDescription如果API失败或未提供密钥
故障排除
MCP服务器未出现在Claude Desktop中
- 检查路径是否正确
claude_desktop_config.json是正确的 - 确保已安装Python 3.10+:
python3 --version - 验证是否安装了依赖项:
pip list | grep mcp - 检查克劳德桌面日志:
- macOS: ~/Library/Logs/Claude/ - 查找与mcp alignmentforum相关的错误消息
未找到CSV文件(404错误)
- 确保您已更新
CSV_URL在server.py使用您的GitHub用户名 - 验证CSV文件是否存在于:
https://raw.githubusercontent.com/YOUR_USERNAME/mcp-alignmentforum/main/data/alignment-forum-posts.csv - 运行更新脚本以生成初始CSV:
python scripts/update_posts.py - 提交CSV文件并将其推送到GitHub
GitHub操作未运行
- 转到存储库设置→ 行动→ 将军
- 确保选择了“允许所有操作和可重用工作流”
- 检查工作流文件是否在
.github/workflows/ - 从“操作”选项卡手动触发以进行测试
运行服务器时出现导入错误
# Reinstall dependencies
pip install --upgrade mcp httpx 'gql[httpx]' pydantic许可证
麻省理工学院
贡献
欢迎投稿!请随时提交拉取请求。
致谢
支持
有关问题、疑问或建议,请在GitHub上打开问题。
