mcp-github-advanced 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_github_advanced-0.1.0/.agent/rules/github-api-rules.md +66 -0
- mcp_github_advanced-0.1.0/.agent/rules/mcp-protocol.md +61 -0
- mcp_github_advanced-0.1.0/.agent/rules/python-style.md +46 -0
- mcp_github_advanced-0.1.0/.agent/skills/github-mcp/SKILL.md +94 -0
- mcp_github_advanced-0.1.0/.agent/workflows/add-tool.md +115 -0
- mcp_github_advanced-0.1.0/.agent/workflows/publish-to-pypi.md +105 -0
- mcp_github_advanced-0.1.0/.env.example +18 -0
- mcp_github_advanced-0.1.0/.gitignore +32 -0
- mcp_github_advanced-0.1.0/AGENTS.MD +392 -0
- mcp_github_advanced-0.1.0/PKG-INFO +264 -0
- mcp_github_advanced-0.1.0/Pyproject.TOML +67 -0
- mcp_github_advanced-0.1.0/README.md +229 -0
- mcp_github_advanced-0.1.0/demo_output.txt +96 -0
- mcp_github_advanced-0.1.0/demo_result.txt +78 -0
- mcp_github_advanced-0.1.0/pyproject.toml +67 -0
- mcp_github_advanced-0.1.0/smithery.yaml +14 -0
- mcp_github_advanced-0.1.0/src/mcp_github_advanced/__init__.py +3 -0
- mcp_github_advanced-0.1.0/src/mcp_github_advanced/__main__.py +6 -0
- mcp_github_advanced-0.1.0/src/mcp_github_advanced/auth.py +215 -0
- mcp_github_advanced-0.1.0/src/mcp_github_advanced/cache.py +176 -0
- mcp_github_advanced-0.1.0/src/mcp_github_advanced/github.py +606 -0
- mcp_github_advanced-0.1.0/src/mcp_github_advanced/server.py +487 -0
- mcp_github_advanced-0.1.0/test_errors.txt +0 -0
- mcp_github_advanced-0.1.0/test_output.txt +0 -0
- mcp_github_advanced-0.1.0/test_output_utf8.txt +5 -0
- mcp_github_advanced-0.1.0/test_real.py +97 -0
- mcp_github_advanced-0.1.0/test_results.json +13 -0
- mcp_github_advanced-0.1.0/tests/conftest.py +172 -0
- mcp_github_advanced-0.1.0/tests/test_auth.py +228 -0
- mcp_github_advanced-0.1.0/tests/test_github.py +286 -0
- mcp_github_advanced-0.1.0/tests/test_server.py +274 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: mcp-github-advanced için GitHub API kuralları ve konvansiyonları
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# GitHub API Kuralları
|
|
6
|
+
|
|
7
|
+
## Versiyonlu Header'lar (ZORUNLU)
|
|
8
|
+
|
|
9
|
+
Her GitHub API isteğinde şu header'lar **mutlaka** bulunmalıdır:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
headers = {
|
|
13
|
+
"Authorization": f"Bearer {token}",
|
|
14
|
+
"Accept": "application/vnd.github+json",
|
|
15
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Bu header'lar olmadan **asla** GitHub API isteği gönderilmez.
|
|
20
|
+
|
|
21
|
+
## Rate Limit (İstek Sınırı)
|
|
22
|
+
|
|
23
|
+
- Kimlik doğrulamalı: 5000 istek/saat (REST), 5000 puan/saat (GraphQL)
|
|
24
|
+
- Her yanıttan sonra `X-RateLimit-Remaining` kontrol edilir
|
|
25
|
+
- Kalan < 10 olduğunda: `X-RateLimit-Reset` zamanına kadar beklenir
|
|
26
|
+
- 429/403 yanıtları için `tenacity` ile üstel geri çekilme (exponential backoff) uygulanır
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
remaining = int(resp.headers.get("X-RateLimit-Remaining", 1))
|
|
30
|
+
if remaining < 10:
|
|
31
|
+
reset_time = int(resp.headers.get("X-RateLimit-Reset", 0))
|
|
32
|
+
wait = reset_time - time.time()
|
|
33
|
+
await asyncio.sleep(max(wait, 0))
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Çıktı Sınırları
|
|
37
|
+
|
|
38
|
+
- MCP araç çıktıları **8192 token'ı (~30.000 karakter) aşmamalıdır**
|
|
39
|
+
- Büyük diff'ler (>1MB) chunk'lara bölünmelidir
|
|
40
|
+
- Kısaltma için `_chunk_text()` yardımcı fonksiyonu kullanılır
|
|
41
|
+
|
|
42
|
+
## REST API Kalıpları
|
|
43
|
+
|
|
44
|
+
- Temel URL: `https://api.github.com`
|
|
45
|
+
- Zaman aşımı: 30 saniye
|
|
46
|
+
- Sayfalama: `per_page` parametresi kullanılır (maks. 100)
|
|
47
|
+
- Hata yanıtları: `httpx.HTTPStatusError` fırlatılır
|
|
48
|
+
|
|
49
|
+
## GraphQL API
|
|
50
|
+
|
|
51
|
+
- Uç nokta: `https://api.github.com/graphql`
|
|
52
|
+
- Şu durumlarda kullanılır: katkıda bulunan istatistikleri, karmaşık sorgular
|
|
53
|
+
- Yanıtta `data.errors` kontrol edilir
|
|
54
|
+
|
|
55
|
+
## Token İzinleri (Scopes)
|
|
56
|
+
|
|
57
|
+
- `repo`: Özel (private) repolar için gerekli
|
|
58
|
+
- `read:user`: Kullanıcı profili için gerekli
|
|
59
|
+
- PAT: Yalnızca kendi repoları için çalışır
|
|
60
|
+
- OAuth: Başka kullanıcıların repolarına da erişebilir (izin ile)
|
|
61
|
+
|
|
62
|
+
## Önbellekleme (Caching)
|
|
63
|
+
|
|
64
|
+
- Önbellek anahtar formatı: `github:{owner}:{repo}:{tool_name}`
|
|
65
|
+
- Yazma işlemleri **asla** önbelleğe alınmaz (create_issue, create_pr_review)
|
|
66
|
+
- TTL değerleri `cache.py` içinde tanımlıdır
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: mcp-github-advanced için MCP protokol kuralları ve konvansiyonları
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# MCP Protokol Kuralları
|
|
6
|
+
|
|
7
|
+
## Sunucu Uygulaması
|
|
8
|
+
|
|
9
|
+
- Low-level `mcp.server.Server` kullanılır — `FastMCP` **KULLANILMAZ**
|
|
10
|
+
- Transport: `stdio` — `mcp.server.stdio.stdio_server` ile
|
|
11
|
+
- Araçlar `@app.list_tools()` ve `@app.call_tool()` dekoratörleri ile kaydedilir
|
|
12
|
+
|
|
13
|
+
## Araç Kaydı
|
|
14
|
+
|
|
15
|
+
- Tüm araçlar `server.py` içindeki `TOOLS` listesinde tanımlanır
|
|
16
|
+
- Her araçta şunlar gereklidir: `name`, `description`, `inputSchema`
|
|
17
|
+
- Giriş şeması JSON Schema formatını takip eder
|
|
18
|
+
- Zorunlu parametreler `"required"` dizisinde listelenir
|
|
19
|
+
|
|
20
|
+
## Araç Yanıt Formatı
|
|
21
|
+
|
|
22
|
+
- Her zaman `list[TextContent]` döndürülür
|
|
23
|
+
- Veri JSON olarak serileştirilir: `json.dumps(result, indent=2, ensure_ascii=False)`
|
|
24
|
+
- Hata durumunda: hata mesajı ile `TextContent` döndürülür (istisna fırlatılmaz)
|
|
25
|
+
- Çıktı 8192 token'ın altında tutulmak için kesilir
|
|
26
|
+
|
|
27
|
+
## Giriş Noktası
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
# pyproject.toml
|
|
31
|
+
[project.scripts]
|
|
32
|
+
mcp-github-advanced = "mcp_github_advanced.server:main"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
# server.py
|
|
37
|
+
def main() -> None:
|
|
38
|
+
asyncio.run(_run())
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Yaşam Döngüsü
|
|
42
|
+
|
|
43
|
+
1. `AuthManager`, `RedisCache`, `GitHubClient` başlatılır
|
|
44
|
+
2. `github_client.start()` ile HTTP bağlantıları açılır
|
|
45
|
+
3. `stdio_server()` bağlamı → `app.run()` çalıştırılır
|
|
46
|
+
4. Kapanışta: `github_client.close()` çağrılır
|
|
47
|
+
|
|
48
|
+
## Yeni Araç Ekleme
|
|
49
|
+
|
|
50
|
+
1. `github.py` içindeki `GitHubClient`'a yeni metod ekle
|
|
51
|
+
2. `server.py`'daki `TOOLS` listesine `Tool(...)` tanımı ekle
|
|
52
|
+
3. `_dispatch()` fonksiyonuna yeni `case` dalı ekle
|
|
53
|
+
4. Önbelleğe alınabilirse `cache.py`'ye TTL girişi ekle
|
|
54
|
+
5. `test_github.py` ve `test_server.py`'ye testler ekle
|
|
55
|
+
|
|
56
|
+
## LLM Entegrasyonu
|
|
57
|
+
|
|
58
|
+
- Model: `gemini-2.0-flash` — `langchain-google-genai` paketi ile
|
|
59
|
+
- `temperature=0` — tutarlı kod analizi için
|
|
60
|
+
- `max_tokens=8192` çıktı limiti
|
|
61
|
+
- Araç çıktıları bu limitin içinde kalmalıdır
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: mcp-github-advanced için Python stil ve formatlama kuralları
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Python Stil Kuralları
|
|
6
|
+
|
|
7
|
+
## Genel
|
|
8
|
+
- Python 3.10+ ile `from __future__ import annotations` kullanılır
|
|
9
|
+
- Satır uzunluğu: en fazla 100 karakter (`pyproject.toml`'de yapılandırılır)
|
|
10
|
+
- Lint için `ruff` kullanılır: `ruff check src/ tests/`
|
|
11
|
+
|
|
12
|
+
## Formatlama
|
|
13
|
+
- Girintileme: 4 boşluk (tab yok)
|
|
14
|
+
- String'ler için çift tırnak kullanılır
|
|
15
|
+
- Çok satırlı yapılarda sondaki virgül yazılır
|
|
16
|
+
- `.format()` veya `%` yerine f-string tercih edilir
|
|
17
|
+
|
|
18
|
+
## Tür İpuçları (Type Hints)
|
|
19
|
+
- Tüm fonksiyon imzalarında tür ipucu kullanılır
|
|
20
|
+
- Nullable türler için `Optional[T]` veya `T | None` kullanılır
|
|
21
|
+
- Büyük harfli jenerikler yerine küçük harfli kullanılır: `dict[str, Any]` (`Dict[str, Any]` değil)
|
|
22
|
+
|
|
23
|
+
## İçe Aktarmalar (Imports)
|
|
24
|
+
- Gruplandırma sırası: stdlib → üçüncü parti → yerel
|
|
25
|
+
- `ruff` ile otomatik sıralama yapılır (`select = ["I"]` pyproject.toml'de)
|
|
26
|
+
- Mutlak import tercih edilir
|
|
27
|
+
|
|
28
|
+
## İsimlendirme
|
|
29
|
+
- `snake_case` → fonksiyonlar, değişkenler, modüller
|
|
30
|
+
- `PascalCase` → sınıflar
|
|
31
|
+
- `UPPER_SNAKE_CASE` → sabitler
|
|
32
|
+
- Özel (private) metod ve nitelikler `_` ile başlar
|
|
33
|
+
|
|
34
|
+
## Asenkron (Async)
|
|
35
|
+
- Tüm GitHub API etkileşimleri async olmalıdır (`async def`)
|
|
36
|
+
- `requests` yerine `httpx.AsyncClient` kullanılır
|
|
37
|
+
- `asyncio.run()` yalnızca giriş noktalarında kullanılır
|
|
38
|
+
|
|
39
|
+
## Docstring'ler
|
|
40
|
+
- Tüm public fonksiyon ve sınıflar için Google-stil docstring yazılır
|
|
41
|
+
- Gerektiğinde `Args:`, `Returns:`, `Raises:` bölümleri eklenir
|
|
42
|
+
|
|
43
|
+
## Hata Yönetimi
|
|
44
|
+
- İstisnalar sessizce yutulmaz
|
|
45
|
+
- Kritik olmayan hatalar için uyarı loglanır (örn: önbellek ıskalamaları)
|
|
46
|
+
- Genel `Exception` yerine spesifik istisnalar fırlatılır
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: github-mcp
|
|
3
|
+
description: mcp-github-advanced MCP sunucu kod tabanı ile çalışma becerisi
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GitHub MCP Becerisi
|
|
7
|
+
|
|
8
|
+
Bu beceri, `mcp-github-advanced` MCP sunucu kod tabanı ile çalışmak için talimatlar sağlar.
|
|
9
|
+
|
|
10
|
+
## Genel Bakış
|
|
11
|
+
|
|
12
|
+
`mcp-github-advanced`, Model Context Protocol üzerinden 14 GitHub API aracını sunan bir MCP sunucusudur. Desteklediği özellikler:
|
|
13
|
+
|
|
14
|
+
- **GitHub REST API v3** — repolar, commit'ler, PR'lar, issue'lar, actions
|
|
15
|
+
- **GitHub GraphQL v4** — katkıda bulunan istatistikleri, karmaşık sorgular
|
|
16
|
+
- **Redis önbellekleme** — akıllı TTL stratejisi ile
|
|
17
|
+
- **PAT + OAuth 2.0** — çift kimlik doğrulama desteği
|
|
18
|
+
- **LLM entegrasyonu** — `gemini-2.0-flash` ve `langchain-google-genai` ile
|
|
19
|
+
|
|
20
|
+
## Mimari
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
server.py → 14 MCP aracı (list_tools + call_tool)
|
|
24
|
+
├── github.py → REST + GraphQL istemcisi (httpx async)
|
|
25
|
+
├── auth.py → PAT + OAuth 2.0 kimlik doğrulama
|
|
26
|
+
└── cache.py → TTL stratejili Redis önbellekleme
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Temel Konvansiyonlar
|
|
30
|
+
|
|
31
|
+
### 1. Versiyonlu API Header'ları
|
|
32
|
+
|
|
33
|
+
**Her** GitHub API isteğinde şunlar bulunmalıdır:
|
|
34
|
+
```python
|
|
35
|
+
{
|
|
36
|
+
"Authorization": f"Bearer {token}",
|
|
37
|
+
"Accept": "application/vnd.github+json",
|
|
38
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Rate Limit (İstek Sınırı)
|
|
43
|
+
|
|
44
|
+
- Her yanıttan sonra `X-RateLimit-Remaining` kontrol edilir
|
|
45
|
+
- Kalan < 10 olduğunda bekle
|
|
46
|
+
- 429/403 için `tenacity` retry kullan
|
|
47
|
+
|
|
48
|
+
### 3. Çıktı Kesme (Chunking)
|
|
49
|
+
|
|
50
|
+
- Maksimum çıktı ≈ 30.000 karakter (~8192 token)
|
|
51
|
+
- Kısaltma için `_chunk_text()` kullanılır
|
|
52
|
+
- Tek dosya yama (patch) çıktısı 5000 karakterle sınırlıdır
|
|
53
|
+
|
|
54
|
+
### 4. Önbellek TTL Stratejisi
|
|
55
|
+
|
|
56
|
+
| Araç | TTL |
|
|
57
|
+
|------|-----|
|
|
58
|
+
| `get_repo_info` | 1 saat |
|
|
59
|
+
| `list_commits` | 5 dk |
|
|
60
|
+
| `get_pr_diff` | 10 dk |
|
|
61
|
+
| `get_workflow_logs` | 1 dk |
|
|
62
|
+
| `get_file_content` | 30 dk |
|
|
63
|
+
| Yazma işlemleri | Önbellek yok |
|
|
64
|
+
|
|
65
|
+
### 5. Test Etme
|
|
66
|
+
|
|
67
|
+
- HTTP mocklama için **her zaman** `respx` kullanılır
|
|
68
|
+
- Testlerde **asla** gerçek GitHub API'ye istek gönderilmez
|
|
69
|
+
- Test senaryoları: başarılı, 404, 401, rate limit
|
|
70
|
+
|
|
71
|
+
### 6. LLM
|
|
72
|
+
|
|
73
|
+
- Model: `gemini-2.0-flash`
|
|
74
|
+
- `temperature=0` — tutarlı kod analizi için
|
|
75
|
+
- `max_tokens=8192`
|
|
76
|
+
- Paket: `langchain-google-genai`
|
|
77
|
+
|
|
78
|
+
## Sık Yapılan İşlemler
|
|
79
|
+
|
|
80
|
+
- **Araç ekle**: Bkz. `.agent/workflows/add-tool.md`
|
|
81
|
+
- **Yayınla**: Bkz. `.agent/workflows/publish-to-pypi.md`
|
|
82
|
+
- **Test çalıştır**: `pytest` (`asyncio_mode = "auto"` ile)
|
|
83
|
+
- **Lint**: `ruff check src/ tests/`
|
|
84
|
+
|
|
85
|
+
## Dosya Haritası
|
|
86
|
+
|
|
87
|
+
| Dosya | Amacı |
|
|
88
|
+
|-------|-------|
|
|
89
|
+
| `server.py` | MCP sunucusu, 14 araç tanımı, yönlendirici |
|
|
90
|
+
| `github.py` | GitHub API istemcisi (REST + GraphQL) |
|
|
91
|
+
| `auth.py` | PAT + OAuth 2.0 kimlik doğrulama |
|
|
92
|
+
| `cache.py` | TTL'li Redis önbellekleme |
|
|
93
|
+
| `__init__.py` | Versiyon bilgisi |
|
|
94
|
+
| `__main__.py` | `python -m` giriş noktası |
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Sunucuya yeni bir MCP aracı nasıl eklenir
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Yeni MCP Aracı Ekleme
|
|
6
|
+
|
|
7
|
+
`mcp-github-advanced` sunucusuna yeni bir araç eklemek için şu adımları izleyin.
|
|
8
|
+
|
|
9
|
+
## 1. GitHub İstemci Metodunu Uygula
|
|
10
|
+
|
|
11
|
+
`src/mcp_github_advanced/github.py` dosyasında `GitHubClient`'a yeni bir async metod ekleyin:
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
async def yeni_arac_adi(self, owner: str, repo: str, ...) -> dict:
|
|
15
|
+
"""Bu aracın ne yaptığını açıklayan docstring."""
|
|
16
|
+
# Önbellekten kontrol et
|
|
17
|
+
if self.cache:
|
|
18
|
+
cached = await self.cache.get(owner, repo, "yeni_arac_adi")
|
|
19
|
+
if cached:
|
|
20
|
+
return cached
|
|
21
|
+
|
|
22
|
+
# Versiyonlu header'lar ile API isteği gönder (self.headers ile otomatik)
|
|
23
|
+
resp = await self._get(f"{GITHUB_API}/repos/{owner}/{repo}/endpoint")
|
|
24
|
+
data = resp.json()
|
|
25
|
+
|
|
26
|
+
# Yanıtı dönüştür
|
|
27
|
+
result = { ... }
|
|
28
|
+
|
|
29
|
+
# Büyük çıktıları kes
|
|
30
|
+
if "content" in result:
|
|
31
|
+
result["content"] = _chunk_text(result["content"])
|
|
32
|
+
|
|
33
|
+
# Sonucu önbelleğe al
|
|
34
|
+
if self.cache:
|
|
35
|
+
await self.cache.set(owner, repo, "yeni_arac_adi", result)
|
|
36
|
+
return result
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 2. Önbellek TTL'si Ekle
|
|
40
|
+
|
|
41
|
+
`src/mcp_github_advanced/cache.py` dosyasına TTL girişi ekleyin:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
TTL = {
|
|
45
|
+
...
|
|
46
|
+
"yeni_arac_adi": 300, # 5 dakika (veya uygun TTL değeri)
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 3. Aracı Kaydet
|
|
51
|
+
|
|
52
|
+
`src/mcp_github_advanced/server.py` dosyasındaki `TOOLS` listesine ekleyin:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
Tool(
|
|
56
|
+
name="yeni_arac_adi",
|
|
57
|
+
description="Aracın ne yaptığının açıklaması",
|
|
58
|
+
inputSchema={
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"owner": {"type": "string", "description": "Repo sahibi"},
|
|
62
|
+
"repo": {"type": "string", "description": "Repo adı"},
|
|
63
|
+
# ... ek parametreler
|
|
64
|
+
},
|
|
65
|
+
"required": ["owner", "repo"],
|
|
66
|
+
},
|
|
67
|
+
),
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 4. Yönlendirme Dalı Ekle
|
|
71
|
+
|
|
72
|
+
`server.py`'deki `_dispatch()` fonksiyonuna:
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
case "yeni_arac_adi":
|
|
76
|
+
return await gh.yeni_arac_adi(owner, repo, ...)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 5. Testleri Yaz
|
|
80
|
+
|
|
81
|
+
`tests/test_github.py` dosyasına:
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
class TestYeniAracAdi:
|
|
85
|
+
@respx.mock
|
|
86
|
+
async def test_basarili(self, github_client):
|
|
87
|
+
respx.get("https://api.github.com/repos/owner/repo/endpoint").mock(
|
|
88
|
+
return_value=httpx.Response(200, json={...})
|
|
89
|
+
)
|
|
90
|
+
result = await github_client.yeni_arac_adi("owner", "repo")
|
|
91
|
+
assert result[...] == beklenen_deger
|
|
92
|
+
|
|
93
|
+
@respx.mock
|
|
94
|
+
async def test_404_bulunamadi(self, github_client):
|
|
95
|
+
# 404 senaryosunu test et
|
|
96
|
+
...
|
|
97
|
+
|
|
98
|
+
@respx.mock
|
|
99
|
+
async def test_401_yetkisiz(self, github_client):
|
|
100
|
+
# Yetkisiz erişim senaryosunu test et
|
|
101
|
+
...
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## 6. Dokümantasyonu Güncelle
|
|
105
|
+
|
|
106
|
+
- `AGENTS.md` içindeki araç tablosuna ekle
|
|
107
|
+
- `README.md` özellikler tablosuna ekle
|
|
108
|
+
- Gerekirse `__init__.py`'deki versiyonu artır
|
|
109
|
+
|
|
110
|
+
## 7. Commit At
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
git add .
|
|
114
|
+
git commit -m "feat: yeni_arac_adi araci eklendi"
|
|
115
|
+
```
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: mcp-github-advanced paketini PyPI'ye nasıl yayınlanır
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# PyPI'ye Yayınlama
|
|
6
|
+
|
|
7
|
+
## Ön Koşullar
|
|
8
|
+
|
|
9
|
+
- API token'ı olan bir PyPI hesabı
|
|
10
|
+
- `build` ve `twine` paketlerinin kurulu olması
|
|
11
|
+
|
|
12
|
+
## Adımlar
|
|
13
|
+
|
|
14
|
+
### 1. Versiyonu Güncelle
|
|
15
|
+
|
|
16
|
+
`src/mcp_github_advanced/__init__.py` dosyasını düzenleyin:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
__version__ = "0.1.1" # versiyonu artır
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 2. Önceki Derleme Dosyalarını Temizle
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
rm -rf dist/ build/ *.egg-info
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 3. Paketi Derle
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install build
|
|
32
|
+
python -m build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Bu şunları oluşturur:
|
|
36
|
+
- `dist/mcp_github_advanced-0.1.1.tar.gz`
|
|
37
|
+
- `dist/mcp_github_advanced-0.1.1-py3-none-any.whl`
|
|
38
|
+
|
|
39
|
+
### 4. Paketi Kontrol Et
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install twine
|
|
43
|
+
twine check dist/*
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 5. Test PyPI'ye Yükle (Opsiyonel)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
twine upload --repository testpypi dist/*
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Doğrulama: `pip install -i https://test.pypi.org/simple/ mcp-github-advanced`
|
|
53
|
+
|
|
54
|
+
### 6. PyPI'ye Yükle
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
twine upload dist/*
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Şunlar sorulacaktır:
|
|
61
|
+
- Kullanıcı adı: `__token__`
|
|
62
|
+
- Şifre: PyPI API token'ınız (`pypi-...`)
|
|
63
|
+
|
|
64
|
+
### 7. Kurulumu Doğrula
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install mcp-github-advanced
|
|
68
|
+
uvx mcp-github-advanced --help
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 8. Git Etiketi Oluştur
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
git tag -a v0.1.1 -m "Sürüm v0.1.1"
|
|
75
|
+
git push origin v0.1.1
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 9. GitHub Sürümü Oluştur
|
|
79
|
+
|
|
80
|
+
Etiketten bir GitHub sürümü oluşturun ve değişiklik günlüğünü ekleyin.
|
|
81
|
+
|
|
82
|
+
## CI/CD Otomasyonu (Opsiyonel)
|
|
83
|
+
|
|
84
|
+
Etiket push'unda otomatik yayınlama için `.github/workflows/publish.yml` ekleyin:
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
on:
|
|
88
|
+
push:
|
|
89
|
+
tags: ["v*"]
|
|
90
|
+
|
|
91
|
+
jobs:
|
|
92
|
+
publish:
|
|
93
|
+
runs-on: ubuntu-latest
|
|
94
|
+
steps:
|
|
95
|
+
- uses: actions/checkout@v4
|
|
96
|
+
- uses: actions/setup-python@v5
|
|
97
|
+
with:
|
|
98
|
+
python-version: "3.12"
|
|
99
|
+
- run: pip install build twine
|
|
100
|
+
- run: python -m build
|
|
101
|
+
- run: twine upload dist/*
|
|
102
|
+
env:
|
|
103
|
+
TWINE_USERNAME: __token__
|
|
104
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
105
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# ─────────────────────────────────────────────
|
|
2
|
+
# mcp-github-advanced — Ortam Değişkenleri
|
|
3
|
+
# ─────────────────────────────────────────────
|
|
4
|
+
|
|
5
|
+
# GitHub Kimlik Doğrulama
|
|
6
|
+
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx # PAT (Kişisel Erişim Token'ı)
|
|
7
|
+
GITHUB_CLIENT_ID=Ov23xxxxxxxxxxxxx # OAuth Uygulama İstemci ID'si
|
|
8
|
+
GITHUB_CLIENT_SECRET=xxxxxxxxxxxxxxxx # OAuth Uygulama İstemci Gizli Anahtarı
|
|
9
|
+
|
|
10
|
+
# Redis Önbellek
|
|
11
|
+
REDIS_URL=redis://localhost:6379/0
|
|
12
|
+
|
|
13
|
+
# Sunucu Ayarları
|
|
14
|
+
MCP_SERVER_NAME=mcp-github-advanced
|
|
15
|
+
LOG_LEVEL=INFO
|
|
16
|
+
|
|
17
|
+
# Google Gemini (LLM)
|
|
18
|
+
GOOGLE_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXX
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
*.egg
|
|
9
|
+
|
|
10
|
+
# Ortam
|
|
11
|
+
.env
|
|
12
|
+
.venv/
|
|
13
|
+
venv/
|
|
14
|
+
env/
|
|
15
|
+
|
|
16
|
+
# IDE
|
|
17
|
+
.vscode/
|
|
18
|
+
.idea/
|
|
19
|
+
*.swp
|
|
20
|
+
*.swo
|
|
21
|
+
|
|
22
|
+
# OS
|
|
23
|
+
.DS_Store
|
|
24
|
+
Thumbs.db
|
|
25
|
+
|
|
26
|
+
# Test
|
|
27
|
+
.pytest_cache/
|
|
28
|
+
.coverage
|
|
29
|
+
htmlcov/
|
|
30
|
+
|
|
31
|
+
# Gemini
|
|
32
|
+
.gemini/
|