Skip to main content

APIDIAN MCP

MCP server (Python) that consumes the APIDIAN 2026 API — Softkad's DIAN e-invoicing service (UBL 2.1, Colombia) — documented in the sibling repository's Postman collection ApiDianV2.12026.postman_collection.json.

Independent project living in its own Git repository: it does not live inside the API project.

Features

  • Configuration tools: company (create/update, query, delete), digital certificate .p12 (upload, listing, expiry), software registration (invoice, payroll, support-document, equivalent documents), resolutions.
  • Catalog & Query tools: documents (list by date/search), customers (list/get/search/register/update), items/products (list/get/create/update), DIAN tables (payment-forms, payment-methods), resolutions by type, PDF templates, taxpayer info (DIAN RUT), document download (XML/PDF).
  • Emission tools: invoice, credit-note, debit-note, support-document, equivalent document (eqdoc), payroll, invoice-mandate (factoring). Bodies are seeded from real collection examples (fixtures/).
  • Status tools: status by ZIP_KEY, status by CUFE/CUNE, registered events by CUFE.
  • Auxiliary tools: next consecutive number, WhatsApp config (get/set) and message sending.
  • Proper DIAN business handling (Spec S5): the API answers HTTP 200 even when the DIAN rejects a document — the verdict lives inside ResponseDian. Accepted documents return their payload; rejected ones raise an error carrying the DIAN rejection messages.

Requirements

  • Python 3.11+
  • An APIDIAN environment (local Laragon instance, staging or production) reachable from the machine running the MCP server.

Installation

git clone <this-repo> softkad-mcp
cd softkad-mcp
python -m venv .venv
.venv/Scripts/python -m pip install -e ".[dev]"

The softkad-mcp console command is registered by [project.scripts].

Configuration

Copy docs/env.example to .env (or export the variables) before starting:

APIDIAN_BASE_URL=http://127.0.0.1/api        # single base URL for every endpoint
APIDIAN_TOKEN=your_api_token_here            # bearer token from company registration
APIDIAN_TIMEOUT=60                            # request timeout in seconds

Authentication is token-only:

  • Set APIDIAN_TOKEN with an api_token obtained from company registration.
  • If you don't have a token yet, register a company first — the response includes a token that can be used for the session.

Every endpoint requires the bearer token except company registration (which issues its own token on creation).

Run as an MCP server (stdio)

.venv/Scripts/softkad-mcp

Run as an MCP server (SSE remote) with stdio bridge

If your MCP client only speaks stdio (Claude Desktop, ChatGPT Desktop, etc.) but you want to connect to a remote SSE server, use the bridge:

# Token as argument
.venv/Scripts/softkad-mcp-bridge https://softkad-mcp.softkad.co/sse \
    --token 5a7dece2d28dbd066818fc037b7c525ae41e1c91d1ad6e0a895db87d71eb5855

# Or via environment variable
$env:APIDIAN_MCP_TOKEN="5a7dece2d28dbd066818fc037b7c525ae41e1c91d1ad6e0a895db87d71eb5855"
.venv/Scripts/softkad-mcp-bridge https://softkad-mcp.softkad.co/sse

The bridge works transparently with any stdio MCP client.

Claude Desktop config (stdio local or bridge)

{
  "mcpServers": {
    "apidian-colombia": {
      "command": "C:\\laragon\\www\\co-apidian2026-mcp\\.venv\\Scripts\\softkad-mcp.exe",
      "args": [],
      "env": {
        "APIDIAN_BASE_URL": "https://api-diancol.softkad.co/api",
        "APIDIAN_TOKEN": "5a7dece2d28dbd066818fc037b7c525ae41e1c91d1ad6e0a895db87d71eb5855",
        "APIDIAN_VERIFY_SSL": "false"
      }
    }
  }
}

Or using the bridge for remote SSE:

{
  "mcpServers": {
    "apidian-colombia": {
      "command": "C:\\laragon\\www\\co-apidian2026-mcp\\.venv\\Scripts\\softkad-mcp-bridge.exe",
      "args": [
        "https://softkad-mcp.softkad.co/sse",
        "--token", "5a7dece2d28dbd066818fc037b7c525ae41e1c91d1ad6e0a895db87d71eb5855"
      ]
    }
  }
}

Configure an MCP client

MCP stdio servers are declared in the client's mcpServers block. Example for Claude Desktop / compatible clients:

