Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a1e74eb
feat(git): add date-based commit log retrieval functions
Jun 9, 2025
728d3be
feat(git): add date-based commit log retrieval functions
Jun 9, 2025
8b1bb06
Merge branch 'main' into feature/add-git-date-tools-docs
Berg-it Jun 16, 2025
8e85b1c
Merge branch 'main' into feature/add-git-date-tools-docs
Berg-it Jun 18, 2025
5a6827e
Add first draft
olaservo Jun 11, 2025
f3bc78c
Remove duplicates in the community section
olaservo Jun 11, 2025
c99f43c
Remove Firefly for now since the icon is a 404
olaservo Jun 11, 2025
d9337b1
Fix alt text
olaservo Jun 11, 2025
b797fc5
Spacing
olaservo Jun 11, 2025
7f24b52
Fix couchbase icon 403
olaservo Jun 11, 2025
3ceadd1
Fixed firefly
olaservo Jun 11, 2025
070a707
Move MCP Watch to Resources and re-alphabetize the list
olaservo Jun 9, 2025
79d58be
Update README.md
tadasant Jun 11, 2025
2924043
Update README.md
quuu May 29, 2025
993e8a9
Update README.md
ps0394 Jun 13, 2025
420da72
Update README.md - MS Docs to Official Integrations
ps0394 Jun 13, 2025
cff024e
Update README.md
idsts2670 Jun 13, 2025
11d5634
Add file read and directory listing enhancements
mjherich Mar 22, 2025
5ff72fd
Normalize line endings when splitting file chunks
mjherich Apr 3, 2025
c80b78f
add mco-cli-host to "client" section
vincent-pli May 28, 2025
0f6b008
Add SAP ABAP MCP Server SDK to "For Servers" within "Frameworks"
wommel0 Jun 9, 2025
cc0a096
Fix json format
Mar 29, 2025
7a371c1
Add ActionKit to third-party servers list
ethanlee16 Apr 18, 2025
f014420
Add OpenSearch MCP server to Official Integrations
rithin-pullela-aws Jun 9, 2025
84202d9
address comment, better description for openSearch MCP server
rithin-pullela-aws Jun 9, 2025
73c27f4
Merge branch 'feature/add-git-date-tools-docs' of https://github.com/…
Jul 7, 2025
6bad1e9
Merge branch 'main' of https://github.com/Berg-it/servers into featur…
Jul 7, 2025
7c8a847
Merge branch 'main' into feature/add-git-date-tools-docs
Berg-it Jul 7, 2025
9b0134a
Add branch handling to Git tools in server.py
Jul 7, 2025
ae881f6
Remove date range log functionality from Git tools in server.py to st…
Jul 7, 2025
a383864
Merge branch 'main' into feature/add-git-date-tools-docs
Berg-it Aug 20, 2025
6859b38
feat(git-log): add timestamp filtering to git log functionality
Aug 20, 2025
2876685
docs(git): update readme to merge date filtering into git_log
Aug 20, 2025
0d22c00
docs(model): improve timestamp field descriptions in GitLog
Aug 25, 2025
243cd11
docs(git): clarify timestamp format options in README
Aug 25, 2025
08102a1
Merge branch 'main' into feature/add-git-date-tools-docs
domdomegg Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/git/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ Please note that mcp-server-git is currently in early development. The functiona
- Returns: Confirmation of reset operation

8. `git_log`
- Shows the commit logs
- Shows the commit logs with optional date filtering
- Inputs:
- `repo_path` (string): Path to Git repository
- `max_count` (number, optional): Maximum number of commits to show (default: 10)
- `start_timestamp` (string, optional): Start timestamp for filtering commits. Accepts ISO 8601 format (e.g., '2024-01-15T14:30:25'), relative dates (e.g., '2 weeks ago', 'yesterday'), or absolute dates (e.g., '2024-01-15', 'Jan 15 2024')
- `end_timestamp` (string, optional): End timestamp for filtering commits. Accepts ISO 8601 format (e.g., '2024-01-15T14:30:25'), relative dates (e.g., '2 weeks ago', 'yesterday'), or absolute dates (e.g., '2024-01-15', 'Jan 15 2024')
- Returns: Array of commit entries with hash, author, date, and message

