gib-fatura-mcp
MCP server for creating, listing, and signing Turkish e-invoices, e-producer receipts, and e-self-employment receipts on the GİB e-Arşiv portal.
README
🧾 fatura-mcp
GİB e-Arşiv portal üzerinde e-Fatura, e-Müstahsil Makbuzu ve e-SMM (Serbest Meslek Makbuzu) oluşturma, listeleme, imzalama vb. işlemler için MCP (Model Context Protocol) sunucusu.
mlevent/fatura PHP paketinin TypeScript/MCP portudur. Hesaplama mantığı (iskonto, KDV, tevkifat, özel matrah, stopaj, toplamlar) ve GİB istek formatları birebir taşınmıştır; hesaplamalar PHP paketinin kendi test senaryolarıyla doğrulanmıştır.
☢️ Bu araç vergiye tabi mali veri oluşturabilir. Belge imzalama (SMS doğrulama) işlemi faturanın resmen kesilmesi anlamına gelir; imzalanan belge değiştirilemez ve silinemez. Riskleri kullanan üstlenir.
Kurulum
Node.js 20.12+ gerekir. Sunucu stdio üzerinde çalışır:
git clone https://github.com/bevren/gib-fatura-mcp.git
cd gib-fatura-mcp
npm install
npm start
Claude Code
claude mcp add fatura -- npx tsx <bu-deponun-yolu>/src/index.ts
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"fatura": {
"command": "npx",
"args": ["tsx", "<bu-deponun-yolu>/src/index.ts"]
}
}
}
Kullanım Akışı
gib_login— gerçek kullanıcı:username+password; deneme için:testMode: true(otomatik test hesabı alınır, test portalında mali değer oluşmaz).gib_create_invoice/gib_create_producer_receipt/gib_create_self_employed_receipt— belge taslağı oluşturur, tüm tutarlar otomatik hesaplanır, oluşanuuid(ETTN) döner.gib_list_documents,gib_get_document,gib_get_document_html— kontrol/inceleme.gib_start_sms_verification→gib_complete_sms_verification— belgeleri imzalar (☢️ resmi fatura keser; test hesaplarıyla çalışmaz).gib_logout
Araçlar
| Araç | Açıklama |
|---|---|
gib_login |
Portala giriş (gerçek veya otomatik test hesabı) |
gib_set_token |
Mevcut token ile oturum |
gib_logout / gib_session_info |
Oturum kapatma / durum |
gib_create_invoice |
e-Fatura taslağı (Satış, İade, Tevkifat, İstisna, Özel Matrah); uuid+belgeNumarasi ile güncelleme |
gib_create_producer_receipt |
e-Müstahsil makbuzu taslağı |
gib_create_self_employed_receipt |
e-SMM taslağı |
gib_list_documents |
Düzenlenen belgeler (tarih aralığı + onay durumu/tür/alıcı/belge no/ETTN filtreleri, limit, sıralama) |
gib_list_documents_issued_to_me |
Adıma düzenlenen belgeler |
gib_get_document / gib_get_last_document |
Belge detayı / en son belge |
gib_get_document_html |
HTML çıktı |
gib_get_download_url / gib_save_document_to_disk |
İndirme adresi / zip olarak diske kaydetme |
gib_delete_drafts |
Taslak silme |
gib_start_sms_verification / gib_complete_sms_verification |
SMS ile belge imzalama |
gib_cancellation_request / gib_objection_request / gib_get_requests |
İptal/itiraz talepleri |
gib_get_user_data / gib_update_user_data |
GİB profil bilgileri okuma/güncelleme |
gib_get_recipient_data |
VKN/TCKN ile mükellef sorgulama |
gib_get_reference_data |
Birimler, vergiler, tevkifat kodları, özel matrah nedenleri, fatura tipleri, para birimleri |
Örnek: Satış Faturası
gib_create_invoice argümanları:
{
"vknTckn": "11111111111",
"aliciAdi": "Mert",
"aliciSoyadi": "Levent",
"mahalleSemtIlce": "Nilüfer",
"sehir": "Bursa",
"ulke": "Türkiye",
"malHizmetListe": [
{ "malHizmet": "Çimento", "miktar": 3, "birim": "M3", "birimFiyat": 1259, "kdvOrani": 18, "iskontoOrani": 25 }
]
}
Dövizli fatura için paraBirimi + dovizKuru; iade için faturaTipi: "Iade" + iadeListe; tevkifat için faturaTipi: "Tevkifat" + kalemde tevkifatKodu; istisna için faturaTipi: "Istisna" + kalemde gtip; özel matrah için faturaTipi: "OzelMatrah" + kalemde ozelMatrahNedeni/ozelMatrahTutari. Kalemlere vergiler ile ek vergi eklenebilir (ör. {"vergi": "Damga", "oran": 15}).
Testler
npm run test:model # Hesaplama testleri (PHP paketinin ModelTest senaryoları)
npm run smoke # MCP el sıkışması + araç listesi (ağ gerektirmez)
npm run test:e2e # GİB TEST portalına karşı uçtan uca (test hesabı)
Bilinen Notlar
- Taslak silme: GİB portalı (en azından test ortamında)
EARSIV_PORTAL_FATURA_SIListeğini zaman zaman"Silinirken bir sorun oluştu."yanıtıyla reddediyor. İstek formatı PHP paketi ve fatura.js ile birebir aynıdır; sorun portal tarafındadır. - İndirme adresi:
gib_get_download_urlyalnızca tokenın alındığı IP adresinden çalışır; başka makineden erişim içingib_save_document_to_diskkullanın. - Adıma düzenlenen belgeler: GİB tarafında bu servis her zaman stabil çalışmıyor.
- SMS imzalama test hesaplarıyla gerçekleştirilemez; mükellef sorgulama test ortamında boş döner.
- Token süresi dolduğunda
gib_loginile yeni token alınmalıdır.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.