{
  "mcpServers": {
    "apidian": {
      "command": "C:\\laragon\\www\\co-apidian2026-mcp\\.venv\\Scripts\\softkad-mcp.exe",
      "args": [],
      "env": {
        "APIDIAN_BASE_URL": "http://127.0.0.1/api",
        "APIDIAN_TOKEN": "your_api_token_here"
      }
    }
  }
}

Adjust the command path and env to your installation. Pointers:

  • On Windows the entry point is .venv\Scripts\softkad-mcp.exe; on Linux/macOS .venv/bin/softkad-mcp.
  • Never commit real credentials: use environment variables or the client's secret store.
  • The server is stateless across restarts: per-session tokens die with the process.

Tools

Health & diagnostics

Tool Purpose
apidian_health Server status: base URL, authenticated flag, auth hint

Configuration

Tool Purpose
apidian_company Register / update a company (returns token on creation)
apidian_company_get Query a company by NIT
apidian_company_delete Delete a company
apidian_certificate_upload Upload digital certificate .p12
apidian_certificates_list List certificates for a NIT
apidian_certificate_expiry Query certificate expiry date
apidian_register_software Register billing software (invoice / payroll / support-document / eqdocs)
apidian_create_resolution Create a resolution
apidian_resolutions_list List resolutions for a NIT

Catalog & Query

Tool Purpose
apidian_documents_list List documents by date/search/page
apidian_customers_list List customers
apidian_customer_get Get a customer by ID
apidian_customer_search Search customer by NIT + identification number
apidian_customer_register Register / update a customer
apidian_customer_update Update a customer by ID
apidian_items_list List products / services
apidian_item_get Get an item by ID
apidian_item_create Create a product / service
apidian_item_update Update a product / service
apidian_payment_forms DIAN payment forms table
apidian_payment_methods DIAN payment methods table
apidian_resolutions_by_type List resolutions by document type and/or NIT
apidian_templates List available PDF templates
apidian_information Query DIAN taxpayer info (RUT) for a NIT
apidian_download Download a document file (XML / PDF) by NIT + filename

Emission

Tool Purpose
apidian_invoice Emit a sales invoice
apidian_credit_note Emit a credit note
apidian_debit_note Emit a debit note
apidian_support_document Emit a support document (documento soporte)
apidian_eqdoc Emit an equivalent document (POS / eqdoc)
apidian_payroll Emit a payroll document (nómina)
apidian_invoice_mandate Emit an invoice with mandate (factoring)

Status

Tool Purpose
apidian_status_zip Query DIAN status by ZIP_KEY
apidian_status_document Query DIAN status by CUFE/CUNE
apidian_events_document List registered events for a document

Auxiliary

Tool Purpose
apidian_next_consecutive Get the next consecutive number for a resolution
apidian_whatsapp_get_config Get WhatsApp integration config
apidian_whatsapp_set_config Set / update WhatsApp integration config
apidian_whatsapp_send Send a text message via WhatsApp

Each emission tool accepts a full body or an example name (see fixtures/index.json) to seed it.

Docs and data

  • fixtures/ — request examples and saved responses extracted from the Postman collection via scripts/extract_fixtures.py (Spec S6 oracles).
  • odd/tasks/softkad-mcp.md — feature document with specs, tasks, and log.

Tests

.venv/Scripts/python -m pytest -q

The suite is HTTP-free: it stubs the client transport and asserts the exact method, path, body, and DIAN envelope handling.

Metadata

Release files for softkad-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for softkad-mcp 0.1.1
File Size Uploaded Provenance
softkad_mcp-0.1.1.tar.gz 32.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for softkad-mcp 0.1.1
File Interpreter ABI Platform
softkad_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 56.7 kB

Release files / softkad_mcp-0.1.1.tar.gz

Download URL softkad_mcp-0.1.1.tar.gz
Size 32.0 kB
Tags Source
SHA-256 checksum
How to use checksums
164057334fd283b3a9a4ee0ab0249799e280ef3f350974b6385228199ea858e2
BLAKE2b-256 checksum
How to use checksums
cad9066daa48ada3981c6cff9b8f274dda16f0d411092776de310f1c96d84196
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Release files / softkad_mcp-0.1.1-py3-none-any.whl

Download URL softkad_mcp-0.1.1-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23998116e9e8942a9c843d2b4a3d985370d3b63bac8d0e96e7fc91d37847f564
BLAKE2b-256 checksum
How to use checksums
7e358212f59a47a7adc11da6968bbb73a2eace6159f555ed7c32d3d4a6cb2821
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Security for softkad-mcp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page