9. `git_create_branch`
Expand Down
69 changes: 55 additions & 14 deletions src/git/src/mcp_server_git/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ class GitReset(BaseModel):
class GitLog(BaseModel):
repo_path: str
max_count: int = 10
start_timestamp: Optional[str] = Field(
None,
description="Start timestamp for filtering commits. Accepts: ISO 8601 format (e.g., '2024-01-15T14:30:25'), relative dates (e.g., '2 weeks ago', 'yesterday'), or absolute dates (e.g., '2024-01-15', 'Jan 15 2024')"
)
end_timestamp: Optional[str] = Field(
None,
description="End timestamp for filtering commits. Accepts: ISO 8601 format (e.g., '2024-01-15T14:30:25'), relative dates (e.g., '2 weeks ago', 'yesterday'), or absolute dates (e.g., '2024-01-15', 'Jan 15 2024')"
)

class GitCreateBranch(BaseModel):
repo_path: str
Expand Down Expand Up @@ -83,6 +91,7 @@ class GitBranch(BaseModel):
description="The commit sha that branch should NOT contain. Do not pass anything to this param if no commit sha is specified",
)


class GitTools(str, Enum):
STATUS = "git_status"
DIFF_UNSTAGED = "git_diff_unstaged"
Expand Down Expand Up @@ -125,17 +134,41 @@ def git_reset(repo: git.Repo) -> str:
repo.index.reset()
return "All staged changes reset"

def git_log(repo: git.Repo, max_count: int = 10) -> list[str]:
commits = list(repo.iter_commits(max_count=max_count))
log = []
for commit in commits:
log.append(
f"Commit: {commit.hexsha!r}\n"
f"Author: {commit.author!r}\n"
f"Date: {commit.authored_datetime}\n"
f"Message: {commit.message!r}\n"
)
return log
def git_log(repo: git.Repo, max_count: int = 10, start_timestamp: Optional[str] = None, end_timestamp: Optional[str] = None) -> list[str]:
if start_timestamp or end_timestamp:
# Use git log command with date filtering
args = []
if start_timestamp:
args.extend(['--since', start_timestamp])
if end_timestamp:
args.extend(['--until', end_timestamp])
args.extend(['--format=%H%n%an%n%ad%n%s%n'])

log_output = repo.git.log(*args).split('\n')

log = []
# Process commits in groups of 4 (hash, author, date, message)
for i in range(0, len(log_output), 4):
if i + 3 < len(log_output) and len(log) < max_count:
log.append(
f"Commit: {log_output[i]}\n"
f"Author: {log_output[i+1]}\n"
f"Date: {log_output[i+2]}\n"
f"Message: {log_output[i+3]}\n"
)
return log
else:
# Use existing logic for simple log without date filtering
commits = list(repo.iter_commits(max_count=max_count))
log = []
for commit in commits:
log.append(
f"Commit: {commit.hexsha!r}\n"
f"Author: {commit.author!r}\n"
f"Date: {commit.authored_datetime}\n"
f"Message: {commit.message!r}\n"
)
return log

def git_create_branch(repo: git.Repo, branch_name: str, base_branch: str | None = None) -> str:
if base_branch:
Expand Down Expand Up @@ -203,6 +236,7 @@ def git_branch(repo: git.Repo, branch_type: str, contains: str | None = None, no

return branch_info


async def serve(repository: Path | None) -> None:
logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -283,6 +317,7 @@ async def list_tools() -> list[Tool]:
name=GitTools.BRANCH,
description="List Git branches",
inputSchema=GitBranch.model_json_schema(),

)
]

Expand Down Expand Up @@ -380,13 +415,19 @@ async def call_tool(name: str, arguments: dict) -> list[TextContent]:
text=result
)]

# Update the LOG case:
case GitTools.LOG:
log = git_log(repo, arguments.get("max_count", 10))
log = git_log(
repo,
arguments.get("max_count", 10),
arguments.get("start_timestamp"),
arguments.get("end_timestamp")
)
return [TextContent(
type="text",
text="Commit history:\n" + "\n".join(log)
)]

case GitTools.CREATE_BRANCH:
result = git_create_branch(
repo,
Expand Down Expand Up @@ -423,7 +464,7 @@ async def call_tool(name: str, arguments: dict) -> list[TextContent]:
type="text",
text=result
)]

case _:
raise ValueError(f"Unknown tool: {name}")

Expand Down