Skip to main content

Connect Windsurf to an MCP Server

This guide explains how to connect an MCP server to Windsurf, allowing you to interact with your API using natural language directly within the Windsurf interface.

Interactive Configuration Generator

🛠️ Configuration Generator

Select your authentication type and fill in your details to generate a personalized configuration:

Authentication Type:
Generated Configuration
mcp.json
{
"mcpServers": {
"my-mcp-server": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://your-mcp-server.com",
"--header",
"API_Key: ${API_KEY}"
],
"env": {
"API_KEY": "your-api-key-here"
}
}
}
}

Before You Start

Before connecting Windsurf to your MCP server, make sure you have:

  • Access to the Windsurf code editor.
  • One of the following:
tip

To learn more about how MCP works, visit the MCP Concept page.

Connect Windsurf to a Remote MCP Server

Use this method if your MCP server is deployed and accessible over the internet through an URL. If you generated your MCP server using the liblab hosting service, use this option.

  1. Open Windsurf.
  2. Use the interactive configurator above to generate your configuration with proper authentication.
  3. In the Windsurf chat, click the MCP servers button (hammer icon), then click Configure. This will open the Manage plugins tab.
  4. Click View raw config to open the mcp_config.json file and paste your generated configuration.
  5. Back in the Manage plugins tab, click Refresh to connect Windsurf to your MCP server and fetch the available tools.
  6. Once connected, you can query your API using natural language in any Windsurf prompt or chat.

Connect Windsurf to a Local MCP Server

Use this method if you’re running the MCP server locally, generated from an OpenAPI spec using liblab CLI.

Generate your MCP server with liblab

If you haven’t yet generated your MCP server, follow the Generate an MCP Server with liblab CLI guide.

After generating the server using the liblab CLI, navigate to the output folder and run:

cd output/mcp
npm run setup

Now, you need to update Windsurf's plugins settings:

  1. Open Windsurf.

  2. In the Windsurf chat, click the MCP servers button (hammer icon), then click Configure. The Manage plugins tab will appear.

  3. Click View raw config to open the mcp_config.json file.

  4. Add your local MCP server configuration. Update the path and environment values accordingly, then save the file.

    mcp_config.json
    {
    "mcpServers": {
    "your-local-api": {
    "command": "node",
    "args": [
    "<path-to-liblab-generated-mcp-server>/output/mcp/dist/index.js"
    ],
    "env": {
    "YOUR_API_KEY": "<your-api-key>"
    }
    }
    }
    }
    MCP server authentication

    Make sure to use the correct environment variable name expected by your API.

  5. In the Manage plugins tab or directly within the Windsurf chat, click Refresh to load and activate your local MCP server.

  6. Once connected, you can query your local API using natural language.

    Using MCP in Windsurf

Next Steps

To continue working with MCP and Windsurf, explore these resources: