Guilds AI / AI Blog

,

MCP Server Setup: How to Connect Local and Remote Servers

An AI client connects to a local file server or a remote MCP server through a controlled gateway.

MCP server setup involves choosing a trusted Model Context Protocol server, configuring a compatible AI client to launch it locally or connect to it remotely, and verifying that its tools work with the intended permissions. A local server typically uses standard input and output (stdio); a remote server generally uses Streamable HTTP. For a hosted server example in a coding editor, see how to use Zapier with Cursor. Python developers using LangChain can follow our LangChain MCP adapter tutorial for tool discovery and migration. For the conceptual architecture behind these connections, see our LLM MCP guide. Readers seeking a broader technical book that covers MCP and agent development can consult our AI Agents in Action reading guide.

You do not need to write a new server to use MCP. If you need a capability no existing server provides, building a custom server instead requires selecting an MCP SDK, implementing its tools or other capabilities, and testing the transport independently before connecting a client. This guide shows how to connect an existing server, starting with an isolated local file example. It also explains remote connections, common configuration errors, and checks to perform before giving an AI agent access to real business systems.

Choose local or remote MCP

MCP provides a standardized way for a client to discover and use capabilities exposed by a server. The host application manages the user’s interaction with the model and its MCP clients. The server exposes capabilities such as tools, resources, or prompts; it does not need to run a language model of its own. For a broader explanation of how this fits into an agent’s architecture, see our AI agent integration guide.

SetupHow it connectsTypical useWhat you manage
Local stdioClient starts a process and exchanges messages through stdin/stdoutLocal development or a restricted workspaceRuntime, launch arguments and local access
Streamable HTTPClient connects to a server endpoint over HTTPShared or hosted servicesEndpoint, authentication, network and server operations

The transport and hosting location are related but not identical. A developer can also run an HTTP server locally for testing. Use the transport specified by the server publisher and supported by your client. Some older implementations use a separate HTTP/SSE transport; do not assume an old SSE endpoint is interchangeable with a Streamable HTTP endpoint.

Check the requirements

Start with a specific task, such as reading a sample project note, rather than installing every server you find. Decide which client will make the request, which server exposes the capability, and whether the server needs access to local files or an external service.

Check the publisher’s installation instructions, required runtime version, configuration format, authentication method and supported operating systems. A Node-based server may need Node.js and npm; a Python server may require Python or uv. Install only the runtime required by the selected server. A remote endpoint usually does not require a local server runtime.

Review the server’s source or publisher reputation, release history, permissions and supported tools. Use a maintained, explicitly selected version rather than automatically downloading the latest release every time. A version pin is useful for reproducibility, but it does not remove supply-chain risk or guarantee the security of dependencies.

Set up a local MCP server

1. Create a restricted test directory

Create a directory called mcp-sandbox in a location you control. Inside it, create a text file named setup-test.txt containing a harmless sentence, such as โ€œMCP connection test: successful.โ€ Do not use your home directory, downloads folder, private documents or production data for this initial test.

2. Confirm the runtime

The MCP Filesystem reference server is one possible test server. It exposes both reading and file-modification capabilities, so restrict the initial setup to a disposable directory containing only sample data. Its current local setup guide specifies Node.js 24 or newer for the documented release. Verify your installed runtime before editing the client configuration.

node --version
npm --version

3. Configure the MCP client

For Claude Desktop, open the application settings, select Developer and use Edit Config. The local server configuration is stored in claude_desktop_config.json. The following example uses the version shown in the official local setup guide and a deliberately limited directory. Replace the example path with the absolute path to your own test folder. Merge the server entry into your existing configuration rather than replacing unrelated server entries.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem@2.4.1",
        "/Users/yourname/mcp-sandbox"
      ]
    }
  }
}

On Windows, use a path such as C:\\Users\\yourname\\mcp-sandbox in the JSON string, with the backslashes escaped correctly. If the application cannot find npx, check the runtime installation and use the documented full executable path or Windows command wrapper where required. The -y option suppresses package-install confirmation, so review the exact package and version before using it.

Different clients use different configuration schemas. For example, some VS Code configurations use a servers object with an explicit stdio type, while native Copilot configurations use mcpServers. JetBrains AI Assistant provides a dedicated MCP settings dialog. Follow the documentation for the exact client and configuration destination you are using rather than copying a JSON file between applications unchanged.

4. Restart or reload the client

Save the valid JSON file and restart Claude Desktop completely. Other clients may let you apply the configuration or start the server without restarting. Open the server or connector list and inspect its connection status. A local stdio server is generally launched by the client; you do not need to keep a separate terminal process running.

Connect a remote MCP server

A remote MCP server runs as a service and provides an endpoint that compatible clients can reach. Obtain its actual endpoint from the trusted publisher or your administrator. Confirm that the service supports the client’s transport and authentication requirements. For an organization-managed service, verify whether the client is allowed to access it.

