Skip to main content
Glama

GIT MCP Server

by markheramis
using-with-cursor.md3.31 kB
# Using Git MCP with Cursor AI Chat This Git MCP server can be used with Cursor's AI assistant to perform git operations directly through the chat interface. Here's how to use it: ## Prerequisites 1. Make sure the Git MCP server is running: ```bash npm start # or if installed globally mcp-git ``` 2. Ensure Cursor has access to the running MCP server. ## Installing in Cursor There are two ways to set up the Git MCP server with Cursor: ### Option 1: Global Installation 1. Install the MCP server globally: ```bash npm install -g mcp-git ``` 2. Open Cursor IDE 3. Go to Settings -> MCP -> MCP Servers 4. Click "Add new global MCP server" 5. In the configuration file that opens, add: ```json { "mcpServers": { "gitMcp": { "command": "mcp-git", "args": [] } } } ``` ### Option 2: Running from Local Code 1. Clone and build the repository: ```bash git clone [repository-url] cd mcp-git npm install npm run build ``` 2. Open Cursor IDE 3. Go to Settings -> MCP -> MCP Servers 4. Click "Add new global MCP server" 5. In the configuration file that opens, add: ```json { "mcpServers": { "gitMcp": { "command": "node", "args": ["path/to/mcp-git/dist/index.js"] } } } ``` 6. Save the file and close it 7. The Git MCP should now appear in your list of available MCP servers 8. Make sure it's enabled (toggled on) Note: This server uses stdio (standard input/output) for communication. You may need to adjust the configuration format based on your version of Cursor, as MCP configuration standards are still evolving. ## Using Git Commands with Cursor AI You can interact with git repositories by asking Cursor AI to perform git operations. Here are some example prompts: ### Cloning a Repository ``` Clone the repository https://github.com/username/repo.git to the ./my-project directory ``` ### Creating a Branch ``` Create a new branch called 'feature/new-feature' in the ./my-project repository ``` ### Checking Status ``` What's the git status in my ./my-project repository? ``` ### Committing Changes ``` Commit my changes in ./my-project with the message "Add new feature implementation" ``` ### Pushing to Remote ``` Push my changes from the ./my-project repository to origin ``` ## Tips for Effective Use - Always specify the repository path clearly in your requests - For complex operations, break them down into separate commands - If you encounter errors, ask Cursor AI to explain the error message - For sensitive operations (like pushing to remote repositories), verify the command before executing ## Example Workflow ``` User: Clone the repository https://github.com/example/project.git AI: I'll clone that repository for you. [uses git_clone tool] User: Create a new branch called 'feature/login' AI: I'll create that branch in the repository. [uses git_checkout tool with create flag] User: What files have been modified? AI: Let me check the git status. [uses git_status tool] User: Commit all my changes with the message "Implement login feature" AI: I'll commit your changes. [uses git_commit tool with add_all flag] ```

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/markheramis/mcp-git'

If you have feedback or need assistance with the MCP directory API, please join our Discord server