From 4c192aee939b73aabb9cbe3671b6224452fec480 Mon Sep 17 00:00:00 2001 From: evalstate <1936278+evalstate@users.noreply.github.com> Date: Sat, 2 Aug 2025 08:46:33 +0100 Subject: [PATCH 1/3] Remove out-of-specification notifications/stderr sending --- src/everything/everything.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/everything/everything.ts b/src/everything/everything.ts index f1a2a11d02..26e4352193 100644 --- a/src/everything/everything.ts +++ b/src/everything/everything.ts @@ -209,18 +209,6 @@ export const createServer = () => { }, 20000); - // Set up update interval for stderr messages - stdErrUpdateInterval = setInterval(() => { - const shortTimestamp = new Date().toLocaleTimeString([], { - hour: "2-digit", - minute: "2-digit", - second: "2-digit" - }); - server.notification({ - method: "notifications/stderr", - params: { content: `${shortTimestamp}: A stderr message` }, - }); - }, 30000); // Helper method to request sampling from client const requestSampling = async ( From b43ecf8710e3c31f90daf69127b4726dfb1f0f63 Mon Sep 17 00:00:00 2001 From: evalstate <1936278+evalstate@users.noreply.github.com> Date: Sat, 2 Aug 2025 10:13:32 +0100 Subject: [PATCH 2/3] 1) Update README to contain basic build/run instructions. Remove legacy test advice. 2) Make the Unit Test insensitive to the git default branch name --- src/git/README.md | 50 +++++++++++++++--------------------- src/git/tests/test_server.py | 11 +++++--- 2 files changed, 27 insertions(+), 34 deletions(-) diff --git a/src/git/README.md b/src/git/README.md index a1294d8c1d..30b7e2d898 100644 --- a/src/git/README.md +++ b/src/git/README.md @@ -285,13 +285,29 @@ help you debug any issues. ## Development -If you are doing local development, there are two ways to test your changes: +### Building -1. Run the MCP inspector to test your changes. See [Debugging](#debugging) for run instructions. +[`uv`](https://docs.astral.sh/uv/) is used for development. -2. Test using the Claude desktop app. Add the following to your `claude_desktop_config.json`: +Start by creating a fresh virtual environment: -### Docker +```bash +uv venv +source .venv/bin/activate +``` +To run the tests, type `uv run pytest`, to run the server from source use `uv run src/mcp_server_git/`. + +To build, type `uv build`. You can then now run `mcp-server-git` command directly. Open with the inspector using `npx @modelcontextprotocol/inspector@latest mcp-server-git`. + +To specify the Python version type `uv python pin ` (useful if you want to use a more recent version than the default). + +To create the Docker container use + +```bash +docker build -t mcp/git . +``` + +An example showing how to run via the Docker container is below: ```json { @@ -312,32 +328,6 @@ If you are doing local development, there are two ways to test your changes: } ``` -### UVX -```json -{ -"mcpServers": { - "git": { - "command": "uv", - "args": [ - "--directory", - "//mcp-servers/src/git", - "run", - "mcp-server-git" - ] - } - } -} -``` - -## Build - -Docker build: - -```bash -cd src/git -docker build -t mcp/git . -``` - ## License This MCP server 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. diff --git a/src/git/tests/test_server.py b/src/git/tests/test_server.py index 911a90cfbb..ceeeab9110 100644 --- a/src/git/tests/test_server.py +++ b/src/git/tests/test_server.py @@ -12,6 +12,9 @@ def test_repository(tmp_path: Path): Path(repo_path / "test.txt").write_text("test") test_repo.index.add(["test.txt"]) test_repo.index.commit("initial commit") + + # Store the default branch name on the repo object for tests to use + test_repo.default_branch = test_repo.active_branch.name yield test_repo @@ -51,11 +54,11 @@ def test_git_branch_contains(test_repository): Path(test_repository.working_dir / Path("feature.txt")).write_text("feature content") test_repository.index.add(["feature.txt"]) commit = test_repository.index.commit("feature commit") - test_repository.git.checkout("master") + test_repository.git.checkout(test_repository.default_branch) result = git_branch(test_repository, "local", contains=commit.hexsha) assert "feature-branch" in result - assert "master" not in result + assert test_repository.default_branch not in result def test_git_branch_not_contains(test_repository): # Create a new branch and commit to it @@ -63,8 +66,8 @@ def test_git_branch_not_contains(test_repository): Path(test_repository.working_dir / Path("another_feature.txt")).write_text("another feature content") test_repository.index.add(["another_feature.txt"]) commit = test_repository.index.commit("another feature commit") - test_repository.git.checkout("master") + test_repository.git.checkout(test_repository.default_branch) result = git_branch(test_repository, "local", not_contains=commit.hexsha) assert "another-feature-branch" not in result - assert "master" in result + assert test_repository.default_branch in result From 3a297d843253b8196ed6d33ec7820267729df02b Mon Sep 17 00:00:00 2001 From: evalstate <1936278+evalstate@users.noreply.github.com> Date: Sat, 2 Aug 2025 10:17:05 +0100 Subject: [PATCH 3/3] Revert "1) Update README to contain basic build/run instructions. Remove legacy test advice." (wrong branch push) This reverts commit b43ecf8710e3c31f90daf69127b4726dfb1f0f63. --- src/git/README.md | 50 +++++++++++++++++++++--------------- src/git/tests/test_server.py | 11 +++----- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/git/README.md b/src/git/README.md index 30b7e2d898..a1294d8c1d 100644 --- a/src/git/README.md +++ b/src/git/README.md @@ -285,29 +285,13 @@ help you debug any issues. ## Development -### Building +If you are doing local development, there are two ways to test your changes: -[`uv`](https://docs.astral.sh/uv/) is used for development. +1. Run the MCP inspector to test your changes. See [Debugging](#debugging) for run instructions. -Start by creating a fresh virtual environment: +2. Test using the Claude desktop app. Add the following to your `claude_desktop_config.json`: -```bash -uv venv -source .venv/bin/activate -``` -To run the tests, type `uv run pytest`, to run the server from source use `uv run src/mcp_server_git/`. - -To build, type `uv build`. You can then now run `mcp-server-git` command directly. Open with the inspector using `npx @modelcontextprotocol/inspector@latest mcp-server-git`. - -To specify the Python version type `uv python pin ` (useful if you want to use a more recent version than the default). - -To create the Docker container use - -```bash -docker build -t mcp/git . -``` - -An example showing how to run via the Docker container is below: +### Docker ```json { @@ -328,6 +312,32 @@ An example showing how to run via the Docker container is below: } ``` +### UVX +```json +{ +"mcpServers": { + "git": { + "command": "uv", + "args": [ + "--directory", + "//mcp-servers/src/git", + "run", + "mcp-server-git" + ] + } + } +} +``` + +## Build + +Docker build: + +```bash +cd src/git +docker build -t mcp/git . +``` + ## License This MCP server 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. diff --git a/src/git/tests/test_server.py b/src/git/tests/test_server.py index ceeeab9110..911a90cfbb 100644 --- a/src/git/tests/test_server.py +++ b/src/git/tests/test_server.py @@ -12,9 +12,6 @@ def test_repository(tmp_path: Path): Path(repo_path / "test.txt").write_text("test") test_repo.index.add(["test.txt"]) test_repo.index.commit("initial commit") - - # Store the default branch name on the repo object for tests to use - test_repo.default_branch = test_repo.active_branch.name yield test_repo @@ -54,11 +51,11 @@ def test_git_branch_contains(test_repository): Path(test_repository.working_dir / Path("feature.txt")).write_text("feature content") test_repository.index.add(["feature.txt"]) commit = test_repository.index.commit("feature commit") - test_repository.git.checkout(test_repository.default_branch) + test_repository.git.checkout("master") result = git_branch(test_repository, "local", contains=commit.hexsha) assert "feature-branch" in result - assert test_repository.default_branch not in result + assert "master" not in result def test_git_branch_not_contains(test_repository): # Create a new branch and commit to it @@ -66,8 +63,8 @@ def test_git_branch_not_contains(test_repository): Path(test_repository.working_dir / Path("another_feature.txt")).write_text("another feature content") test_repository.index.add(["another_feature.txt"]) commit = test_repository.index.commit("another feature commit") - test_repository.git.checkout(test_repository.default_branch) + test_repository.git.checkout("master") result = git_branch(test_repository, "local", not_contains=commit.hexsha) assert "another-feature-branch" not in result - assert test_repository.default_branch in result + assert "master" in result