How to set up an MCP server: configs for every client
One server definition, the right file for each client, and a short list of checks when it does not connect.
Setting up an MCP server means adding one entry to your client's configuration: a command and arguments for a local server that the client starts, or a URL for a remote server it connects to. Each client reads its own file, so the same server is described slightly differently in Claude Code, Cursor, VS Code and Codex.
This guide gives the configuration for each client, two common examples, and fixes for the errors you are most likely to meet.
What do you need before setting up an MCP server?
A client that supports MCP, a runtime for local servers, and an address plus sign-in method for remote ones. The MCP specification defines two standard transports: stdio, where the client starts the server as a local process, and Streamable HTTP, where the server is an endpoint on the network. The older HTTP+SSE transport is deprecated.
Most local servers are published as npx or uvx packages, so install Node.js or Python first. Remote servers need no runtime, only their URL and, usually, an OAuth sign-in or a token.
How does an MCP server entry work?
| Field | Used for | Example |
|---|---|---|
command |
The program a local server runs | "npx" |
args |
Its arguments | ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"] |
env |
Environment variables for that process | {"API_TOKEN": "..."} |
url |
A remote server's endpoint, instead of command |
"https://mcp.example.com/mcp" |
A local stdio entry:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
}
}
}
A remote entry only needs a URL. When the server supports OAuth, as Fileaify's does, the client opens a browser page to sign in and no token goes in the file:
{
"mcpServers": {
"fileaify": { "url": "https://fileaify.com/mcp" }
}
}
How do you set up an MCP server in each client?
Claude Code
Use the CLI (Claude Code MCP documentation): claude mcp add --transport http <name> <url> for a remote server, claude mcp add <name> -- <command> [args] for a local one. Project-scoped servers go in .mcp.json at the project root, under mcpServers, and can be committed. /mcp shows each server's status and runs OAuth sign-in.
Cursor
Cursor reads .cursor/mcp.json in a project and ~/.cursor/mcp.json for all projects, with the mcpServers format above; remote servers use url, with optional headers, and Cursor supports OAuth (Cursor MCP documentation). Check the server's status in Cursor's MCP settings after saving.
VS Code
Run MCP: Add Server from the Command Palette and follow the guided flow (VS Code MCP servers documentation). VS Code's configuration uses a servers object rather than mcpServers; the server then appears in the tools list of Copilot's agent mode.
Codex
Codex keeps servers in config.toml, one [mcp_servers.<name>] table each, or adds them with codex mcp add <name> --url <url> for a remote server and codex mcp add <name> -- <command> for a local one.
Two examples
GitHub MCP server
GitHub publishes its own server (github/github-mcp-server). The remote version lives at https://api.githubcopilot.com/mcp/; the local version runs from the Docker image ghcr.io/github/github-mcp-server. The older @modelcontextprotocol/server-github package is archived.
If you use a personal access token with the local server, set it in GITHUB_PERSONAL_ACCESS_TOKEN, make it fine-grained, limit it to the repositories the agent needs, and give it a short expiry. Read access to contents covers most coding tasks; add write access to contents and pull requests only if the agent will push. GITHUB_TOOLSETS limits which groups of tools are exposed. For a way to give agents one repository at a time without a personal token, see GitHub access for AI coding agents.
Home Assistant
Home Assistant includes an MCP server integration (Home Assistant MCP Server). Clients connect to /api/mcp on your instance over HTTP, and sign in with OAuth 2.0 and PKCE. In Claude Code: claude mcp add --transport http home-assistant <your_mcp_server_url>.
Why isn't your MCP server connecting?
- Connection refused. Nothing is listening at that address. For a remote server, check the URL and path. For a stdio server, run the
commandandargsby hand: a missing binary often hides behind this error. - Server connected, no tools. Check the client's MCP log. A filter such as
GITHUB_TOOLSETSset to a name that does not exist leaves the list empty. - 401 or invalid token. Test the same token or sign-in outside MCP, then check its scopes and expiry.
- Crash at start. Usually a runtime version mismatch. Run the command in a terminal to see the error the client hides.
- Nothing changed after editing. Restart the client or start a new session; most read the file once.
How do you share one setup across agents?
MCP connects tools; it does not give your agents a shared memory. Claude Code, Codex and Cursor each keep their own conversation, so switching agents still means re-explaining the plan unless that plan lives somewhere they all read: an AGENTS.md in the repository for conventions, and a shared project record for decisions and state.
Fileaify is that shared record, reached with the remote entry above. Each agent reads the same project documents, proposes changes you review, and requests access to services when needed; keys stay in the vault and are used on the server side. The MCP connectors guide explains how to choose between kinds of connectors.
Sources
- MCP specification: transports: stdio, Streamable HTTP and the deprecated HTTP+SSE.
- Claude Code: MCP, Cursor: MCP and VS Code: MCP servers: configuration per client.
- GitHub MCP server and Home Assistant MCP Server: the two examples.
Try it
The demo runs on a prepared project, with no account. To connect your agents to one project, create a free workspace and add https://fileaify.com/mcp to your client.
Common questions
Do I need to restart my editor after changing an MCP config?
Usually yes. Most clients read their MCP configuration when they start or when a new session opens, so reload the window or start a new session after editing it.
Can I use the same MCP config in Cursor and VS Code?
Almost. Both describe the same servers, but Cursor reads an mcpServers object in .cursor/mcp.json while VS Code's mcp.json uses a servers object. Copy the entry and adjust the wrapper.
Is it safe to put API keys in an MCP config file?
Only if the file never reaches version control. Prefer environment variables or the client's input prompts, scope tokens narrowly, and prefer servers that sign in with OAuth.
Should I use stdio or HTTP?
Use stdio for a server that runs on your own machine and is started by the client. Use Streamable HTTP for a remote or shared server reached by URL.
Written with AI assistance, reviewed by Stéphane Mermet and checked against the product. Fileaify publishes this guide and sells the service it describes.