Skip to content

Commit 3a79d7d

Browse files
authored
Merge branch 'development' into feature/llm-compliance
2 parents e27225b + 4af70a3 commit 3a79d7d

11 files changed

Lines changed: 854 additions & 56 deletions

File tree

mcp-server-git-simple

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ This script provides a simplified MCP server without complex initialization
66
that might interfere with MCP handshake.
77
"""
88

9+
import asyncio
910
import sys
11+
import click
1012
from pathlib import Path
1113

12-
# Add the source directory to the path BEFORE any other imports to avoid E402
14+
# Add the source directory to the path BEFORE project imports
1315
src_dir = Path(__file__).parent / "src"
1416
sys.path.insert(0, str(src_dir))
1517

16-
# Now, import everything else
17-
import asyncio
18-
import click
19-
from mcp_server_git.server_simple import main_simple
18+
from mcp_server_git.server_simple import main_simple # noqa: E402
2019

2120

2221
@click.command()

pyrightconfig.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"include": ["src"],
3+
"exclude": ["**/__pycache__", "tests"],
4+
"reportMissingImports": "error",
5+
"reportMissingTypeStubs": "warning",
6+
"reportUndefinedVariable": "error",
7+
"reportGeneralTypeIssues": "warning",
8+
"reportAttributeAccessIssue": "warning",
9+
"reportCallIssue": "error",
10+
"reportArgumentType": "warning",
11+
"reportAssignmentType": "warning",
12+
"reportReturnType": "warning",
13+
"reportPossiblyUnboundVariable": "warning",
14+
"pythonVersion": "3.10",
15+
"typeCheckingMode": "basic",
16+
"useLibraryCodeForTypes": false,
17+
"reportUnusedImport": "warning",
18+
"reportUnusedClass": "information",
19+
"reportUnusedFunction": "information",
20+
"reportUnusedVariable": "warning"
21+
}

src/mcp_server_git/core/handlers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import Dict, List, Any, Optional
88

99
import git
10+
from git import Repo
1011
from mcp.types import TextContent
1112

1213
from .tools import GitToolRouter, ToolRegistry
@@ -271,10 +272,10 @@ def _create_git_handler(
271272
def handler(**kwargs):
272273
if requires_repo:
273274
repo_path = Path(kwargs["repo_path"])
274-
repo = git.Repo(repo_path)
275+
repo: Repo = git.Repo(repo_path)
275276

276277
# Build arguments
277-
args = [repo]
278+
args: List[Any] = [repo]
278279
if extra_args:
279280
for arg in extra_args:
280281
if arg in kwargs:
@@ -368,9 +369,9 @@ def _create_security_handler(self, func, extra_args: Optional[List[str]] = None)
368369

369370
def handler(**kwargs):
370371
repo_path = Path(kwargs["repo_path"])
371-
repo = git.Repo(repo_path)
372+
repo: Repo = git.Repo(repo_path)
372373

373-
args = [repo]
374+
args: List[Any] = [repo]
374375
if extra_args:
375376
for arg in extra_args:
376377
if arg == "strict_mode":

src/mcp_server_git/git/models.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,21 @@ class GitStatus(BaseModel):
1111

1212
class GitDiffUnstaged(BaseModel):
1313
repo_path: str
14+
stat_only: Optional[bool] = False
15+
max_lines: Optional[int] = None
1416

1517

1618
class GitDiffStaged(BaseModel):
1719
repo_path: str
20+
stat_only: Optional[bool] = False
21+
max_lines: Optional[int] = None
1822

1923

2024
class GitDiff(BaseModel):
2125
repo_path: str
2226
target: str
27+
stat_only: Optional[bool] = False
28+
max_lines: Optional[int] = None
2329

2430

2531
class GitCommit(BaseModel):
@@ -36,6 +42,9 @@ class GitAdd(BaseModel):
3642

3743
class GitReset(BaseModel):
3844
repo_path: str
45+
mode: Optional[str] = None # --soft, --mixed, --hard
46+
target: Optional[str] = None # commit hash, branch, tag
47+
files: Optional[list[str]] = None # specific files to reset
3948

4049

4150
class GitLog(BaseModel):
@@ -60,6 +69,8 @@ class GitCheckout(BaseModel):
6069
class GitShow(BaseModel):
6170
repo_path: str
6271
revision: str
72+
stat_only: Optional[bool] = False
73+
max_lines: Optional[int] = None
6374

6475

6576
class GitInit(BaseModel):
@@ -84,6 +95,8 @@ class GitDiffBranches(BaseModel):
8495
repo_path: str
8596
base_branch: str
8697
compare_branch: str
98+
stat_only: Optional[bool] = False
99+
max_lines: Optional[int] = None
87100

88101

89102
class GitRebase(BaseModel):

0 commit comments

Comments
 (0)