Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The practical answer: VS Code can run an MCP server you build as a separate process, or an extension can provide server definitions through the Extension API. For a standalone server, choose an MCP SDK and a transport (usually local stdio or Streamable HTTP), implement only the capabilities you need, then register the process in .vscode/mcp.json, portable .mcp.json, or your user profile. For an extension-distributed server, contribute an mcpServerDefinitionProvider and register the matching provider in extension code.

Choose the delivery route before writing code

Your first decision is who owns the server definition and how users receive it.

Standalone server

A standalone server is an executable or service that speaks MCP. VS Code starts a local process from a configuration file, or connects to a remote endpoint. This is the simplest route for a personal tool, an internal service, or a server that should work with several MCP clients.

Extension-provided server

An extension can distribute configuration and create definitions dynamically. This is preferable when installation, authentication, account selection, or Marketplace distribution belongs inside an extension. The extension contributes a provider in package.json and registers it with vscode.lm.registerMcpServerDefinitionProvider.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Decision table

Question Standalone Extension provider
Distribution Workspace, user profile, or your own installer VS Code extension and its configuration
Runtime Local process or remote service Definitions returned by extension code
Best fit Reusable server across clients Integrated setup, authentication, or Marketplace delivery
VS Code API required No Yes

Pick a language and transport

VS Code’s guidance allows any language that can handle standard input and output. Official SDKs are available for TypeScript, Python, Java, Kotlin, and C#. Use the SDK documentation for your chosen language for installation and package versions; those versions change, so do not copy an old lockfile or command blindly.

Local stdio

With stdio, VS Code launches your program and exchanges MCP messages through its standard streams. Never write logs to stdout: diagnostic text there can corrupt the protocol. Send logs to stderr or a file.

Streamable HTTP

Streamable HTTP is appropriate for a server hosted separately from VS Code. Plan authentication, TLS, request limits, and deployment before exposing it outside your machine.

Legacy SSE

VS Code documents legacy Server-Sent Events support for compatibility. Prefer the currently recommended transport in your SDK unless an existing service requires SSE.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build the standalone server

  1. Select capabilities. MCP supports tools, prompts, resources, elicitation, sampling, OAuth authentication, server instructions, roots, and MCP Apps. A basic server does not need all of them; implement the smallest useful surface.
  2. Create the server with the official SDK. Follow that SDK’s current quickstart for initialization, handlers, schema validation, and transport setup. Keep tool inputs narrowly typed and return useful errors rather than throwing opaque exceptions.
  3. Keep protocol output clean. For stdio, reserve stdout for MCP traffic. Include request IDs and structured error information through the SDK rather than printing ad-hoc text.
  4. Make shutdown predictable. Handle termination signals, close files and network clients, and exit with a nonzero status only for an actual startup or runtime failure.

Because SDK package names and versions vary by language, the safe publication-ready workflow is to use the current official SDK tutorial for your language and then connect the resulting executable to the VS Code configuration below.

Register a server in VS Code

VS Code-specific workspace configuration

Create .vscode/mcp.json. VS Code expects a top-level servers object and provides IntelliSense for this file.

{
  "servers": {
    "my-local-server": {
      "type": "stdio",
      "command": "path-to-your-server",
      "args": [],
      "env": {
        "EXAMPLE_SETTING": "value"
      }
    }
  }
}

Replace path-to-your-server with the command or absolute executable path produced by your SDK project. Add command-line arguments only when your server defines them. Keep secrets out of this file; use environment-variable substitution or an environment file supported by your configuration and SDK.

Portable workspace configuration

If you want a format intended to be shared across compatible MCP tools, create .mcp.json at the workspace root. Its key is mcpServers, not servers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{
  "mcpServers": {
    "my-local-server": {
      "command": "path-to-your-server",
      "args": []
    }
  }
}

User profile configuration

Use the user-level MCP configuration when the server should be available in multiple workspaces. This avoids duplicating the entry, but it also makes the server available more broadly, so review its permissions carefully.

Guided setup

Run the Command Palette command MCP: Add Server to create a definition interactively. After adding it, use VS Code’s MCP management commands to start, stop, restart, list, and show output for the server.

Develop and debug the process

For iterative work, use the documented dev configuration with watch patterns so VS Code can restart the server when source files change. The VS Code developer documentation also describes Node.js and Python debugging for stdio servers. Set breakpoints in the server process rather than inserting logging into stdout.

  • Start the server and confirm it appears in the MCP server list.
  • Open the server output view and check startup diagnostics.
  • Invoke one small tool before testing expensive or state-changing operations.
  • Change one input at a time while watching logs and exit codes.

