用于与X(推特)集成的Model Context Protocol (MCP)服务器,提供读取您的时间线和参与推文的工具。设计用于与Claude桌面应用配合使用。
<a href="https://glama.ai/mcp/servers/5nx3qqiunw"><img width="380" height="200" src="https://gips2.baidu.com/it/u=2352782404,2051524249&fm=3081&app=3081&f=PNG?w=760&h=400" alt="X Server MCP服务器" /></a>
X(推特)提供了免费层级的基本API访问:
注意:对于更高的需求,可以使用付费层级:
您可以在以下网址访问免费层级:https://developer.x.com/en/portal/products/free
git clone [your-repo-url]
cd x-mcp-server
npm install
npm run build
您需要设置您的X(推特)API凭证。请按照以下详细步骤操作:
访问免费层级:
创建新项目:
在项目中创建新应用:
配置应用设置:
设置应用权限:
生成API密钥和令牌:
重要事项:
要连接X MCP服务器与Claude桌面,您需要在Claude设置中进行配置。请按照以下步骤操作:
打开文件资源管理器
导航至Claude配置目录:
%APPDATA%/Claude 并按Enter创建或编辑 claude_desktop_config.json:
claude_desktop_config.json 的新文件添加以下配置,替换占位符值为您之前部分中的实际API凭证:
{
"mcpServers": {
"x": {
"command": "node",
"args": ["%USERPROFILE%/Projects/MCP Basket/x-server/build/index.js"],
"env": {
"TWITTER_API_KEY": "paste-your-api-key-here",
"TWITTER_API_SECRET": "paste-your-api-key-secret-here",
"TWITTER_ACCESS_TOKEN": "paste-your-access-token-here",
"TWITTER_ACCESS_SECRET": "paste-your-access-token-secret-here"
}
}
}
}
注意:确保:
.json扩展名保存文件获取您主页时间线上的最新推文。
参数:
limit(可选):要检索的推文数量(默认:20,最大:100)示例:
await use_mcp_tool({
server_name: "x",
tool_name: "get_home_timeline",
arguments: { limit: 5 }
});
创建带有可选图片附件的新推文。
参数:
text(必需):推文的文字内容(最多280字符)image_path(可选):图片文件的绝对路径(PNG, JPEG, GIF, WEBP,最大5MB)示例(纯文本):
await use_mcp_tool({
server_name: "x",
tool_name: "create_tweet",
arguments: { text: "来自MCP的问候! 🤖" }
});
示例(带图片):
await use_mcp_tool({
server_name: "x",
tool_name: "create_tweet",
arguments: {
text: "看看这张图片! 📸",
image_path: "/path/to/image.png"
}
});
回复带有可选图片附件的推文。
参数:
tweet_id(必需):要回复的推文IDtext(必需):回复的文字内容(最多280字符)image_path(可选):图片文件的绝对路径(PNG, JPEG, GIF, WEBP,最大5MB)示例(纯文本):
await use_mcp_tool({
server_name: "x",
tool_name: "reply_to_tweet",
arguments: {
tweet_id: "1234567890",
text: "很棒的推文! 👍"
}
});
示例(带图片):
await use_mcp_tool({
server_name: "x",
tool_name: "reply_to_tweet",
arguments: {
tweet_id: "1234567890",
text: "这是我的回复 📸",
image_path: "/path/to/image.jpg"
}
});
删除推文。 参数:
tweet_id(必需):要删除的推文ID
示例:await use_mcp_tool({
server_name: "x",
tool_name: "delete_tweet",
arguments: {
tweet_id: "1234567890"
}
});
npm run build:构建TypeScript代码npm run dev:在监视模式下运行TypeScriptnpm start:启动MCP服务器服务器包括内置的免费层级速率限制处理:
MIT
git checkout -b feature/amazing-feature)git commit -m '添加一些精彩的功能')git push origin feature/amazing-feature)