Skip to content

Commit 36fe11c

Browse files
committed
docs: add fx installation guide
1 parent febc329 commit 36fe11c

3 files changed

Lines changed: 157 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Alternatively, to manually configure VS Code, choose the appropriate JSON block
8686
- **[Claude Applications](/docs/installation-guides/install-claude.md)** - Installation guide for Claude Desktop and Claude Code CLI
8787
- **[Codex](/docs/installation-guides/install-codex.md)** - Installation guide for OpenAI Codex
8888
- **[Cursor](/docs/installation-guides/install-cursor.md)** - Installation guide for Cursor IDE
89+
- **[fx](/docs/installation-guides/install-fx.md)** - Installation guide for the fx terminal agent
8990
- **[OpenCode](/docs/installation-guides/install-opencode.md)** - Installation guide for the OpenCode terminal agent
9091
- **[Windsurf](/docs/installation-guides/install-windsurf.md)** - Installation guide for Windsurf IDE
9192
- **[Zed](/docs/installation-guides/install-zed.md)** - Installation guide for Zed editor
@@ -391,6 +392,7 @@ For other MCP host applications, please refer to our installation guides:
391392
- **[GitHub Copilot in other IDEs](/docs/installation-guides/install-other-copilot-ides.md)** - Installation for JetBrains, Visual Studio, Eclipse, and Xcode with GitHub Copilot
392393
- **[Claude Code & Claude Desktop](docs/installation-guides/install-claude.md)** - Installation guide for Claude Code and Claude Desktop
393394
- **[Cursor](docs/installation-guides/install-cursor.md)** - Installation guide for Cursor IDE
395+
- **[fx](docs/installation-guides/install-fx.md)** - Installation guide for the fx terminal agent
394396
- **[Google Gemini CLI](docs/installation-guides/install-gemini-cli.md)** - Installation guide for Google Gemini CLI
395397
- **[OpenCode](docs/installation-guides/install-opencode.md)** - Installation guide for the OpenCode terminal agent
396398
- **[Windsurf](docs/installation-guides/install-windsurf.md)** - Installation guide for Windsurf IDE

