推特MCP服务器
MCP(模型上下文协议)服务器,提供使用代理Twitter客户端库与Twitter交互的工具。
特性
- getTweet:通过推特ID检索推特
- sendTweet:在推特上发布新推文
先决条件
- Node.js(v14或更高版本)
- npm或纱线
- Twitter帐户凭据
安装
- 克隆此存储库
- 安装依赖项:
npm install
# or
yarn install- 创建一个
.env根目录中的文件,其中包含您的Twitter凭据:
TWITTER_USERNAME=your_twitter_username
TWITTER_PASSWORD=your_twitter_password
TWITTER_EMAIL=your_email@example.com (optional)
TWITTER_2FA_SECRET=your_2fa_secret (optional)
# Optional API credentials (used as fallback)
TWITTER_API_KEY=your_api_key
TWITTER_API_SECRET_KEY=your_api_secret_key
TWITTER_ACCESS_TOKEN=your_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret用法
运行服务器
您可以使用FastMCP CLI工具运行服务器:
# For development and testing in the terminal
npx fastmcp dev
# For visual inspection with the MCP Inspector
npx fastmcp inspect使用工具
getTweet
通过推特ID检索推特。
参数:
tweetId(string):要检索的推文的ID
例子:
getTweet({"tweetId": "1734609533274853865"})sendTweet
在推特上发布一条新推文。
参数:
text(string):要发送的推文的文本内容
例子:
sendTweet({"text": "Hello World from MCP!"})发展
此服务器是使用以下方式构建的:
要构建TypeScript代码:
npx tsc许可证
麻省理工学院
