
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
git-mcp-server
Advanced tools
A Model Context Protocol server that provides Git operations to Large Language Models. This tool enables LLMs to interact with Git repositories through a robust and flexible API.
Git MCP Server implements the Model Context Protocol (MCP), enabling standardized communication between LLMs and Git repositories through:
Error severity levels:
Error categories:
Error context tracking:
npm install git-mcp-server
{
"mcpServers": {
"git": {
"command": "node",
"args": ["/path/to/git-mcp-server/build/index.js"],
"env": {
"GIT_DEFAULT_PATH": "/path/to/default/repo/directory",
"GIT_MAX_MEMORY": "1024", // Optional, in MB
"GIT_CACHE_TTL": "300", // Optional, in seconds
"GIT_LOG_LEVEL": "info" // Optional: debug, info, warn, error
}
}
}
}
GIT_DEFAULT_PATH: Default repository directoryGIT_MAX_MEMORY: Maximum memory usage (MB)GIT_CACHE_TTL: Cache time-to-live (seconds)GIT_LOG_LEVEL: Logging levelGIT_PERFORMANCE_MONITOR: Enable performance monitoringGIT_ERROR_DETAILS: Include detailed error informationCache configuration:
{
"repository": {
"ttl": 300,
"maxSize": 100
},
"command": {
"ttl": 60,
"maxSize": 500
}
}
Resource thresholds:
{
"memory": {
"warning": 1024,
"critical": 2048
},
"operations": {
"warning": 100,
"critical": 200
}
}
Initialize a new Git repository:
{
"path": "/path/to/repo" // Optional if GIT_DEFAULT_PATH is set
}
Clone a repository:
{
"url": "https://github.com/user/repo.git",
"path": "/path/to/destination" // Optional
}
Get repository status:
{
"path": "/path/to/repo" // Optional
}
Stage files:
{
"path": "/path/to/repo", // Optional
"files": ["/path/to/file1", "/path/to/file2"]
}
Create a commit:
{
"path": "/path/to/repo", // Optional
"message": "Commit message"
}
Push commits to remote:
{
"path": "/path/to/repo", // Optional
"remote": "origin", // Optional, defaults to "origin"
"branch": "main"
}
Execute multiple operations atomically. This is the preferred method for executing multiple Git operations as it:
Example usage:
{
"path": "/path/to/repo", // Optional
"actions": [
{
"type": "stage",
"files": ["file1", "file2"] // Optional - if omitted, stages all changes
},
{
"type": "commit",
"message": "Commit message"
},
{
"type": "push",
"branch": "main",
"remote": "origin" // Optional - defaults to "origin"
}
]
}
The bulk_action tool supports three types of operations:
stage: Stage files for commit
files: Optional array of files to stage. If omitted, stages all changescommit: Create a new commit
message: Required commit messagepush: Push changes to remote
branch: Required branch nameremote: Optional remote name (defaults to "origin")The server implements a robust caching system built on top of simple-git, providing two-level caching:
Repository State Cache:
Command Result Cache:
Cache invalidation:
Implementation details:
Metrics collected:
Monitoring tools:
// Get performance statistics
const stats = await performanceMonitor.getStatistics();
// Get cache statistics
const cacheStats = await repositoryCache.getStats();
// Get operation metrics
const metrics = await performanceMonitor.getMetrics(
MetricType.OPERATION_DURATION,
startTime,
endTime
);
// System errors
throw new SystemError('Disk space exhausted', {
operation: 'clone',
path: '/path/to/repo'
});
// Validation errors
throw new ValidationError('Invalid branch name', {
operation: 'branch_create',
details: { name: 'invalid/name' }
});
// Operation errors
throw new OperationError('Push failed', {
operation: 'push',
command: 'git push origin main'
});
Each error includes recovery steps:
try {
await gitOps.push(options);
} catch (error) {
if (error instanceof GitMcpError) {
console.log('Recovery steps:', error.getRecoverySteps());
}
}
Errors include detailed context:
{
"name": "OperationError",
"message": "Push failed: remote connection error",
"code": "INTERNAL_ERROR",
"severity": "HIGH",
"category": "NETWORK",
"context": {
"operation": "push",
"path": "/path/to/repo",
"command": "git push origin main",
"timestamp": 1234567890,
"recoverySteps": [
"Check network connection",
"Verify remote URL",
"Check credentials"
]
}
}
await gitOps.executeBulkActions({
actions: [
{ type: 'stage', files: ['file1', 'file2'] },
{ type: 'commit', message: 'Update files' },
{ type: 'push', branch: 'main' }
]
});
PathValidator.validatePath(path, {
mustExist: true,
allowDirectory: true
});
const { path, hasEmbeddedRepo } = PathValidator.validateGitRepo(path);
if (hasEmbeddedRepo) {
// Handle embedded .git directories
}
const result = await repositoryCache.getState(
repoPath,
RepoStateType.BRANCH,
'branch -a',
() => executeGitCommand('branch -a')
);
performanceMonitor.recordMemoryUsage();
performanceMonitor.recordResourceUsage('cpu', cpuUsage);
repositoryCache.invalidateState(repoPath, RepoStateType.STATUS);
repositoryCache.invalidateCommand(repoPath, 'status');
if (!isValidBranch(name)) {
throw new ValidationError(`Invalid branch name: ${name}`, {
operation: 'branch_create',
details: { name }
});
}
throw new NetworkError('Remote unreachable', {
operation: 'push',
recoverySteps: [
'Check network connection',
'Verify remote URL'
]
});
logger.error(
operation,
'Operation failed',
path,
error,
{ command, context }
);
git clone https://github.com/your-org/git-mcp-server.git
cd git-mcp-server
npm install
npm run build
npm test
For bugs and feature requests, please create an issue.
Apache License 2.0
FAQs
A Model Context Protocol server
The npm package git-mcp-server receives a total of 246 weekly downloads. As such, git-mcp-server popularity was classified as not popular.
We found that git-mcp-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.