MCP

MCP connects fx to tools and data from other services. Add a server, then describe what you need in your prompt. fx finds relevant tools as it works.

Add a remote server

Open fx and add the server's URL. For example, to connect Prisma:

$/mcp add --transport http prisma https://mcp.prisma.io/mcp

fx saves the server in ~/.fx/mcp.json and connects to it. If it requires sign-in, follow the authentication steps below.

Add a local stdio server

Local servers run as a process on your machine. Pass the command and its arguments to /mcp add. For example, with Node.js and npm installed, you can try the MCP Everything test server:

$/mcp add local-tools npx -y @modelcontextprotocol/server-everything

For environment variables and other options, see stdio configuration.

Authenticate a remote server

Browser sign-in

For a server that supports browser sign-in, run:

$/mcp auth prisma --open

Replace prisma with the name you used when adding the server. Complete sign-in in your browser, then return to fx. fx saves the login and refreshes tokens when needed.

Use /mcp logout <name> to sign out. Servers that require a client ID or scopes have additional OAuth options.

API tokens

For a server that accepts a bearer token, add bearer_token_env to its entry in ~/.fx/mcp.json:

{
  "mcp": {
    "protected": {
      "type": "http",
      "url": "https://mcp.example.com/mcp",
      "bearer_token_env": "MCP_TOKEN"
    }
  }
}

Replace the URL with your server's endpoint. Set MCP_TOKEN to the token issued by that service, then start fx from the same terminal:

export MCP_TOKEN="your-token"
fx

For servers that require custom headers, see HTTP authentication fields.

Manage servers

$/mcp

Select a server to check its connection and browse its tools, resources, and prompts. You can preview resource or prompt content and choose Insert to add it to your prompt.

CommandDescription
/mcp reloadApply changes made to the configuration file.
/mcp remove <name>Remove a server from your profile.
/mcp pathShow the configuration file path.

See the MCP command reference for all commands, or CLI commands to manage servers from your terminal.

Servers with fx setup guides

These providers maintain setup instructions for connecting their servers to fx:

Profile configuration

Servers added with /mcp add are saved in ~/.fx/mcp.json and available across projects. Adding an existing name replaces that entry.

Edit this file to set headers, environment variables, and timeouts. After saving, run /mcp reload. See the profile reference for available options.

Project configuration and trust

To share server configuration with your project, create .mcp.json in its root. Define servers under mcpServers:

{
  "mcpServers": {
    "prisma": {
      "type": "http",
      "url": "https://mcp.prisma.io/mcp"
    }
  }
}

fx asks you to approve project servers before connecting. You can also approve a server by name:

$/mcp trust approve prisma

Approvals are saved per workspace. For fx ask, approve the server first with fx mcp trust approve prisma.

If your profile and project define the same name, the profile entry takes precedence. Project configuration also supports environment variables; see project configuration details.

How tools reach the model

fx discovers and loads relevant tool definitions as needed. MCP calls follow your permission mode and rules.

See the protocol reference for discovery and context limits, or Troubleshooting if a server does not appear.