KRA eTIMS MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@KRA eTIMS MCP Server validate this eTIMS invoice JSON and explain any KRA error codes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
KRA eTIMS MCP Server
A high-performance Model Context Protocol (MCP) server providing complete, authoritative knowledge, API schemas, validation rules, code snippets, and automated error diagnostics for Kenya Revenue Authority (KRA) eTIMS integrations.
Enables AI coding assistants to seamlessly write, validate, and troubleshoot eTIMS integrations across OSCU (Cloud REST), VSCU (Virtual Sales Control Unit), TIS (Trader Invoicing System), Buyer-Initiated Invoicing (BII), Fuel Station Automation, and Stock Management.
Supported AI Assistants
Works out-of-the-box via the standard STDIO transport with:
Assistant / IDE | Configuration Location | Status |
Cursor |
| [x] Supported |
Google Antigravity |
| [x] Supported |
Zed IDE |
| [x] Supported |
Claude Code |
| [x] Supported |
OpenAI Codex |
| [x] Supported |
GitHub Copilot |
| [x] Supported |
Related MCP server: eleata e-invoice MCP server
Quickstart (Zero-Install via NPX)
You can run the server directly without cloning or building:
npx -y kra-etims-mcpClient Setup Instructions
1. Cursor
Add to your project's .cursor/mcp.json (or global ~/.cursor/mcp.json):
{
"mcpServers": {
"kra-etims": {
"command": "npx",
"args": ["-y", "kra-etims-mcp"]
}
}
}2. Google Antigravity
Add to .agents/mcp_config.json in your workspace root, or configure interactively using the /mcp command:
{
"mcpServers": {
"kra-etims": {
"command": "npx",
"args": ["-y", "kra-etims-mcp"]
}
}
}3. Zed IDE
Add to .zed/settings.json in your project or global ~/.config/zed/settings.json:
{
"context_servers": {
"kra-etims": {
"command": {
"path": "npx",
"args": ["-y", "kra-etims-mcp"]
}
}
}
}Or when running via local Docker container:
{
"context_servers": {
"kra-etims": {
"command": {
"path": "docker",
"args": ["run", "-i", "--rm", "kra-etims-mcp"]
}
}
}
}4. Claude Code
Run the CLI command:
claude mcp add --transport stdio kra-etims -- npx -y kra-etims-mcpOr create .mcp.json in your repository root:
{
"mcpServers": {
"kra-etims": {
"command": "npx",
"args": ["-y", "kra-etims-mcp"]
}
}
}5. OpenAI Codex
Add to ~/.codex/config.toml:
[mcp_servers.kra-etims]
command = "npx"
args = ["-y", "kra-etims-mcp"]6. GitHub Copilot (VS Code)
Add to .vscode/mcp.json:
{
"mcpServers": {
"kra-etims": {
"command": "npx",
"args": ["-y", "kra-etims-mcp"]
}
}
}Running in Docker (Automatic Reboot Restart)
The server can run as a background container configured with restart: unless-stopped, so it stays alive across host reboots.
Option A: Docker Compose (Recommended)
Start the service:
docker compose up -dCheck health status:
curl http://localhost:3000/healthConnect your IDEs using the HTTP/SSE endpoint:
SSE Stream:
http://localhost:3000/sseMessages:
http://localhost:3000/message
Option B: Docker CLI
Run in daemon mode with automatic reboot restart:
docker run -d \
--name kra-etims-mcp \
--restart unless-stopped \
-p 3000:3000 \
kra-etims-mcp --http 3000Run in STDIO mode directly from your IDE:
docker run -i --rm kra-etims-mcpOS-Specific Startup & Setup Guide (Linux, macOS, Windows)
Whether you choose Docker or Node.js (npx), follow the instructions below tailored to your operating system.
Linux (Ubuntu, Debian, Fedora, Arch, CentOS)
Method 1: Docker (Single Command with Reboot Auto-Restart)
Ensure Docker is running:
sudo systemctl enable --now dockerStart the container:
docker compose up -d(Or with pure Docker CLI):
docker run -d --name kra-etims-mcp --restart unless-stopped -p 3000:3000 kra-etims-mcp --http 3000Verify running status:
curl http://localhost:3000/health
Method 2: Node.js / NPX (No Docker Required)
Requires Node.js 18+ installed (node -v):
npx -y kra-etims-mcpLinux Client Configuration File Paths:
Cursor:
~/.cursor/mcp.jsonor project.cursor/mcp.jsonGoogle Antigravity:
~/.gemini/config/mcp_config.jsonor project.agents/mcp_config.jsonZed IDE:
~/.config/zed/settings.jsonor project.zed/settings.jsonClaude Code:
~/.claude.jsonor project.mcp.jsonOpenAI Codex:
~/.codex/config.tomlGitHub Copilot / VS Code:
~/.config/Code/User/globalStorage/github.copilot/mcp.jsonor project.vscode/mcp.json
macOS (Apple Silicon M1/M2/M3/M4 & Intel)
Method 1: Docker (Docker Desktop or OrbStack)
Ensure Docker Desktop is open: Launch
Docker.apporOrbStack.appfrom Applications.Start the container: In Terminal (
zsh):docker compose up -d(Or with pure Docker CLI):
docker run -d --name kra-etims-mcp --restart unless-stopped -p 3000:3000 kra-etims-mcp --http 3000Verify running status:
curl http://localhost:3000/health
Method 2: Node.js / NPX (No Docker Required)
Requires Node.js installed (brew install node):
npx -y kra-etims-mcpmacOS Client Configuration File Paths:
Cursor:
~/Library/Application Support/Cursor/User/globalStorage/cursor.mcp/mcp.jsonor project.cursor/mcp.jsonGoogle Antigravity:
~/.gemini/config/mcp_config.jsonor project.agents/mcp_config.jsonZed IDE:
~/Library/Application Support/Zed/settings.jsonor project.zed/settings.jsonClaude Code:
~/.claude.jsonor project.mcp.jsonOpenAI Codex:
~/.codex/config.tomlGitHub Copilot / VS Code:
~/Library/Application Support/Code/User/globalStorage/github.copilot/mcp.jsonor project.vscode/mcp.json
Windows (10 & 11)
Method 1: Docker Desktop (with WSL2 Backend)
Ensure Docker Desktop is running: Start Docker Desktop from the Start Menu. Ensure WSL2 integration is enabled.
Start the container (Run in PowerShell or Command Prompt):
docker compose up -d(Or with pure Docker CLI):
docker run -d --name kra-etims-mcp --restart unless-stopped -p 3000:3000 kra-etims-mcp --http 3000Verify running status:
curl http://localhost:3000/health # or in PowerShell: Invoke-RestMethod http://localhost:3000/health
Method 2: Node.js / NPX on Windows
Requires Node.js installed from nodejs.org:
npx -y kra-etims-mcpOn Windows, some tools require specifyingcmd.exe /c npx -y kra-etims-mcp if npx is a .cmd batch script. Example for Windows mcp.json:
{
"mcpServers": {
"kra-etims": {
"command": "cmd.exe",
"args": ["/c", "npx", "-y", "kra-etims-mcp"]
}
}
}Or when using Docker directly on Windows:
{
"mcpServers": {
"kra-etims": {
"command": "docker",
"args": ["run", "-i", "--rm", "kra-etims-mcp"]
}
}
}Windows Client Configuration File Paths:
Cursor:
%APPDATA%\Cursor\User\globalStorage\cursor.mcp\mcp.jsonor project.cursor\mcp.jsonGoogle Antigravity:
%USERPROFILE%\.gemini\config\mcp_config.jsonor project.agents\mcp_config.jsonZed IDE:
%APPDATA%\Zed\settings.jsonor project.zed\settings.jsonClaude Code:
%USERPROFILE%\.claude.jsonor project.mcp.jsonOpenAI Codex:
%USERPROFILE%\.codex\config.tomlGitHub Copilot / VS Code:
%APPDATA%\Code\User\globalStorage\github.copilot\mcp.jsonor project.vscode\mcp.json
Capabilities & Developer Tools
1. Tools
Tool | Description |
| Sub-millisecond full-text and fuzzy search across guides, API endpoints, error codes, and code tables. |
| Inspect full request/response schemas, URLs, required headers, and parameters for OSCU or VSCU endpoints. |
| Query KRA code tables (Tax categories A-E, Payment methods 01-07, Credit note reasons 01-13, Stock movement types 01-16, Packaging units, HS codes). |
| Validates PIN formats (11-chars: P/A + 9 digits + letter), branch IDs, timestamps, and verifies that tax amounts balance ( |
| Generates ready-to-run, mathematically sound JSON request bodies for sales invoices, credit notes, item registration, stock in/out, and device handshake. |
| Instant diagnostics for KRA error codes ( |
| Formats receipt parameters into the official cryptographic KRA QR code string ( |
2. Resources (etims://...)
Directly attachable knowledge documents:
etims://docs/oscu-vs-vscu— OSCU vs VSCU Architecture & Integration Guideetims://docs/onboarding-guide— Step-by-step Onboarding & Handshake Guideetims://docs/credit-notes-rules— Credit Notes & Invoice Reversal Rulesetims://docs/buyer-initiated-invoicing— Buyer-Initiated Invoicing (BII) & Reverse Invoicingetims://docs/stock-management— Mandatory Stock Management Guideetims://docs/fuel-station-system— Forecourt Automation & Fuel Station Systemetims://docs/tis-qr-code-spec— TIS Receipt Layout & QR Code Formulaetims://codes/all— All system code tables dictionaryetims://errors/all— All error codes and troubleshooting catalogetims://api/catalog— Complete API endpoints catalog
3. Guided Prompts
scaffold-etims-client— Scaffolds an eTIMS API client in TypeScript, Python, PHP, or Go.debug-etims-error— Interactive troubleshooting for failed KRA requests.implement-credit-note— Step-by-step credit note generation sequence.setup-stock-sync— Workflow for mandatory stock synchronization.
Performance & Architecture
Sub-2ms Execution: In-memory pre-compiled index powered by MiniSearch.
Zero Disk Overhead: Static assets and code tables are bundled at build time; no database or external network calls needed during knowledge queries.
Safe Stdio Transport: All diagnostic logging writes strictly to
stderr, ensuring the JSON-RPC 2.0 communication channel onstdoutremains uncorrupted.
Development & Testing
Install dependencies:
npm installBuild project:
npm run buildRun automated tests:
npm testType checking:
npm run typecheck
License
MIT © 2026 KRA eTIMS Open Source Community
Available Tools
7 toolsexplain_error_codeA
Diagnose and resolve KRA eTIMS error codes (e.g., 000, 901, 903, 910, 994, TIS memory/clock codes). Returns cause, description, and concrete fix steps.
Inputs: code (required).
generate_qr_code_stringA
Formats invoice confirmation data into the official KRA eTIMS QR code string: 'invoice_date(ddmmyyyy)#time(hhmmss)#cu_number#cu_receipt_number#internal_data#receipt_signature'.
Inputs: time (required), cu_number (required), invoice_date (required), internal_data (required), +2 more.
generate_sample_payloadA
Generates production-ready, mathematically balanced sample JSON request payloads for eTIMS endpoints (sales, credit notes, item registration, stock in/out, handshake).
Inputs: type (required), custom_pin, custom_buyer_pin.
get_api_specB
Get full technical specifications, parameters, headers, and request/response payloads for an eTIMS API endpoint (OSCU or VSCU).
Inputs: endpoint_name (required), solution.
lookup_codeB
Look up official KRA code tables or specific code definitions (tax types, payment methods, credit note reasons, stock movement types, packaging units, quantity units).
Inputs: table_name (required), code.
search_knowledge_baseB
Search the comprehensive KRA eTIMS knowledge base (guides, API specs, error codes, code tables). Returns relevant excerpts with sub-millisecond execution.
Inputs: query (required), limit, category.
validate_etims_payloadA
Validates eTIMS JSON payloads, KRA PINs, branch IDs, and ensures tax math (taxblAmtA-E, taxAmtA-E, totAmt) perfectly balances before submitting to KRA.
Inputs: payload_json (required), payload_type (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Most tools have distinct roles: endpoint specs, code-table lookup, payload validation, sample generation, QR formatting, and error diagnosis. The broad search_knowledge_base overlaps somewhat with lookup_code, explain_error_code, and get_api_spec, but the descriptions clarify when each specialized tool should be used.
All names use consistent snake_case and generally follow a verb_noun or verb_object pattern such as search_knowledge_base, get_api_spec, validate_etims_payload, and generate_sample_payload. The convention is predictable throughout the set.
Seven tools is a well-scoped set for a developer-facing KRA eTIMS assistant, covering lookup, generation, validation, and diagnosis without excessive surface area. Each tool appears to earn its place.
The surface covers key developer workflows: discovering API specs, looking up codes, validating payloads, generating samples, formatting QR strings, and resolving errors. It lacks direct submission or lifecycle tools, but for a knowledge/validation-oriented MCP server the coverage is strong with minor gaps.
Maintenance
Related MCP Connectors
Validate EU, UK, AU VAT numbers for AI agents. EU ViDA e-invoicing compliance.
Peru CPE invoices for AI agents - issue, query, void facturas/boletas via SUNAT (2 backends).
15 deterministic validation tools for AI agents: tax IDs (15 countries), VAT, IBAN, LEI, HS codes.
EN 16931/XRechnung e-invoice validate+create, Peppol routing, EU VAT/EORI, sanctions, KYB. Free tier
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides real-time OWASP ASVS security guidance and vulnerability scanning for AI coding agents. Enables proactive security during code generation by checking security requirements, scanning code for vulnerabilities, and suggesting secure code fixes.3MIT
- AlicenseAqualityDmaintenanceValidates EU electronic invoices (Peppol, XRechnung, FatturaPA, etc.) and explains validation error codes, enabling AI coding agents to check invoice validity and get fixes before rejection.346 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to locally parse, validate, audit, explain, generate, and convert XRechnung and ZUGFeRD/Factur-X e-invoices using official rule sets, fully offline with no API keys required.Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables AI coding agents to safely integrate cross-border payments by providing structured payment knowledge, deterministic validation of idempotency, security, and state-machine rules, webhook testing, executable pytest generation, and diagnosis for Python/FastAPI Checkout projects.-