> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neynar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Neynar with Cursor and MCP server

> Start developing on Farcaster with Neynar and AI enabled Cursor

<Info>
  ### llms.txt

  * Full file [LLM Documentation - Complete Version](https://docs.neynar.com/llms-full.txt). FYI this file can be too large for LLMs on free plan, you might need to upgrade.
  * Abridged version [LLM Documentation - Compact Version](https://docs.neynar.com/llms.txt).

  ### MCP server

  Available at [`https://docs.neynar.com/mcp`](https://docs.neynar.com/mcp). See Step #3 below on how to add.
</Info>

The steps below will help you get started with Farcaster development in a few simple clicks:

<Steps>
  <Step>
    Create an empty folder on your computer e.g. `rish/Code/farcaster`. *This tutorial assumes you're starting from scratch. If you already have a build environment, your steps might vary.*
  </Step>

  <Step>
    Download Cursor from [cursor.com](https://www.cursor.com/) . This tutorial uses `Version: 0.43.5`, it's possible that future versions behave slightly differently.
  </Step>

  <Step>
    Add Neynar MCP server to your IDE as per instructions below. This tutorial follows Cursor.

    <Tabs>
      <Tab title="Cursor">
        To connect the Neynar MCP server to Cursor, click the **Install in Cursor** button in the contextual menu on the top right of any docs page. Or to manually connect the MCP server, follow these steps:

        <Steps>
          <Step title="Open MCP settings">
            1. Use `Command` + `Shift` + `P` (`Ctrl` + `Shift` + `P` on Windows) to open the command palette.
            2. Search for "Open MCP settings".
            3. Select **Add custom MCP**. This will open the `mcp.json` file.
          </Step>

          <Step title="Configure the Neynar MCP server">
            In `mcp.json`, add:

            ```json theme={null} theme={"system"}
            {
              "mcpServers": {
                "Neynar": {
                  "url": "https://docs.neynar.com/mcp"
                }
              }
            }
            ```
          </Step>

          <Step title="Test the connection">
            In Cursor's chat, ask "What tools do you have available?" Cursor should show the Neynar MCP server as an available tool.
          </Step>
        </Steps>

        See [Installing MCP servers](https://docs.cursor.com/en/context/mcp#installing-mcp-servers) in the Cursor documentation for more details.
      </Tab>

      <Tab title="VS Code">
        To connect the Neynar MCP server to Cursor, click the **Install in Cursor** button in the contextual menu on the top right of any docs page. Or to manually connect the MCP server, follow these steps:

        1. Create a `.vscode/mcp.json` file.
        2. In `mcp.json`, configure your server:

        ```json theme={null} theme={"system"}
        {
          "servers": {
            "Neynar": {
              "type": "http",
              "url": "https://docs.neynar.com/mcp"
            }
          }
        }
        ```

        See the [VS Code documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more details.
      </Tab>

      <Tab title="Claude Code">
        ```bash theme={null} theme={"system"}
        claude mcp add --transport http Neynar https://docs.neynar.com/mcp
        ```

        Test the connection by running:

        ```bash theme={null} theme={"system"}
        claude mcp list
        ```

        See the [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code/mcp#installing-mcp-servers) for more details.
      </Tab>

      <Tab title="Claude">
        <Steps>
          <Step title="Add the Neynar MCP server to Claude">
            1. Navigate to the [Connectors](https://claude.ai/settings/connectors) page in the Claude settings.
            2. Select **Add custom connector**.
            3. Add the Neynar MCP server:

            * Name: `Neynar`
            * URL: `https://docs.neynar.com/mcp`

            4. Select **Add**.
          </Step>

          <Step title="Access the MCP server in your chat">
            1. When using Claude, select the attachments button (the plus icon).
            2. Select the Neynar MCP server.
            3. Ask Claude a question about Neynar.
          </Step>
        </Steps>

        See the [Model Context Protocol documentation](https://modelcontextprotocol.io/docs/tutorials/use-remote-mcp-server#connecting-to-a-remote-mcp-server) for more details.
      </Tab>

      <Tab title="Contextual menu">
        You can open the MCP server from the dropdown contextual menu on the top right of any page on the Neynar docs site.

        | Option                  | Description                                         |
        | :---------------------- | :-------------------------------------------------- |
        | **Copy MCP server URL** | Copies your MCP server URL to the user's clipboard. |
        | **Connect to Cursor**   | Installs your MCP server in Cursor.                 |
        | **Connect to VS Code**  | Installs your MCP server in VS Code.                |
      </Tab>
    </Tabs>
  </Step>

  <Step>
    Open the `farcaster` folder you created in Cursor and then open the right chat pane. That's the icon next to the <Icon icon="gear" iconType="solid" /> icon in the screenshot below. *This tutorial assumes you're using `claude-3.5-sonnet` as your AI model. With a different model, your results might differ.*

    <Frame>
      <img className="cursor-doc-image" src="https://mintcdn.com/neynar/4PNY113y9N9T-r9z/images/docs/adfd9241d4e2a9fada19d00673df2bf6096978b1cd2fd1b327f5833f74352363-image.png?fit=max&auto=format&n=4PNY113y9N9T-r9z&q=85&s=0eacf849955d8103525efe6fcf6c5fc2" width="818" height="518" data-path="images/docs/adfd9241d4e2a9fada19d00673df2bf6096978b1cd2fd1b327f5833f74352363-image.png" />
    </Frame>
  </Step>

  <Step>
    Give it the following prompt.

    > I want to build a Farcaster app with Neynar.
    >
    > Neynar's openapi spec is here: @[https://github.com/neynarxyz/OAS/](https://github.com/neynarxyz/OAS/)
    >
    > Neynar's nodejs sdk is here: @[https://github.com/neynarxyz/nodejs-sdk](https://github.com/neynarxyz/nodejs-sdk)
    >
    > can you help set up the repo for me? we will use the latest version of neynar's sdk. No need to build a frontend for now, we will focus on backend only to start.

    Cursor should run a bunch of commands based on the above prompt and set up the directory for you already. The right pane will look something like the one below (it slightly differs on each run, so don't worry if it's different for you).

    <Frame>
      <img className="cursor-doc-image" src="https://mintcdn.com/neynar/V7Un5QUQSGJFAZfS/images/docs/e5a494c070d3292b1f670c771da9eeb3806d5a239126b6b719b8c09afbb065af-image.png?fit=max&auto=format&n=V7Un5QUQSGJFAZfS&q=85&s=c867e9ceedc36f3071b6e63a79d25a0d" width="1102" height="924" data-path="images/docs/e5a494c070d3292b1f670c771da9eeb3806d5a239126b6b719b8c09afbb065af-image.png" />
    </Frame>

    <Frame>
      <img className="cursor-doc-image" src="https://mintcdn.com/neynar/aGwjtKmNewHJXSzO/images/docs/47e7b461b1cd0ccd307f30e2f1f6e9d83659a49ddcd62129110a2edfd47841c8-image.png?fit=max&auto=format&n=aGwjtKmNewHJXSzO&q=85&s=5e6f15984724c2bb892567593d704a5b" width="922" height="1810" data-path="images/docs/47e7b461b1cd0ccd307f30e2f1f6e9d83659a49ddcd62129110a2edfd47841c8-image.png" />
    </Frame>

    <Frame>
      <img className="cursor-doc-image" src="https://mintcdn.com/neynar/aGwjtKmNewHJXSzO/images/docs/69ee1b0f0f53e1213419e3d8e6aeb1e0008475895877d53a48505d5d0c58843a-image.png?fit=max&auto=format&n=aGwjtKmNewHJXSzO&q=85&s=95655d8de48abf6203d35d142947980e" width="926" height="658" data-path="images/docs/69ee1b0f0f53e1213419e3d8e6aeb1e0008475895877d53a48505d5d0c58843a-image.png" />
    </Frame>
  </Step>

  <Step>
    At this point, your left pane should have the following directory structure (Cursor does something slightly different on each run, so don't worry if this isn't the same as this tutorial)

    <Frame>
      <img className="cursor-doc-image--compact" src="https://mintcdn.com/neynar/4PNY113y9N9T-r9z/images/docs/921b77c8b73481024e3a8ba191f0f5e7289f7d2608d46d821e5a4050102dfe27-image.png?fit=max&auto=format&n=4PNY113y9N9T-r9z&q=85&s=49b6a5f440b837d33ca84767542a7b9d" width="388" height="406" data-path="images/docs/921b77c8b73481024e3a8ba191f0f5e7289f7d2608d46d821e5a4050102dfe27-image.png" />
    </Frame>
  </Step>

  <Step>
    To incorporate these changes into your repository, you can start by tapping "accept all" in the chat pane. You might need to troubleshoot this a bit, but accepting is a reasonable way to start.

    <Frame>
      <img className="cursor-doc-image--compact" src="https://mintcdn.com/neynar/aGwjtKmNewHJXSzO/images/docs/422e3fae3164a15538dfd3844465cf2a6cbc812ad35a631461cad98edc871ef6-image.png?fit=max&auto=format&n=aGwjtKmNewHJXSzO&q=85&s=62122091a9c1115095557cf66f40988f" width="440" height="114" data-path="images/docs/422e3fae3164a15538dfd3844465cf2a6cbc812ad35a631461cad98edc871ef6-image.png" />
    </Frame>
  </Step>

  <Step>
    Insert your Neynar API key (subscribe at [neynar.com](https://neynar.com/#pricing) to get your key) in the `.env` file. Replace the placeholder with your API key directly, no quotes needed.
  </Step>

  <Step>
    You will need to run the backend server on your local machine. So go ahead and ask Cursor how to do that.

    > how do I run this?

    Cursor should give you a set of commands you can run from the chat pane directly. Tap "run" on each command and wait for it to finish running before moving to the next one.

    <Frame>
      <img className="cursor-doc-image" src="https://mintcdn.com/neynar/4PNY113y9N9T-r9z/images/docs/9adb1b9c54a28980981a2df69bfa297d4253c8540a0ee745fa28b4c7696ef0f1-image.png?fit=max&auto=format&n=4PNY113y9N9T-r9z&q=85&s=27c44617caf161da310bdde79ef2b4c7" width="1096" height="1696" data-path="images/docs/9adb1b9c54a28980981a2df69bfa297d4253c8540a0ee745fa28b4c7696ef0f1-image.png" />
    </Frame>
  </Step>

  <Step>
    After running the `npm` commands above, if you run the curl commands, it should start printing results to your console!

    <Frame>
      <img src="https://mintcdn.com/neynar/4PNY113y9N9T-r9z/images/docs/854b205473bc6096622f454d34e00eddc240fc4b320bc68f969be3270417ffcc-image.png?fit=max&auto=format&n=4PNY113y9N9T-r9z&q=85&s=c515f62261d64c1ada0b2a88e4a5b4e3" width="3186" height="300" data-path="images/docs/854b205473bc6096622f454d34e00eddc240fc4b320bc68f969be3270417ffcc-image.png" />
    </Frame>

    From here on, you can prompt Cursor as you need and continue to build on this foundation! If you have any questions, post them on the [/neynar](https://farcaster.xyz/~/channel/neynar) channel on Farcaster.
  </Step>
</Steps>

## Troubleshooting

After the above steps, you likely still have a few issues. Below, we describe the easiest way to debug with Cursor.

* If you're getting errors in the terminal, you can simply click "Debug with AI" to have Cursor generate the prompt and output a solution. Alternatively, click "add to chat" and put in a better prompt yourself

  <Frame>
    <img className="cursor-doc-image" src="https://mintcdn.com/neynar/V7Un5QUQSGJFAZfS/images/docs/fd770dff2018932ca47775caa45a84ee5079d4f0b3392ffed1a80df33a8069d0-image.png?fit=max&auto=format&n=V7Un5QUQSGJFAZfS&q=85&s=c8807574484650cc7ee53f2eb33746c8" width="2400" height="312" data-path="images/docs/fd770dff2018932ca47775caa45a84ee5079d4f0b3392ffed1a80df33a8069d0-image.png" />
  </Frame>

* Ensure that it has the correct files as context. `neynar-api-client.d.ts` needs to be added to context to suggest suitable solutions (or else it will just make things up!). You can search for the filename to add it easily.

  * For long files, it will remove them from context at each step and require you to re-add them.

    <Frame>
      <img className="cursor-doc-image" src="https://mintcdn.com/neynar/aGwjtKmNewHJXSzO/images/docs/5e5ecbf9d9b0719ff59a05bf5377fc1d9364c21216245af6f1130cfc9ea9d235-image.png?fit=max&auto=format&n=aGwjtKmNewHJXSzO&q=85&s=5eb8bf727277fcbb0c5ba963b417b8a9" width="634" height="60" data-path="images/docs/5e5ecbf9d9b0719ff59a05bf5377fc1d9364c21216245af6f1130cfc9ea9d235-image.png" />
    </Frame>

* When it outputs a solution, it will look like something below. You will notice that each code block has an "Apply" or "Run" action.

  <Frame>
    <img className="cursor-doc-image" src="https://mintcdn.com/neynar/aGwjtKmNewHJXSzO/images/docs/138705b22a966750167199c165c0daf248176374473dcde913cc9e793707a535-image.png?fit=max&auto=format&n=aGwjtKmNewHJXSzO&q=85&s=3a4937e90da99689fb61d9f76471ea74" width="1876" height="1658" data-path="images/docs/138705b22a966750167199c165c0daf248176374473dcde913cc9e793707a535-image.png" />
  </Frame>

* You will need to apply/run each block separately. Each apply/run action might create file changes that show up like below. If two actions occur on the same file, "accept" the first change and save the file before taking the next action.

  <Frame>
    <img className="cursor-doc-image" src="https://mintcdn.com/neynar/V7Un5QUQSGJFAZfS/images/docs/f2dafc311acbfe24461eb13116f284348f5cb3584bd9c7de490c91ec9b28fb20-image.png?fit=max&auto=format&n=V7Un5QUQSGJFAZfS&q=85&s=47462cf2448f8678f6813d0bdf488f18" width="2646" height="336" data-path="images/docs/f2dafc311acbfe24461eb13116f284348f5cb3584bd9c7de490c91ec9b28fb20-image.png" />
  </Frame>

* Sometimes they also show up in this manner. Accept each change and save before trying again.

  <Frame>
    <img className="cursor-doc-image--compact" src="https://mintcdn.com/neynar/4PNY113y9N9T-r9z/images/docs/730f4dee3e279ab17f3d8fdc60899cca524ad07b59a0133b6ffc758018c69b74-image.png?fit=max&auto=format&n=4PNY113y9N9T-r9z&q=85&s=5f4edd05fce650a0f059aef96ec1e0f0" width="166" height="92" data-path="images/docs/730f4dee3e279ab17f3d8fdc60899cca524ad07b59a0133b6ffc758018c69b74-image.png" />
  </Frame>

* You will likely need to go back and forth with Cursor as you work through your code. While AI agents are helpful at getting the project started, they are still bad at navigating through repositories and picking the proper functions.

# Tips

Each time you run a command from the chat pane, Cursor opens a new terminal. You can close extra terminal windows that are *not* running your server without any adverse effects on your project.

<Frame>
  <img className="cursor-doc-image--compact" src="https://mintcdn.com/neynar/V7Un5QUQSGJFAZfS/images/docs/f04ff92a651b8540812c0c0be5b891c3c5766cd563a4509d1fce39c19aa46e10-image.png?fit=max&auto=format&n=V7Un5QUQSGJFAZfS&q=85&s=be66017ec425e8f11922081b6947db3c" width="254" height="196" data-path="images/docs/f04ff92a651b8540812c0c0be5b891c3c5766cd563a4509d1fce39c19aa46e10-image.png" />
</Frame>
