Claude Code MCP: How to Add MCP Servers (Complete Guide)

4 min read 1 month ago
Published on Jul 31, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial provides a comprehensive guide on how to enhance your Claude Code agents by adding Model Context Protocol (MCP) servers. By integrating servers like Context7 for documentation and Bright Data for web scraping, you can significantly improve the functionality of your AI agents. This guide will walk you through setting up both remote and STDIO servers, configuring environment variables, and installing necessary components on Windows without WSL.

Step 1: Understanding MCP Server Types

Before diving into the setup, it's essential to know the types of MCP servers:

  • Remote MCP Servers: These servers are accessed over the internet and can provide dynamic data and documentation.
  • Local (STDIO) Servers: These are hosted on your local machine and are suitable for development and testing.

Step 2: Adding a Remote MCP Server (Context7)

To integrate a remote MCP server like Context7, follow these steps:

  1. Gather Required Information:

    • Ensure you have the API endpoint and any required authentication keys from Context7.
  2. Use MCP Add Command:

    • The command structure to add a remote MCP server is as follows:
      MCP add --name <server_name> --type remote --url <server_url> --api-key <your_api_key>
      
    • Replace <server_name>, <server_url>, and <your_api_key> with your specific details.
  3. Execute the Command:

    • Run the command in your terminal to add the remote server.

Step 3: Adding STDIO Servers

To set up a local STDIO server, follow these steps:

  1. Start the STDIO Server:

    • Use the command:
      MCP start --type stdio
      
  2. Verify the Server is Running:

    • Check your terminal output for confirmation that the server has started successfully.

Step 4: Configuring Environment Variables and API Keys

Proper configuration of environment variables is crucial for your servers to function correctly.

  1. Set Environment Variables:

    • Depending on your operating system, add the necessary environment variables:
      • For Windows:
        1. Open the Start Menu.
        2. Search for "Environment Variables".
        3. Click on "Environment Variables" under System Properties.
        4. Add a new variable for your API key (e.g., MCP_API_KEY=<your_api_key>).
  2. Test Environment Variables:

    • In your terminal, run:
      echo $MCP_API_KEY  # On Unix/Linux/Mac
      echo %MCP_API_KEY%  # On Windows
      
    • Ensure the output matches your API key.

Step 5: Windows Setup Without WSL

If you’re using Windows and prefer not to use Windows Subsystem for Linux (WSL), follow these steps:

  1. Download Required Tools:

    • Download and install any necessary tools like Node.js or Python, depending on your project requirements.
  2. Install MCP Dependencies:

    • Use your terminal or command prompt to install any dependencies required for your MCP server setup.
  3. Verify Installation:

    • Check that all components are correctly installed by running:
      MCP --version
      

Step 6: Advanced Setup with Bright Data MCP Server

To add advanced functionality with Bright Data, do the following:

  1. Obtain API Details:

    • Sign up for Bright Data and gather your account details and API keys.
  2. Add Bright Data MCP Server:

    • Use the similar command structure as shown in Step 2, adjusting for Bright Data:
      MCP add --name BrightData --type remote --url <bright_data_url> --api-key <your_bright_data_api_key>
      
  3. Test the Integration:

    • Ensure your Bright Data server is correctly integrated by making sample requests to verify connectivity.

Step 7: Live Demo Testing

Finally, test both your MCP servers to ensure they are working correctly with your Claude Code agents.

  1. Run Sample Queries:

    • Use your agents to query both the Context7 and Bright Data servers and observe the responses.
  2. Troubleshoot Issues:

    • If any errors occur, check your API keys, server URLs, and ensure your environment variables are set correctly.

Conclusion

By following this guide, you have successfully integrated MCP servers into your Claude Code agents. You can now leverage real-time data and documentation, enhancing the capabilities of your AI applications. As a next step, consider exploring additional MCP servers or integrating further APIs to expand your project's functionality.