Entropy-Is-Software-Development/zed-shell-mcp-server
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.
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
gitandpnpmcommands 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
-
Clone the Repository:
git clone <your-repository-url> cd zed-shell-mcp -
Install Dependencies:
pnpm install -
Build the Server:
pnpm buildThis will compile the TypeScript source code into JavaScript in the
dist/directory. -
Configure Zed: Open Zed and go to your settings file (
settings.json). You need to add alanguage_serverconfiguration 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-mcpwith the absolute path to where you cloned this repository. -
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. -
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_commandtool to rungit statusand show me the output." - "What are the contents of
src/index.tsandpackage.json? Use theread_many_filestool." - "Use
pnpm installto 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