zed-shell-mcp-server

Entropy-Is-Software-Development/zed-shell-mcp-server

3.1

If you are the rightful owner of zed-shell-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Zed Shell MCP Server is a secure and efficient server designed to extend the capabilities of the Zed IDE by allowing controlled execution of shell commands and file access within a project workspace.

Tools
2
Resources
0
Prompts
0

Zed Shell MCP Server

This project provides a Model Context Protocol (MCP) server designed to be used as a shell extension for the Zed IDE. It allows Zed to securely execute a whitelist of shell commands (git, pnpm) and read files from the workspace.

Features

  • Secure Command Execution: Only allows git and pnpm commands to be executed, preventing arbitrary shell access.
  • File System Access: Provides a tool for reading the contents of multiple files within the project workspace.
  • Strictly Typed: Built with TypeScript and validated with Zod schemas.
  • Linted: Code quality is maintained with Biome.

Installation & Setup

These instructions explain how to set up the server for use with the Zed IDE.

Prerequisites

Steps

  1. Clone the Repository:

    git clone <your-repository-url>
    cd zed-shell-mcp
    
  2. Install Dependencies:

    pnpm install
    
  3. Build the Server:

    pnpm build
    

    This will compile the TypeScript source code into JavaScript in the dist/ directory.

  4. Configure Zed: Open Zed and go to your settings file (settings.json). You need to add a language_server configuration that points to the compiled server script. This tells Zed how to launch and communicate with the MCP server.

    Add the following to your settings.json:

    {
      // ... your other settings
      "language_servers": {
        // ... your other language servers
        "zed-shell-mcp": {
          "command": "node",
          "arguments": [
            "/path/to/your/zed-shell-mcp/dist/index.js"
          ]
        }
      }
    }
    

    Important: Replace /path/to/your/zed-shell-mcp with the absolute path to where you cloned this repository.

  5. Instructing an AI Agent: When using an AI agent with this server, you must provide it with instructions on how to correctly use the tools. Copy the text below and include it in your initial prompt or context when starting a session with the agent.

    ## Instructions for using the git-pnpm-shell MCP Server
    
    To ensure that commands and file operations are performed in the correct project directory, you **must** include the `cwd` parameter in every tool call to this server. 
    
    - **`execute_command`**: Use this for `git` and `pnpm` commands.
      - **Example**: `execute_command(command='git status', cwd='C:\\path\\to\\your\\project')`
    
    - **`read_many_files`**: Use this to read files from the project.
      - **Example**: `read_many_files(paths=['src/index.js'], cwd='C:\\path\\to\\your\\project')`
    
    **IMPORTANT**: The `cwd` parameter must be the absolute path to the root of the project you are working on. Without it, the server will not be able to access the correct files.
    
  6. Restart Zed: After saving the settings file, restart Zed to ensure it picks up the new language server configuration.

Usage

Once installed and configured, the server will be available to Zed's AI assistant. You can ask it to perform actions that utilize the provided tools.

Example Prompts for Zed

  • "Use the execute_command tool to run git status and show me the output."
  • "What are the contents of src/index.ts and package.json? Use the read_many_files tool."
  • "Use pnpm install to add a new dependency."

Testing

This project uses vitest for running tests. You can run the basic test suite by using the following command:

pnpm basic_test

Development

  • To run the server in development mode: pnpm start
  • To lint and format the code: pnpm biome check --write ./src
  • To run the TypeScript compiler: pnpm build