Create an MCP server provider in an extension

The extension route has two required pieces.

1. Contribute the provider in package.json

{
  "contributes": {
    "mcpServerDefinitionProviders": [
      {
        "id": "example.mcpProvider",
        "label": "Example MCP Server"
      }
    ]
  }
}

The id is the stable identifier that your extension code registers. The label is the user-facing name shown by VS Code.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Register the matching provider

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {
  const provider = {
    provideMcpServerDefinitions: async () => {
      return [/* return MCP server definitions here */];
    },
    resolveMcpServerDefinition: async (definition: unknown) => {
      // Resolve authentication or other interactive setup here.
      return definition;
    }
  };

  context.subscriptions.push(
    vscode.lm.registerMcpServerDefinitionProvider(
      'example.mcpProvider',
      provider
    )
  );
}

Use the exact definition types and method signatures exposed by the VS Code version targeted by your extension. The provider can perform work that needs user interaction, such as authentication, before returning a definition that VS Code can start.

Security, trust, and permissions

A local MCP server can execute arbitrary code on the machine. Review the publisher, source, command, arguments, environment variables, and update process before starting it. Do not hardcode API keys in workspace files or extension source.

Workspace MCP configuration follows Workspace Trust. In Restricted Mode, workspace MCP configuration is blocked. Treat a repository’s MCP file like executable build configuration: inspect it before trusting the folder.

VS Code documents sandboxing controls that can restrict file writes and network domains when enabled, but sandboxing is currently unavailable on Windows. Where sandboxing is available, tool calls inside the controlled sandbox are automatically approved; that does not make an unreviewed server safe.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Transport and deployment choices

Need Recommended approach Things to plan
Private tool on one computer stdio and workspace or user configuration Executable path, environment, file permissions
Team service Streamable HTTP TLS, authentication, authorization, rate limits, logs
Existing compatibility endpoint Legacy SSE when required Client and SDK compatibility, migration path
Marketplace-integrated setup Extension provider Provider lifecycle, authentication, updates, trust
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

The server never appears

Check the filename and object name: .vscode/mcp.json uses servers, while portable .mcp.json uses mcpServers. Confirm the file is in the intended workspace and that Workspace Trust is enabled.

It starts and immediately stops

Run the command directly in a terminal, verify the executable path and working directory, and inspect VS Code’s server output. A missing runtime, bad argument, or startup exception usually appears there.

Tools time out

Test a small request, then inspect network access, credentials, and remote-service latency. For stdio, ensure the server is not waiting for interactive terminal input.

Protocol or parse errors

Remove all debug prints from stdout. Send diagnostics to stderr and let the SDK encode protocol messages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Secrets are missing

Confirm the environment is available to the process VS Code launches; a shell’s interactive profile is not always loaded. Use the configuration’s supported variable or environment-file mechanism and restart the server after changing it.

The extension provider is ignored

Verify that the manifest provider ID exactly matches the ID passed to registerMcpServerDefinitionProvider, then reload the extension host and inspect its output.

Performance and reliability practices

  • Keep tool schemas narrow so models send fewer invalid requests.
  • Paginate large resources instead of returning entire repositories.
  • Cache immutable metadata, but make cache invalidation explicit.
  • Set network timeouts and cancellation handling for every remote call.
  • Return actionable, sanitized errors; never leak tokens or local paths unnecessarily.
  • Version your server and document required environment variables.
  • Test startup, shutdown, malformed input, denied permissions, and unavailable dependencies.

Or skip the browser setup

If your MCP project needs website images or PDFs, ScreenshotNeo provides a website screenshot API and MCP server. Its one-call endpoint accepts a URL and returns PNG, JPEG, WebP, or PDF output.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the complete request options in the ScreenshotNeo documentation. Before capture it accepts consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can a single VS Code workspace use more than one MCP server?

Yes. Add separate entries under the configuration file’s server object and give each a unique name.

Should I choose stdio or Streamable HTTP for a remote server?

Use stdio for a process VS Code launches locally. Use Streamable HTTP when the service runs separately and you need network access, authentication, and deployment controls.

Is an extension provider required for every MCP server?

No. A standalone process configured in workspace or user settings does not require an extension provider.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.