Terminal MCP server

Enables execution of shell commands within a designated workspace directory, capturing both standard output and error streams for file operations, script running, and command-line tool interactions directly from conversations.
Back to servers
Provider
theailanguage
Release date
Mar 09, 2025
Language
Python
Stats
38 stars

MCP (Model Context Protocol) serves as a framework for AI models, enabling them to store data, execute tools, and utilize prompts for specific tasks. This repository provides several server implementation examples that allow you to connect AI models with your terminal or other environments.

Getting Started

You can set up an MCP server in multiple ways, depending on your needs and environment. Each option provides different transport methods and deployment environments.

Option 1: Local Python Setup (STDIO)

This option lets you run the MCP server locally using Python without Docker.

Installation Steps

  1. Clone the repository:

    git clone https://github.com/user/mcp-server-examples.git
    cd mcp-server-examples
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    
  3. Run the STDIO server:

    python stdio_server.py
    

Option 2: Docker Setup (STDIO)

This containerized approach runs the MCP server using Docker.

Installation Steps

  1. Clone the repository:

    git clone https://github.com/user/mcp-server-examples.git
    cd mcp-server-examples
    
  2. Build the Docker image:

    docker build -t mcp-stdio-server -f Dockerfile.stdio .
    
  3. Run the Docker container:

    docker run -it mcp-stdio-server
    

Option 3: SSE Server with Docker (Local)

This option uses Server-Sent Events (SSE) as the transport method, containerized with Docker.

Installation Steps

  1. Clone the repository:

    git clone https://github.com/user/mcp-server-examples.git
    cd mcp-server-examples
    
  2. Build the Docker image:

    docker build -t mcp-sse-server -f Dockerfile.sse .
    
  3. Run the Docker container:

    docker run -p 8000:8000 mcp-sse-server
    
  4. The server will be available at http://localhost:8000

Option 4: SSE Server on Google Cloud Platform

For deploying the MCP server to the cloud, you can use Google Cloud Platform.

Deployment Steps

  1. Set up a Google Cloud account and install the Google Cloud SDK

  2. Authenticate with Google Cloud:

    gcloud auth login
    
  3. Configure your project:

    gcloud config set project YOUR_PROJECT_ID
    
  4. Build and push the Docker image:

    docker build -t gcr.io/YOUR_PROJECT_ID/mcp-sse-server -f Dockerfile.sse .
    docker push gcr.io/YOUR_PROJECT_ID/mcp-sse-server
    
  5. Deploy to Google Cloud Run:

    gcloud run deploy mcp-server \
      --image gcr.io/YOUR_PROJECT_ID/mcp-sse-server \
      --platform managed \
      --region us-central1 \
      --allow-unauthenticated
    
  6. Google Cloud Run will provide a URL where your server is accessible

Using the MCP Server

Once your server is running, you can test it by using prompts in Claude:

Example Commands

  • To run a directory listing:

    Run the command ls in my workspace.
    
  • To execute a simple echo command:

    Execute echo Hello from Claude.
    

The output from these commands will be displayed directly in your terminal or in the Claude interface, depending on your setup.

Security Considerations

For production use, consider implementing:

  • Security checks to block potentially dangerous commands
  • Authentication mechanisms for your MCP server
  • Isolated environments for command execution

Additional Capabilities

You can extend your MCP server to:

  • Allow reading and writing files
  • Connect to cloud systems or remote environments
  • Implement custom tools beyond terminal commands

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