io.github.tonyweckstrom1987/git-history
Give AI agents Git history tools: commit search, file history, blame, contributors, ref diffs.
التثبيت
أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: .cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).
mcp-server-git-historyclaude mcp add git-history -- npx -y mcp-server-git-history@1.1.1
{
"mcpServers": {
"git-history": {
"command": "npx",
"args": [
"-y",
"mcp-server-git-history@1.1.1"
]
}
}
}
التوثيق
مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.
المحتويات
mcp-server-git-history
Uusin julkaistu versio: 1.1.2 — https://www.npmjs.com/package/mcp-server-git-history
MCP-palvelin (Model Context Protocol) joka antaa tekoälyagenteille (Claude Desktop, Cursor, Windsurf) työkalut Git-repositorion historian lukemiseen ja hakemiseen.
Ratkaisee ongelman jossa tekoäly näkee koodin nykytilan, mutta ei tiedä miksi jokin muuttui tai kuka teki muutoksen viimeksi.
Teknologiat: Node.js 18/20/22/24, Model Context Protocol (stdio), simple-git, zod. Lisenssi: LICENSE.
Sisältö: Quick start · Työkalut · Esimerkkivastaus · Asennus Claude Desktopiin · Asennus Cursoriin · Kehitys ja testaus · Rakenne
Quick start
An MCP server that gives AI agents (Claude Desktop, Cursor, Windsurf) tools to read and search Git history — commit search, file history, blame, contributors, and diffs between refs.
Run it directly with npx (no install needed):
npx -y mcp-server-git-history /path/to/your/repo
Add it to Claude Desktop's config (claude_desktop_config.json):
{
"mcpServers": {
"git-history": {
"command": "npx",
"args": ["-y", "mcp-server-git-history", "/path/to/your/repo"]
}
}
}
Restart Claude Desktop, then ask something like "When was src/index.js last changed, and why?"
Työkalut
search_commits(query, limit?)— etsii commiteja hakusanalla commit-viestistäget_recent_commits(limit?)— hakee uusimmat commitit (yleiskuva viimeaikaisista muutoksista)get_commit_diff(commitHash)— hakee yhden commitin koko diffinget_file_history(filePath, limit?)— hakee tiedoston muutoshistorian (kuka, milloin, miksi)blame_file(filePath, startLine?, endLine?)— rivikohtainengit blame: kuka ja missä commitissa kirjoitti kunkin rivinget_contributors(limit?)— yhteenveto committaajista ja heidän commit-määristään (git shortlog -sn)get_diff_between_refs(fromRef, toRef, filePath?)— diffi kahden commitin/branchin/tagin välillä, valinnaisesti yhteen tiedostoon rajattuna
Esimerkkikutsut
{ "name": "search_commits", "arguments": { "query": "login-bugi", "limit": 10 } }
{ "name": "get_recent_commits", "arguments": { "limit": 5 } }
{ "name": "get_commit_diff", "arguments": { "commitHash": "a1b2c3d" } }
{ "name": "get_file_history", "arguments": { "filePath": "src/index.js", "limit": 10 } }
{ "name": "blame_file", "arguments": { "filePath": "src/index.js", "startLine": 10, "endLine": 25 } }
{ "name": "get_contributors", "arguments": { "limit": 10 } }
{ "name": "get_diff_between_refs", "arguments": { "fromRef": "main", "toRef": "HEAD", "filePath": "src/index.js" } }
Vain luku: kaikki työkalut käyttävät ainoastaan lukevia Git-komentoja (log, show, blame, shortlog, diff). Palvelin ei koskaan muuta repositoriota.
Esimerkkivastaus
get_recent_commits palauttaa JSON-listan (todellinen tulos npm test:stä):
[
{
"hash": "bc3338e",
"date": "2026-10-05T14:29:43+03:00",
"author": "tonyweckstrom1987",
"message": "Upgrade GitHub Actions to latest versions"
}
]
Asennus Claude Desktopiin
Lisää claude_desktop_config.json-tiedostoon:
{
"mcpServers": {
"git-history": {
"command": "npx",
"args": ["-y", "mcp-server-git-history", "/polku/repositorioosi"]
}
}
}
Repositorion polku voidaan antaa myös GIT_REPO_PATH-ympäristömuuttujalla, tai jättää pois jolloin käytetään palvelimen käynnistyshakemistoa.
Käynnistä Claude Desktop uudelleen, ja kysy esimerkiksi: "Milloin tiedostoa src/index.js on viimeksi muokattu ja miksi?"
Asennus Cursoriin
Lisää projektin .cursor/mcp.json-tiedostoon (tai globaaliin ~/.cursor/mcp.json-tiedostoon):
{
"mcpServers": {
"git-history": {
"command": "npx",
"args": ["-y", "mcp-server-git-history", "/polku/repositorioosi"]
}
}
}
Avaa Cursorin asetuksista MCP-välilehti ja varmista, että git-history-palvelin on käynnissä (vihreä piste). Sama GIT_REPO_PATH-ympäristömuuttuja ja komentoriviargumentti toimivat kuin Claude Desktopissa.
Kehitys ja testaus paikallisesti
git clone <repo>
cd mcp-server-git-history
npm install
npm test # testaa tätä samaa repoa
node test/manual-test.js /polku/johonkin/git-repoon # tai jotain muuta repoa
Testiskripti käynnistää palvelimen alaprosessina ja kutsuu kaikkia työkaluja oikeaa MCP-protokollaa käyttäen (@modelcontextprotocol/sdk:n Client + StdioClientTransport), ei vain suoraan funktioita — samalla tavalla kuin Claude Desktop oikeasti kutsuisi palvelinta.
Miksi tämä on ilmainen ylläpitää
Palvelin itse ei tee tekoälykutsuja — se vain lukee Git-dataa ja palauttaa sen. Tekoäly (esim. Claude Desktop) kutsuu palvelinta, ei toisinpäin. Ei API-avaimia, ei kustannuksia.
Rakenne
bin/server.js— MCP-palvelin, työkalujen rekisteröinti (McpServer+StdioServerTransport)lib/git-tools.js— Git-logiikka (simple-git)test/manual-test.js— päästä-päähän-testi oikealla MCP-clientillä
الأسئلة الشائعة
ما هو io.github.tonyweckstrom1987/git-history؟
Give AI agents Git history tools: commit search, file history, blame, contributors, ref diffs.
كيف أثبّت io.github.tonyweckstrom1987/git-history؟
يعمل على جهازك. في Claude Code: claude mcp add git-history -- npx -y mcp-server-git-history@1.1.1. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.
هل يحتاج io.github.tonyweckstrom1987/git-history إلى مفتاح API؟
لا يذكر إدراجه في السجل أي مفتاح أو سر إلزامي. قد تتطلب بعض الميزات حسابًا لدى الخدمة التي يتصل بها.
هل io.github.tonyweckstrom1987/git-history مفتوح المصدر؟
نعم. شيفرته متاحة على GitHub بترخيص MIT.
من يصون io.github.tonyweckstrom1987/git-history؟
ينشره tonyweckstrom1987. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.
من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.