e-Fatura MCP Server
Integrates with the Turkish Revenue Administration (GİB) e-Arşiv Fatura system to manage e-invoices via natural language. Users can list, search, create, and cancel invoices, as well as validate Turkish tax numbers and retrieve UBL-TR format XML data.
README
e-Fatura MCP Server
Türkiye Gelir İdaresi Başkanlığı (GİB) e-Arşiv Fatura sistemi ile entegrasyon sağlayan MCP sunucusu.
📝 Read the full story on Medium (Turkish)
English
Features
- 📋 List and search e-Invoices
- 🔍 Get invoice details and XML
- ✏️ Create and cancel invoices
- ✅ Validate Turkish tax numbers (VKN/TCKN)
- 🎭 Demo mode - Test without real credentials
- 🔒 Production ready - Auto-switching between demo and real API
Quick Start
1. Install
git clone https://github.com/reyhansunduk/efatura-mcp-server.git
cd efatura-mcp-server
pip install -e .
2. Demo Mode (No credentials needed)
The server works immediately with mock data:
python -m efatura_mcp.server
For test: ⚠️ DEMO MODE: Using mock data
3. Use with Claude Desktop
Create config file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"efatura": {
"command": "python",
"args": ["-m", "efatura_mcp.server"],
"cwd": "C:\\path\\to\\efatura-mcp-server"
}
}
}
4. Test in Claude Desktop
Ask Claude:
List invoices
You should see 5 demo invoices!
Switch to Real GİB API
When ready to use real data:
- Edit
.envfile:
GIB_USERNAME=your_vkn_here
GIB_PASSWORD=your_password_here
GIB_ENVIRONMENT=test
- Restart the server
The server automatically switches to real API when credentials are provided.
Available MCP Tools
The server provides 7 MCP tools that Claude can use:
1. list_invoices
List e-Fatura invoices from GIB system.
Parameters:
start_date(optional): Start date (YYYY-MM-DD)end_date(optional): End date (YYYY-MM-DD)limit(optional): Max invoices to return (default: 10)
Example: "Show me invoices from last month"
2. get_invoice_detail
Get detailed information for a specific invoice.
Parameters:
invoice_id(required): Invoice ID/UUID
Example: "Show details for invoice ABC2024000001"
3. get_invoice_xml
Get invoice HTML/XML content in UBL-TR format.
Parameters:
invoice_id(required): Invoice ID/UUID
Example: "Get XML for invoice ABC2024000001"
4. create_invoice
Create new e-Fatura invoice in GIB system.
Parameters:
invoice_number,issue_date,supplier_vkn,supplier_namecustomer_vkn,customer_name,items[],total_amountcurrency(optional, default: TRY)
Example: "Create invoice for 1000 TRY to customer XYZ"
5. cancel_invoice
Cancel an existing invoice.
Parameters:
invoice_id(required): Invoice ID to cancelreason(required): Cancellation reason
Example: "Cancel invoice ABC2024000001 due to error"
6. search_invoices
Search invoices with filters.
Parameters:
customer_name,supplier_name(optional)min_amount,max_amount(optional)status(optional): approved, pending, cancelled
Example: "Find invoices over 10000 TRY", "Show pending invoices"
7. validate_tax_number
Validate Turkish tax number (VKN/TCKN).
Parameters:
tax_number(required): 10 or 11 digit tax number
Example: "Validate tax number 1234567890"
Getting GİB Credentials
Get Credentials: Use your company's existing e-Fatura credentials
- Portal: https://earsivportal.efatura.gov.tr (production)
- Test Portal: https://earsivportaltest.efatura.gov.tr (test)
Project Structure
efatura-mcp-server/
├── src/
│ └── efatura_mcp/
│ ├── server.py # Main MCP server
│ ├── gib_earsiv_client.py # Real GİB API client
│ └── mock_data.py # Demo data
├── .env # Credentials (gitignored)
├── .env.example # Template
└── README.md
See SECURITY.md for complete guidelines.
Requirements
- Python 3.10+
- Claude Desktop (or any MCP client)
Dependencies are auto-installed with pip install -e .
License
MIT
Türkçe
Özellikler
- 📋 e-Faturaları listele ve ara
- 🔍 Fatura detayları ve XML al
- ✏️ Fatura oluştur ve iptal et
- ✅ Vergi numarası doğrula (VKN/TCKN)
- 🎭 Demo modu - Gerçek credentials olmadan test et
- 🔒 Production hazır - Demo ve gerçek API arası otomatik geçiş
Hızlı Başlangıç
1. Kurulum
git clone https://github.com/reyhansunduk/efatura-mcp-server.git
cd efatura-mcp-server
pip install -e .
2. Demo Modu (Credential gerekmez)
Sunucu hemen mock data ile çalışır:
python -m efatura_mcp.server
Test için: ⚠️ DEMO MODE: Using mock data
3. Claude Desktop ile Kullan
Config dosyası oluştur:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"efatura": {
"command": "python",
"args": ["-m", "efatura_mcp.server"],
"cwd": "C:\\Users\\..\\efatura-mcp-server"
}
}
}
4. Claude Desktop'ta Test Et
Claude'a sor:
Faturaları listele
Faturalar listelenecektir.
Gerçek GİB API'ye Geç
Gerçek veri kullanmaya hazır olduğunda:
.envdosyasını düzenle:
GIB_USERNAME=vkn_buraya
GIB_PASSWORD=sifre_buraya
GIB_ENVIRONMENT=test
- Sunucuyu yeniden başlat
Sunucu credentials verildiğinde otomatik olarak gerçek API'ye geçer.
Mevcut MCP Araçları
Sunucu Claude'un kullanabileceği 7 MCP aracı sağlar:
1. list_invoices
GİB sisteminden e-Faturaları listeler.
Parametreler:
start_date(opsiyonel): Başlangıç tarihi (YYYY-MM-DD)end_date(opsiyonel): Bitiş tarihi (YYYY-MM-DD)limit(opsiyonel): Max fatura sayısı (varsayılan: 10)
Örnek: "Geçen ayki faturaları göster"
2. get_invoice_detail
Belirli bir faturanın detaylı bilgilerini getirir.
Parametreler:
invoice_id(zorunlu): Fatura ID/UUID
Örnek: "ABC2024000001 faturasının detaylarını göster"
3. get_invoice_xml
Fatura HTML/XML içeriğini UBL-TR formatında getirir.
Parametreler:
invoice_id(zorunlu): Fatura ID/UUID
Örnek: "ABC2024000001 faturasının XML'ini getir"
4. create_invoice
GİB sisteminde yeni e-Fatura oluşturur.
Parametreler:
invoice_number,issue_date,supplier_vkn,supplier_namecustomer_vkn,customer_name,items[],total_amountcurrency(opsiyonel, varsayılan: TRY)
Örnek: "XYZ müşterisine 1000 TRY fatura oluştur"
5. cancel_invoice
Mevcut faturayı iptal eder.
Parametreler:
invoice_id(zorunlu): İptal edilecek fatura IDreason(zorunlu): İptal sebebi
Örnek: "ABC2024000001 faturasını hata nedeniyle iptal et"
6. search_invoices
Filtrelerle fatura ara.
Parametreler:
customer_name,supplier_name(opsiyonel)min_amount,max_amount(opsiyonel)status(opsiyonel): approved, pending, cancelled
Örnek: "10000 TL üzeri faturaları bul", "Beklemedeki faturaları göster"
7. validate_tax_number
Türk vergi numarasını doğrula (VKN/TCKN).
Parametreler:
tax_number(zorunlu): 10 veya 11 haneli vergi numarası
Örnek: "1234567890 vergi numarasını doğrula"
GİB Credentials Nasıl Alınır
Nasıl Yapılır: Şirketinin mevcut e-Fatura credentials'ını kullan
- Portal: https://earsivportal.efatura.gov.tr (canlı)
- Test Portal: https://earsivportaltest.efatura.gov.tr (test)
Proje Yapısı
efatura-mcp-server/
├── src/
│ └── efatura_mcp/
│ ├── server.py # Ana MCP sunucu
│ ├── gib_earsiv_client.py # Gerçek GİB API client
│ └── mock_data.py # Demo verisi
├── .env # credentials'ın (gitignored)
├── .env.example # Şablon
└── README.md
Tam rehber için SECURITY.md'ye bak.
Gereksinimler
- Python 3.10+
- Claude Desktop (veya herhangi bir MCP client)
Bağımlılıklar pip install -e . ile otomatik kurulur.
Lisans
MIT
Support / Destek
For issues and questions, please open an issue on GitHub.
Sorunlar ve sorular için lütfen GitHub'da bir issue açın.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。