Local MCP server (stdio)
Updated November 24, 2026
A local MCP server is a program that runs on the user's own machine, started by the MCP client as a subprocess and connected over the stdio transport. It reads protocol messages from standard input and writes replies to standard output. It typically serves a single client and takes any credentials it needs from its environment.
In short: A local MCP server is a program the MCP client launches on the same machine and talks to over stdin and stdout, typically serving one client and reading its credentials from the environment.
How a local MCP server works
A local server uses the stdio transport. The MCP client launches the server as a subprocess, writes JSON-RPC requests to the server's standard input and reads messages from its standard output 1. Each message sits on its own line, and messages must not contain embedded newlines 1.
All traffic shares that one channel. The server writes responses matched to requests by JSON-RPC id, notifications tied to a request in progress, and notifications for an active subscriptions/listen request 1. The server never sends its own requests on stdout, and the client cancels a request by sending a notifications/cancelled notification 1.
Standard error carries logs. A server may write UTF-8 log lines to stderr, and the client may capture, forward or ignore them without treating them as errors 1. Standard output is reserved for protocol traffic, and the server must not write anything else there 1. A stray debug print in server code breaks this rule and corrupts the message stream.
The client controls the process lifetime. To shut down, it closes the server's input stream, waits for the server to exit and terminates the process if it does not exit in reasonable time 1. If the server crashes, the client should restart it, and because the protocol is stateless, in-flight requests are lost and can be retried against the new process 1.
Credentials work differently from a remote MCP server. The MCP authorization specification says servers on stdio should not follow it and should retrieve credentials from the environment instead 3. An API key for a downstream service usually goes into an environment variable that the client passes when it launches the server.
The architecture guide describes stdio as direct communication between local processes on the same machine, with no network overhead 2. Local servers that use stdio typically serve a single MCP client 2. Each host application that wants the same server starts its own copy of the process.
Security rules for a local MCP server
A local server runs on the user's machine with whatever access its process has, so the risk sits in what it can reach.
Scope the access. Pass only the folders, databases or accounts the server needs. A filesystem server given a whole home directory can read everything in it.
Keep secrets in the environment. The authorization specification points stdio servers to credentials from the environment 3. Keep keys out of shared config files and source control.
Keep the channel clean. Only valid MCP messages may go to standard output, and the client must not write anything else to the server's standard input 1.
Approve write actions. A local server can change files on the machine, so the host application should ask before it runs an MCP tool that writes or deletes.
Shut down cleanly. Servers should exit promptly when their standard input closes, which is the main portable shutdown signal 1.
Install local servers from sources the team trusts, pin their versions and review what each one can reach before adding it to a shared setup. A local server that only reads one project folder carries far less risk than one with access to the whole disk and a set of production keys.
Example of running a local MCP server next to a remote one
A data analyst wants an assistant to read a CSV export on a laptop, add company data to each row and save the result, without uploading the file anywhere by hand.
Step 1 Add a filesystem server to the client config for one exports folder
Step 2 Restart the client so it launches the server over stdio
Step 3 Add RichAPI's remote server URL and sign in
Step 4 Ask the assistant to read accounts.csv from the exports folder
Step 5 The assistant calls enrichment tools for each row
Step 6 Approve the write that saves accounts-enriched.csvThe filesystem server runs as a subprocess of the client and sees only the folder named in its arguments. The stdio channel between the client and this server stays on the laptop, because stdio connects two local processes 2. The file contents still reach the model through the host application, so the folder should hold only data the analyst may process with the assistant.
The enrichment step runs on RichAPI's remote server, which users connect to by URL with a sign-in and no API key to copy 4. The host keeps one MCP client per server, so the local filesystem server and the remote data server each get their own connection in the same session 2.
The split follows where each capability lives, and it keeps the two kinds of risk apart. The CSV sits on the laptop, so a local server reads it. The company data comes from a hosted API with billing and sign-in, so a remote server provides it. If the filesystem server crashes during the run, the client should restart it and can retry the read 1.
Local MCP server vs MCP client
Both often run on the same laptop, which makes them easy to mix up. The client lives inside the host application and starts the connection, and the local server is the separate program the client launches as a subprocess 1.
| Local MCP server | MCP client | |
|---|---|---|
| What it answers | What tools and data can this device offer? | How does the app reach MCP servers? |
| Input | JSON-RPC requests on standard input | Server configs and user prompts |
| Output | Tool results and resource contents | Requests to servers and results for the model |
| Cost driver | The work each tool does on the device | One connection per configured server |
| Main risk | Too much access to local files and keys | Connecting to a server nobody vetted |
| Use it when | A capability lives on the device | An app needs to talk to any MCP server |
Frequently asked questions
What is stdio in MCP?
Stdio is the MCP transport that runs over standard input and standard output. The client launches the server as a subprocess, writes JSON-RPC messages to its stdin and reads messages from its stdout, one message per line 1. Logs go to stderr, which the client may ignore 1.
How do you set up a local MCP server?
Add an entry to the client's MCP configuration with the command that starts the server and its arguments, then restart the client so it launches the process. Put API keys in environment variables, since stdio servers should take credentials from the environment 3.
Is a local MCP server safer than a remote one?
It depends on the data and on who manages the server. Its stdio channel never leaves the machine, but the server can reach whatever its process can reach, including files, keys and the network. A remote server is exposed to the internet but can use OAuth sign-in and scoped tokens 3.
Can one MCP client use local and remote servers together?
Yes. A host application runs one MCP client per server connection, so a local filesystem server and a remote data server can work in the same session 2. The model sees tools from both and picks the one that fits each step.
The bottom line
A local MCP server is a program the client launches on the same machine and talks to over stdio, typically serving one client 2. It takes credentials from its environment rather than the OAuth flow 3, and only valid MCP messages may reach its standard output 1. Use local servers for files and tools on the device, and limit what each one can reach.
Sources
- stdio transport (specification, version 2026-07-28), Model Context Protocol
- Architecture overview, Model Context Protocol
- Authorization (specification, version 2026-07-28), Model Context Protocol
- RichAPI MCP server, RichAPI