About Farcaster Mcp
Farcaster MCP Server lets MCP clients read casts from Farcaster users and publish new ones. Posting requires a Farcaster bearer token; reading works without one.
Key features
- 01Fetch casts by FID
- 02Fetch casts by username
- 03Publish casts with optional URL embeds
Use cases
- 01Review recent posts from a Farcaster user
- 02Publish a cast from an MCP client
MCP support
Exposes tools to MCP clients for retrieving user casts and publishing casts. It communicates over stdio.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEFarcaster MCP Server
A Model Context Protocol (MCP) server for interacting with Farcaster, enabling you to fetch casts and post new casts to the network.
Features
- Fetch casts by FID: Get casts from a specific Farcaster user using their FID
- Fetch casts by username: Get casts from a specific Farcaster user using their username
- Post casts: Create and post new casts to Farcaster (requires authentication)
Environment Variables
Required for Posting Casts
FARCASTER_BEARER_TOKEN: Your Farcaster API Bearer token- This is only required if you want to use the posting functionality
- The server will work for read-only operations without this token
- You can obtain this token from the Farcaster Client API
Example
export FARCASTER_BEARER_TOKEN="your_bearer_token_here"
Or create a .env file:
FARCASTER_BEARER_TOKEN=your_bearer_token_here
Available Tools
get-user-casts
Get casts from a specific Farcaster user by FID.
Parameters:
fid(number): Farcaster user ID (FID)limit(number, optional): Maximum number of casts to return (default: 10)
get-username-casts
Get casts from a specific Farcaster username.
Parameters:
username(string): Farcaster usernamelimit(number, optional): Maximum number of casts to return (default: 10)
post-cast
Post a new cast to Farcaster.
Parameters:
cast(string): The text content of the cast to be postedembeds(string[], optional): Optional array of URLs to embed in the cast
Note: Requires FARCASTER_BEARER_TOKEN environment variable to be set.
Installation
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build - Set up environment variables (if using posting functionality)
Usage
Running the Server
npm start
The server will start and listen for MCP connections on stdio.
Integration with MCP Clients
This server follows the Model Context Protocol specification and can be used with any MCP-compatible client.
API Endpoints Used
This server interacts with the Farcaster Client API:
- Base URL:
https://client.farcaster.xyz - User lookup:
/v2/user-by-username - Casts retrieval:
/v2/casts - Cast posting:
/v2/casts
Error Handling
- The server provides detailed error messages for debugging
- Rate limiting and API errors are handled gracefully
- Missing environment variables are clearly reported
Security
- Bearer tokens are handled securely through environment variables
- No sensitive information is logged or exposed
- API calls are made over HTTPS
Contributing
Follow DRY, SOLID, and KISS principles when contributing to this project.
License
[Add your license information here]
Smithery Configuration
This repository includes the necessary configuration files for Smithery:
smithery.yaml: YAML configuration for Smithery deploymentsmithery.json: JSON configuration for Smithery capabilitiesDockerfile: Container configuration for Smithery deployment
API Details
This implementation uses the Farcaster Hubble API to fetch data.
Development
# Run in development mode
npm run dev
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.