How do I call an MCP server locally?
Running the server on your machine
Most local MCP servers are small programs that you start from a terminal or a config file. Read the server's README to find the start command and any required environment variables. Keep API keys in environment variables rather than pasting them into code or config files that others might see.
Once the server runs, confirm it starts without errors before you connect anything. A clear startup message or a listed set of tools is a good sign that the server is ready.
Connecting a client
Clients usually store server details in a config file with a name, a command and any arguments. Use the same command you tested in the terminal so the client launches the server the same way. If the server uses a local port, make sure nothing else is already using it.
Restart the client after editing the config, then check that the server's tools appear in the tool list. If they do not, look at the client's log output for connection errors.
- Read the server's start command in its documentation.
- Store secrets in environment variables.
- Test the server in a terminal before connecting a client.
- Check the client log when tools fail to appear.
Common mistakes
- Hard-coding API keys into the config file and sharing it by accident.
- Assuming the client will find the server without restarting after a config change.
