Reworking the git server

This commit is contained in:
David Soria Parra
2024-11-21 21:37:19 +00:00
parent 51ac8f006f
commit 100323a425
5 changed files with 284 additions and 502 deletions

View File

@@ -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.
@@ -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.
@@ -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": {
@@ -56,8 +58,10 @@ Add to your Claude settings:
}
}
```
</details>
Alternatively, if using pip installation:
<details>
<summary>Using pip installation</summary>
```json
"mcpServers": {
@@ -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": {
@@ -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
@@ -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.