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 name and URL. For example, to connect Prisma:

$/mcp add prisma https://mcp.prisma.io/mcp

fx saves the server in ~/.fx/mcp.json and starts it. A URL means a remote server, so there is no transport to choose. If the server asks you to sign in, fx opens your browser right away, as in the sign-in steps below. To add a server without signing in, put --no-login before its name.

Connect Slack

Add Slack. fx knows Slack's server address, so you don't need to give one, and it opens your browser to sign in once the server asks for a login:

$/mcp add slack

To sign in again later, run /mcp login slack. fx signs in with its own Slack app. Approve access in your browser, then return to fx. Your browser comes back to fx at http://localhost:3118/callback, the one address fx's Slack app allows, so port 3118 must be free while you sign in. To use your own Slack app instead, set its client ID in the OAuth options.

Add a local stdio server

Local servers run as a process on your machine. Put the command and its arguments after --. 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

Everything after -- is passed to the command as written. To set environment variables, add --env KEY=VALUE before the name. For other options, see stdio configuration.

Sign in to a remote server

Browser sign-in

fx starts this sign-in when you add a server that asks for one. To sign in later, or again, run:

$/mcp login prisma

Replace prisma with the name you used when adding the server. fx opens your browser and shows the sign-in address on the server's screen in /mcp, in case the browser didn't open. Approve access, and fx finishes signing in while you keep working. fx saves the login and renews it when needed.

On a machine without a browser, such as over SSH, run fx mcp login --no-browser prisma. fx prints the address to open on any device, and you paste back the address your browser ends up on.

Use /mcp logout <name> to sign out. fx also revokes the login when the server supports it. Servers that need a client ID or a fixed callback port 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:

{
  "mcpServers": {
    "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 see its status and tools, and type to filter them. Its actions, such as Log in, Approve, or Remove, are listed with the command each one runs. Press Esc to go back, or Ctrl+C to close the menu.

Servers start in the background when fx opens, so their tools are ready when you need them. While they work, the status line says nothing about them. It names a server that needs you, such as linear needs login · /mcp.

If a server stops working, fx restarts it on its own, waiting longer between tries. After 8 tries in a row it gives up, and the status line shows linear failed · /mcp. A server that stays up for a minute starts its count over.

CommandDescription
/mcp listList servers with the file that defines each one and its status.
/mcp show <name>Connect to a server and list its tools.
/mcp remove <name>Remove a server and its saved login.

In a terminal, fx mcp list --json prints your servers as JSON for scripts. A usage mistake, such as an unknown flag, prints {"kind": "mcp_list", "error": ..., "code": ...} instead and exits 2.

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. A name that's already in the file is refused, so remove the old entry first.

Edit this file to set headers and environment variables, or to turn a server off with "enabled": false. Changes made with /mcp apply right away. A running fx loads changes made any other way, such as your own edit or fx mcp add in another terminal, when you send your next prompt or run a /mcp command. See the profile reference for available options.

Project configuration and trust

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

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

fx doesn't start a project server until you approve it, and the status line names the servers waiting. To approve one:

$/mcp approve prisma

fx shows exactly what you're trusting: the command it will run, or the URL it will connect to. Approvals are saved per workspace. A project server you sign in to keeps its login for that project only: it never uses a login from another project or from your own servers. Use /mcp approve --all to approve every server in the project, or /mcp reject <name> to keep one from starting. For fx ask, approve the server first with fx mcp 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.

Large results in shell commands

When a tool's result is large, such as a long list of Linear issues, a command can run the tool and save the result to a file instead of sending it to the model:

fx mcp call mcp_linear_list_issues '{"team":"ENG"}' > issues.json
jq '[.issues[] | select(.state == "open")] | length' issues.json

Only what the command prints reaches the model. fx tells the model to use fx mcp call for large or filtered results.

fx mcp call takes the tool's full name, as capability_search returns it, and its arguments as one JSON object, or - to read them from standard input. It prints the tool's structured content as JSON when the tool returns some, and its text otherwise. Structured content that is only a result string, as some servers wrap a tool's text, prints as that text.

When standard output goes to a file or a pipe, fx mcp call also prints one line on standard error with the result's size and shape: its field names, the length of each list, and the values of short text fields that repeat, such as a status. The model sees that line, so it can filter the file without reading it first. Unique values, such as titles and IDs, never appear in it.

fx mcp call: wrote 18342 bytes of JSON: {issues: [120 × {id, title, statusType: "started"|"completed"}], hasNextPage: boolean}

A command can also look up tools. list prints every tool of a server, and search the tools that best match a query, one per line: the name, a tab, and a description. help prints a tool's description and the arguments it takes, with ? after an optional one.

fx mcp call list linear
fx mcp call search open issues
fx mcp call help mcp_linear_list_issues

These need no permission, like the model's own tool search, and they show only the tools the agent may use.

  • It works only in a command that fx's shell tool runs, not in an interactive terminal, and only while that command's shell call runs. From your own terminal it exits 3.
  • Each call meets the same permission rules, prompt, and automatic review as a direct call of the tool, with the access of the agent or subagent that ran the command. When a call needs your approval, the command waits for your answer.
  • In the terminal UI, each call shows as its own tool row beside the command, the row a direct call of the tool gets.
  • A result can be up to 16 MiB, or 8 MiB when the tool returns text.
  • It's available on macOS and Linux.
Exit codeMeaning
0The tool ran, and standard output has its data.
1The call failed, or the connection to fx was lost.
2A usage mistake, such as arguments that aren't a JSON object.
3No running fx shell call to reach, or the session runs a different fx version.
4Too many calls are running. Nothing ran.
5Permission wasn't granted. Nothing ran.
6The tool returned an error, printed on standard error.