Connecting to a remote MCP server
An MCP server gives the agent extra tools. A remote one is reached over HTTPS with a URL and a token, and nothing is installed locally. Keys: config.md.
Before you start
- The URL of the server’s MCP endpoint, such as
https://api.githubcopilot.com/mcp/. - A fixed token the server accepts (a personal access token, an API key). OAuth isn’t supported.
- Harness 0.15.0 or later.
Setup
1. Put the token in an environment variable, never in the config file. Type this, don’t paste it:
read -rs GITHUB_PAT; export GITHUB_PAT; echo "length: ${#GITHUB_PAT}"
Tokens shorter than 8 characters are refused.
2. Add the server to your own config.toml (default ~/.config/harness/config.toml; harness paths shows
yours). A project’s config can’t add servers.
[mcp.servers.github]
url = "https://api.githubcopilot.com/mcp/"
token_env = "GITHUB_PAT" # the variable's name, not the token
tools = ["search_issues", "issue_read"] # optional: offer only these
allow = ["search_issues"] # optional: run without asking
githubis any name you choose.- The token is sent as
Authorization: Bearer …;token_header = "X-API-Key"uses another header. - Without
toolsyou get every tool, and each costs model context.
3. Run harness run in the same terminal and type /mcp. Expect a line like:
github http · api.githubcopilot.com · 2026-07-28 · 2 of 46 tools · ≈N tokens
Using it
Ask in plain language; the agent picks the tool. Every call asks first unless the tool is in allow: y allows
it, n denies it and stops the turn, 4 denies it with a message to the agent. A server’s read-only label is
informational only.
--approve-allskips asking all session; use it only with servers you trust.- Plan mode offers no MCP tools.
/awayrefuses any call that would ask.
/mcp shows servers, tools, calls and failures.
What the harness does with your token
- It goes only to that server’s address; redirects are never followed.
- Calls are logged, the token never is; if the server echoes it, the log shows
[redacted]. harness replayreplays the session with no server and no token.
Good to know
- Tools are fixed at session start; new ones appear next session.
- Resuming reloads tools from the log and reconnects at the first call. If the server’s config changed, its calls are refused; start a new session.
- Results are text only, up to 64 KiB; an image becomes a placeholder like
[image: image/png, 1234 bytes]. - The URL must be
https://, orhttp://for a loopback address such as127.0.0.1.
If something goes wrong
| You see | Likely cause |
|---|---|
mcp: github failed to start: GITHUB_PAT is not set | Not exported in this terminal. Do step 1 here, then start a new session. |
failed to start: … 401 or 403 | Token wrong, expired or lacking access. |
failed to start: timed out after 30 s | Server unreachable or slow; if slow, set startup_timeout = 60. |
/mcp lists no servers | Another config file was read; check harness paths. |
| A load error naming a key | A typo in [mcp.servers.…]. |