In a client such as JetBrains AI Assistant, select the MCP connection settings, add a remote server, and enter the endpoint in the configuration format the client expects. This is an illustrative configuration, not a real service: replace the example endpoint with the one supplied by your server administrator.

{
  "mcpServers": {
    "companyDocs": {
      "url": "https://example.com/mcp"
    }
  }
}

Complete OAuth sign-in if the server and client support it, or use the client’s documented secure credential mechanism. Never paste a production token into the chat or commit an authentication header to a shared configuration file. For hosted services, require HTTPS and narrow permissions. If you maintain the server, enforce authorization on the server side for each requested operation.

A cloud-based AI client cannot normally reach a service listening only on your computer’s localhost address. Use a supported deployment or private network connection appropriate to your organization. Do not expose a development server publicly without authentication just to make the connection work.

Verify the connection

A server appearing in a settings list is not proof that its tools work. Verify the full path from capability discovery through a successful, authorized tool call. Earlier protocol revisions use an initialization handshake; the July 28, 2026 revision uses a stateless core and server/discover. Check that both the client and server support a compatible revision.

For the local file example, ask the client to identify the connected filesystem server and read setup-test.txt inside the approved directory. Check that the application shows the intended tool call and that the returned text matches the file you created. Do not rely on an AI-generated answer alone: inspect the actual execution record where the client exposes it.

Next, check that a harmless test request outside the permitted directory is rejected. Use a dummy test location rather than sensitive data. If the client prompts for tool approval, review the operation and arguments before approving it. Verify that permissions remain limited after restart. Our article on tool discovery for AI agents explains how available tools can be selected for tasks.

For a remote server, test an approved read-only operation and inspect the server’s logs for the expected user identity, operation and response status. A developer can also use MCP Inspector to inspect the connection and issue a test tool call independently of a language model. The Inspector is a debugging tool, not a replacement for authentication or authorization.

The configuration examples above were checked against published documentation and JSON syntax. They have not been executed against a live MCP client for this article.

Troubleshoot setup errors

SymptomLikely causeWhat to check
Server is missingWrong configuration file or invalid JSONConfirm configuration scope; validate JSON; reload client
Command not found or ENOENTRuntime unavailable to the client processCheck executable path, installation and environment
Server exits immediatelyInvalid arguments or missing dependencyInspect server stderr and publisher instructions
Connection fails over HTTPWrong endpoint, TLS or network restrictionCheck the exact endpoint, network access and certificate
HTTP 401 or 403Missing authentication or insufficient permissionSign in again or request the correct scoped access
Connected but no tools availableServer exposes a different capability, or client filters toolsInspect advertised capabilities and enabled tools
Tool call failsInvalid inputs or upstream service errorCompare actual arguments, logs and service response

For a local stdio server, diagnostic logs should go to stderr rather than stdout, because stdout carries protocol messages. If a server prints arbitrary startup banners to stdout, the client may fail to parse them. Check the client logs before changing several settings at once; change one variable and repeat the same test.

Secure your MCP setup

Treat an MCP server as executable software with access to data and potentially side-effecting actions. A local server may operate with the permissions of the account that launched it. Limiting an application-level file path is helpful, but it is not a substitute for operating-system isolation when the server code is untrusted.

Start with read-only capabilities where possible and give each integration the minimum access required. Use isolated development environments, scoped credentials, explicit approval for consequential operations, and logs that avoid recording secrets. For write operations, the underlying service should validate inputs and permissions instead of relying on the model to decide whether an action is allowed.

Tool output can contain untrusted text, including instructions embedded in documents or returned by external services. Treat that output as data, not as authorization to execute new actions. For business deployments, combine MCP with the controls in our AI workflow automation governance guide. If you are deciding which capabilities to connect next, explore our MCP server use cases guide.

Frequently asked questions

Do I need to build an MCP server from scratch?

No. You can configure a compatible client to use an existing server. Build your own only when an available integration does not expose the capability you need or cannot meet your security requirements.

Can I run an MCP server locally without internet access?

Yes, if the server and its dependencies are already installed and all required resources are local. The AI client may still require an internet connection for model inference, authentication or other services.

Is an MCP server the same as a REST API?

No. MCP provides a standardized way for clients to discover and interact with server capabilities. An MCP server may call a REST API internally. Our guide to integrating external APIs with AI coding agents explains when direct API access or an MCP adapter is useful.

How do I know my MCP setup is working?

Confirm that the client connects, that it discovers the expected capability, and that a known test operation returns the correct result. Also verify that unauthorized operations are rejected.

Can one client use multiple MCP servers?

Many clients support several server connections. Add them individually, use descriptive names, and test each connection before combining them. Limit available tools to those required for the task to reduce unnecessary permissions and confusion.