wcgw MCP server

Access shell and filesystem in order to automate tasks and run code
Back to servers
Provider
Aaman Rusia
Release date
Sep 20, 2024
Language
Python
Stats
466 stars

This repository hosts a server implementation of the Model Context Protocol (MCP), a communication protocol designed for efficiently managing and interacting with AI language models. The MCP server provides an interface for requesting model-based completions and managing contexts across different applications.

Installation

To install the MCP server, follow these steps:

Requirements

  • Python 3.8 or higher
  • pip (Python package installer)

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/rusiaaman/wcgw.git
    cd wcgw
    
  2. Install the package using pip:

    pip install -e .
    

Configuration

Basic Server Configuration

Create a configuration file named config.json with your preferred settings:

{
  "port": 8080,
  "host": "127.0.0.1",
  "model_providers": [
    {
      "type": "openai",
      "api_key": "your-openai-api-key"
    }
  ]
}

Running the Server

Start the MCP server using the following command:

mcp-server --config config.json

By default, the server will listen on port 8080. You can override this in the command:

mcp-server --port 9000 --config config.json

Using the MCP Server

Making Completion Requests

You can interact with the MCP server using HTTP requests:

curl -X POST http://localhost:8080/v1/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-3.5-turbo",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello, how are you?"}
    ]
  }'

Managing Contexts

Create a new context:

curl -X POST http://localhost:8080/v1/contexts \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-context",
    "model": "gpt-3.5-turbo"
  }'

Add messages to a context:

curl -X POST http://localhost:8080/v1/contexts/my-context/messages \
  -H "Content-Type: application/json" \
  -d '{
    "role": "user",
    "content": "What is the capital of France?"
  }'

Get a completion from a context:

curl -X POST http://localhost:8080/v1/contexts/my-context/completions \
  -H "Content-Type: application/json" \
  -d '{}'

Troubleshooting

Common Issues

  • Connection refused: Ensure the server is running and you're using the correct port
  • Authentication failure: Verify your API keys in the configuration file
  • Model not found: Check that you're requesting a model supported by your provider

For more detailed error diagnostics, check the server logs which are printed to the console by default.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later