Skip to content

Commit

Permalink
Merge pull request #27 from modelcontextprotocol/davidsp/new-git
Browse files Browse the repository at this point in the history
Reworking the git server
  • Loading branch information
dsp-ant authored Nov 21, 2024
2 parents 51ac8f0 + 4f7b8ec commit 32f2246
Show file tree
Hide file tree
Showing 5 changed files with 285 additions and 503 deletions.
57 changes: 43 additions & 14 deletions src/git/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# mcp-server-git: A git MCP server

## Overview

A Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.

Please note that mcp-server-git is currently in early development. The functionality and available tools are subject to change and expansion as we continue to develop and improve the server.
Expand All @@ -8,17 +10,13 @@ Please note that mcp-server-git is currently in early development. The functiona

The current list of tools includes:

- `git_read_file`: Read contents of a file at a specific Git reference
- `git_list_files`: List all files in a repository or subdirectory
- `git_file_history`: Get commit history for a specific file
- `git_commit`: Create Git commits with messages and specified files
- `git_search_code`: Search repository content with pattern matching
- `git_get_diff`: View diffs between Git references
- `git_get_repo_structure`: View repository file structure
- `git_list_repos`: List available Git repositories
- `git_log`: Retrieve commit log for the repository
- `git_list_branches`: List all branches in the repository
- `git_list_tags`: List all tags in the repository
- `git_status`: Shows the working tree status
- `git_diff_unstaged`: Shows changes in the working directory that are not yet staged
- `git_diff_staged`: Shows changes that are staged for commit
- `git_commit`: Records changes to the repository
- `git_add`: Adds file contents to the staging area
- `git_reset`: Unstages all staged changes
- `git_log`: Shows the commit logs

This list is expected to grow as we add more functionality to the server. We welcome contributions from the community to expand and enhance the available tools.

Expand All @@ -44,10 +42,14 @@ python -m mcp_server_git
```

## Configuration

### Configure for Claude.app

Add to your Claude settings:

<details>
<summary>Using uvx</summary>

```json
"mcpServers": {
"git": {
Expand All @@ -56,8 +58,10 @@ Add to your Claude settings:
}
}
```
</details>

Alternatively, if using pip installation:
<details>
<summary>Using pip installation</summary>

```json
"mcpServers": {
Expand All @@ -67,11 +71,15 @@ Alternatively, if using pip installation:
}
}
```
</details>

### Configure for Zed

Add to your Zed settings.json:

<details>
<summary>Using uvx</summary>

```json
"context_servers": [
"mcp-server-git": {
Expand All @@ -80,18 +88,35 @@ Add to your Zed settings.json:
}
],
```
</details>

Alternatively, if using pip installation:
<details>
<summary>Using pip installation</summary>

```json
"context_servers": {
"mcp-server-git": {
"command": "python",
"args": ["-m", "mcp-server-git"]
"args": ["-m", "mcp_server_git"]
}
},
```
</details>

## Debugging

You can use the MCP inspector to debug the server. For uvx installations:

```
npx @modelcontextprotocol/inspector uvx mcp-server-git
```

Or if you've installed the package in a specific directory or are developing on it:

```
cd path/to/servers/src/git
npx @modelcontextprotocol/inspector uv run mcp-server-git
```

## Contributing

Expand All @@ -101,3 +126,7 @@ For examples of other MCP servers and implementation patterns, see:
https://github.com/modelcontextprotocol/servers

Pull requests are welcome! Feel free to contribute new ideas, bug fixes, or enhancements to make mcp-server-git even more powerful and useful.

## License

mcp-server-git is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
4 changes: 2 additions & 2 deletions src/git/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mcp-server-git"
version = "0.3.0"
name="mcp-server-git"
version = "0.3.1"
description = "A Model Context Protocol server providing tools to read, search, and manipulate Git repositories programmatically via LLMs"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
Loading

0 comments on commit 32f2246

Please sign in to comment.