docs/installation-guides/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This directory contains detailed installation instructions for the GitHub MCP Se
99
- **[Claude Applications](install-claude.md)** - Installation guide for Claude Desktop and Claude Code CLI
1010
- **[Cline](install-cline.md)** - Installation guide for Cline
1111
- **[Cursor](install-cursor.md)** - Installation guide for Cursor IDE
12+
- **[fx](install-fx.md)** - Installation guide for the fx terminal agent
1213
- **[Google Gemini CLI](install-gemini-cli.md)** - Installation guide for Google Gemini CLI
1314
- **[OpenAI Codex](install-codex.md)** - Installation guide for OpenAI Codex
1415
- **[OpenCode](install-opencode.md)** - Installation guide for the OpenCode terminal agent
@@ -30,6 +31,7 @@ This directory contains detailed installation instructions for the GitHub MCP Se
3031
| Claude Desktop || ✅ PAT + ❌ No OAuth | Docker or Go build, GitHub PAT | Moderate |
3132
| Cline || ✅ PAT + ❌ No OAuth | Docker or Go build, GitHub PAT | Easy |
3233
| Cursor || ✅ PAT + ❌ No OAuth | Docker or Go build, GitHub PAT | Easy |
34+
| fx || ✅ PAT + ❌ No OAuth | Docker or Go build, GitHub PAT via `bearer_token_env` | Easy |
3335
| Google Gemini CLI || ✅ PAT + ❌ No OAuth | Docker or Go build, GitHub PAT | Easy |
3436
| OpenCode || ✅ PAT + ❌ No OAuth | Docker or Go build, GitHub PAT | Easy |
3537
| Roo Code || ✅ PAT + ❌ No OAuth | Docker or Go build, GitHub PAT | Easy |
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Install GitHub MCP Server in fx
2+
3+
[fx](https://fx.sh) is an open source coding agent for the terminal. It reads MCP servers from `~/.fx/mcp.json` under an `mcp` key. For general setup information (prerequisites, Docker installation, security best practices), see the [Installation Guides README](./README.md).
4+
5+
## Prerequisites
6+
7+
1. fx installed (`curl -fsSL https://fx.sh/setup.sh | bash` or see [fx installation docs](https://fx.sh/docs/getting-started/installation))
8+
2. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new) with appropriate scopes
9+
3. For local installation: [Docker](https://www.docker.com/) installed and running
10+
11+
> [!IMPORTANT]
12+
> fx rejects a literal `Authorization` header in `mcp.json` so credentials do not become ordinary profile data. Use `bearer_token_env` instead, which reads the token from an environment variable at connection time.
13+
14+
## Remote Server (Recommended)
15+
16+
Uses GitHub's hosted server at `https://api.githubcopilot.com/mcp/`. Add it from your terminal:
17+
18+
```sh
19+
fx mcp add --transport http github https://api.githubcopilot.com/mcp/
20+
```
21+
22+
Then open `~/.fx/mcp.json` and add `bearer_token_env` to the saved entry:
23+
24+
```json
25+
{
26+
"mcp": {
27+
"github": {
28+
"type": "http",
29+
"url": "https://api.githubcopilot.com/mcp/",
30+
"bearer_token_env": "GITHUB_PERSONAL_ACCESS_TOKEN"
31+
}
32+
}
33+
}
34+
```
35+
36+
Export the token in the shell that starts fx:
37+
38+
```sh
39+
export GITHUB_PERSONAL_ACCESS_TOKEN=your_pat_here
40+
```
41+
42+
fx sends the value as a bearer token on every request. The token is never written to `mcp.json`.
43+
44+
### Limiting toolsets
45+
46+
The GitHub MCP server registers many tools. To keep prompts within your model's context window, filter server side with the `X-MCP-Toolsets` header, which fx sends through `headers`:
47+
48+
```json
49+
{
50+
"mcp": {
51+
"github": {
52+
"type": "http",
53+
"url": "https://api.githubcopilot.com/mcp/",
54+
"bearer_token_env": "GITHUB_PERSONAL_ACCESS_TOKEN",
55+
"headers": {
56+
"X-MCP-Toolsets": "repos,issues,pull_requests"
57+
}
58+
}
59+
}
60+
}
61+
```
62+
63+
See the [Server Configuration Guide](../server-configuration.md) and the [main README's toolsets section](../../README.md#available-toolsets).
64+
65+
## Local Server (Docker)
66+
67+
The local GitHub MCP server runs via Docker and requires Docker Desktop (or another Docker runtime) to be installed and running.
68+
69+
```json
70+
{
71+
"mcp": {
72+
"github": {
73+
"type": "local",
74+
"command": [
75+
"docker", "run", "-i", "--rm",
76+
"-e", "GITHUB_PERSONAL_ACCESS_TOKEN",
77+
"ghcr.io/github/github-mcp-server"
78+
],
79+
"environment": {
80+
"GITHUB_PERSONAL_ACCESS_TOKEN": "your_pat_here"
81+
}
82+
}
83+
}
84+
}
85+
```
86+
87+
To log in with OAuth instead of a token, publish a fixed callback port to loopback:
88+
89+
```json
90+
{
91+
"mcp": {
92+
"github": {
93+
"type": "local",
94+
"command": [
95+
"docker", "run", "-i", "--rm",
96+
"-p", "127.0.0.1:8085:8085",
97+
"-e", "GITHUB_OAUTH_CALLBACK_PORT",
98+
"ghcr.io/github/github-mcp-server"
99+
],
100+
"environment": {
101+
"GITHUB_OAUTH_CALLBACK_PORT": "8085"
102+
}
103+
}
104+
}
105+
}
106+
```
107+
108+
See **[Local Server OAuth Login](../oauth-login.md)** for the native-binary flow, headless fallback, GitHub Enterprise, and bringing your own OAuth or GitHub App.
109+
110+
The first launch of a container or package can exceed the default startup timeout. Raise it for that server with `"startup_timeout_ms": 60000`.
111+
112+
## Verify Installation
113+
114+
1. Connect and inspect the server without opening a session:
115+
116+
```sh
117+
fx mcp list --connect
118+
```
119+
120+
The `github` entry should report `state=ready` along with its negotiated name and tool count.
121+
122+
2. Try a prompt that references the server by name:
123+
124+
```
125+
Use the github MCP server to list my recently merged pull requests.
126+
```
127+
128+
## Managing the Server
129+
130+
| Command | Purpose |
131+
| --- | --- |
132+
| `fx mcp list` | List configured servers from `mcp.json` without connecting. |
133+
| `fx mcp list --connect` | Connect and discover before rendering health. |
134+
| `fx mcp remove github` | Remove the server from the profile. |
135+
| `fx mcp path` | Print the path of the file fx reads. |
136+
| `/mcp reload` | Apply a hand edit without restarting an open session. |
137+
138+
## Troubleshooting
139+
140+
- **`401 Unauthorized` from the remote server**: confirm the environment variable named in `bearer_token_env` is exported in the shell that starts fx, and that the PAT is valid and not expired.
141+
- **Server reports `state=failed`**: run `fx mcp list --connect` for the failure line, and see the [Installation Guides README](./README.md) for shared troubleshooting.
142+
- **Context window exceeded**: the GitHub MCP server registers many tools. Filter with the `X-MCP-Toolsets` header shown above.
143+
- **Docker errors on the local server**: ensure Docker is running and the image has been pulled (`docker pull ghcr.io/github/github-mcp-server`).
144+
145+
## Important Notes
146+
147+
- **Configuration key**: fx uses `mcp` (not `mcpServers`).
148+
- **Config location**: `~/.fx/mcp.json`. Run `fx mcp path` to print it.
149+
- **Type discriminator**: `"type": "http"` for the remote server, `"type": "local"` for stdio.
150+
- **Command shape**: `command` is a single array combining the executable and its arguments.
151+
- **Environment variable key**: `environment` (`env` is also accepted).
152+
- **Credentials**: a literal `Authorization` header is rejected. Use `bearer_token_env` for a bearer token, or `header_env` to map a header name to an environment variable.
153+
- **CLI and session commands**: every `fx mcp` subcommand is also available inside a session as `/mcp`, for example `/mcp list`.

0 commit comments

Comments
 (0)