Skip to content

Add Farcaster username resolution tool#57

Merged
dschlabach merged 3 commits intobase:masterfrom
gayatrigt:feature/farcaster-integration
Apr 21, 2025
Merged

Add Farcaster username resolution tool#57
dschlabach merged 3 commits intobase:masterfrom
gayatrigt:feature/farcaster-integration

Conversation

@gayatrigt
Copy link
Contributor

Here's the completed PR description for the Farcaster tool:

Description

This PR adds a new tool to Base MCP that resolves Farcaster usernames to Ethereum addresses. The tool uses the Neynar API to search for Farcaster users by username and extracts their verified Ethereum addresses. This functionality enables users to easily look up Ethereum addresses associated with Farcaster profiles, which is useful for various blockchain operations and verifications.

The implementation includes:

  • A new directory src/tools/farcaster/ with three files:
    • schemas.ts: Defines a Zod schema for the username parameter
    • handlers.ts: Implements the API call to Neynar
    • index.ts: Exports the tool using the Base MCP generateTool function
  • Integration with the init wizard to configure the Neynar API key
  • Documentation updates in README.md and examples.md

This feature enhances Base MCP's capabilities by bridging the gap between Farcaster social identities and on-chain Ethereum addresses.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Documentation update

How Has This Been Tested?

The Farcaster tool has been tested with the following scenarios:

  1. Successful username resolution:

    • Tested with known Farcaster usernames that have verified Ethereum addresses
    • Verified that the tool correctly returns the primary Ethereum address
  2. Error handling:

    • Tested with non-existent usernames
    • Tested with usernames that don't have verified Ethereum addresses
    • Verified that appropriate error messages are returned
  3. API integration:

    • Tested with valid and invalid Neynar API keys
    • Verified that the tool handles API errors gracefully
  4. Integration with Base MCP:

    • Verified that the tool is properly exported and available in the Base MCP tools list
    • Confirmed that the init wizard correctly configures the Neynar API key

To reproduce these tests:

  1. Set up a Neynar API key in your environment
  2. Run the Base MCP server
  3. Use the farcaster_username tool with various usernames
  4. Verify the responses match the expected format

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if appropriate):

No screenshots are included as this is a backend feature that doesn't have a visual interface.
Screenshot 2025-04-10 at 6 26 06 PM

@dschlabach
Copy link
Contributor

Thanks for the PR, @gayatrigt! Is public/neynar.txt needed? If not, can you delete it and we can merge!

@gayatrigt
Copy link
Contributor Author

No, it does not. I just removed it @dschlabach

@dschlabach
Copy link
Contributor

dschlabach commented Apr 11, 2025

@gayatrigt Thanks! Looks like there are a few yarn.lock conflicts blocking merging - want to just run yarn install and push and we should be ready to merge?

@gayatrigt
Copy link
Contributor Author

Done @dschlabach

@gayatrigt
Copy link
Contributor Author

@dschlabach can this be merged?

@dschlabach dschlabach merged commit f6388c8 into base:master Apr 21, 2025
2 of 3 checks passed
@dschlabach
Copy link
Contributor

Thanks! @gayatrigt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants