Farcaster MCP Server 使用说明
项目简介
Farcaster MCP Server 是一个基于 Model Context Protocol (MCP) 构建的后端服务,旨在为大型语言模型 (LLM) 提供与 Farcaster 社交网络交互的能力。通过此服务器,LLM 可以调用工具来检索 Farcaster 用户的帖子 (casts)、频道内容,从而实现更丰富的社交互动和信息查询功能。
主要功能点
- 获取用户帖子 (Get User Casts): 根据 Farcaster 用户 ID (FID) 获取用户的最新帖子。
- 按用户名获取帖子 (Get Username Casts): 根据 Farcaster 用户名获取用户的最新帖子。
- 获取频道帖子 (Get Channel Casts): 获取特定 Farcaster 频道的最新帖子。
安装步骤
- 克隆仓库
git clone https://github.com/manimohans/farcaster-mcp.git cd farcaster-mcp - 安装依赖
npm install - 构建项目
npm run build
服务器配置
要将此 MCP 服务器与 MCP 客户端(如 Claude for Desktop)配合使用,您需要配置客户端以连接到此服务器。以下是 Claude for Desktop 的配置示例,您需要将配置添加到 'claude_desktop_config.json' 文件中。
{ "mcpServers": { "farcaster": { // 服务器名称,可以自定义 "command": "node", // 启动服务器的命令,这里使用 node "args": ["/absolute/path/to/farcaster-mcp/build/index.js"] // 启动服务器的参数,指向构建后的 index.js 文件,请替换为实际的绝对路径 } } }
请注意: '/absolute/path/to/farcaster-mcp/build/index.js' 需要替换为您本地 'farcaster-mcp/build/index.js' 文件的绝对路径。您可以通过在终端中 'cd' 到 'farcaster-mcp' 目录,然后运行 'pwd' 命令来获取当前目录的绝对路径,再拼接上 'build/index.js'。
基本使用方法
-
启动服务器 在 'farcaster-mcp' 仓库目录下,运行以下命令启动 MCP 服务器:
npm start服务器默认通过标准输入输出 (stdio) 与 MCP 客户端通信。
-
与 MCP 客户端连接 配置您的 MCP 客户端(例如 Claude for Desktop 或 MCP Inspector)连接到此服务器。
- MCP Inspector: 可以使用以下命令通过 MCP Inspector 运行服务器进行测试:
npx @modelcontextprotocol/inspector node ./build/index.js - Claude for Desktop: 按照上述 “服务器配置” 步骤修改 'claude_desktop_config.json' 文件后,重启 Claude for Desktop 即可。
- MCP Inspector: 可以使用以下命令通过 MCP Inspector 运行服务器进行测试:
-
通过客户端调用工具 在 MCP 客户端中,您可以使用注册的工具来与 Farcaster 网络互动。例如,在 Claude 中,您可以指示 Claude 使用 'farcaster' 服务器提供的工具,例如:
- 'get-user-casts': "使用 farcaster 工具获取 FID 为 6846 的用户的最新帖子"
- 'get-username-casts': "使用 farcaster 工具获取用户名为 'mani' 的用户的最新帖子"
- 'get-channel-casts': "使用 farcaster 工具获取频道 'aichannel' 的最新帖子"
客户端会将您的自然语言指令转换为对 MCP 服务器工具的调用,服务器会执行相应的操作并返回结果给客户端。
信息
分类
通信与社交