Skip to main content
Glama
GSTR-1 MCP Server

GSTR-1 MCP Server

by vishnu27597

๐Ÿงพ GSTR-1 MCP Server

An MCP (Model Context Protocol) server that enables AI assistants to file Indian GST GSTR-1 returns via the GST portal sandbox APIs.

Works with Claude Desktop, Kiro, ChatGPT (with MCP plugin), Cursor, Windsurf, and any MCP-compatible client.

What It Does

This server wraps the Indian GST portal's GSTR-1 APIs into 8 tools that AI assistants can call:

#

Tool

Description

1

generate_taxpayer_session

Full auth flow โ€” generates app key, requests OTP, gets auth token

2

save_gstr1_data

Upload invoice data (b2b, b2cl, b2cs, hsn sections)

3

check_return_status

Poll async processing status until COMPLETED

4

proceed_to_file

Initiate filing after data validation

5

get_gstr1_summary

Get section summaries + checksum for filing

6

generate_evc_otp

Request Electronic Verification Code OTP

7

file_gstr1

Final submission with EVC OTP โ†’ returns ARN

8

convert_excel_to_payload

Convert GSTR-1 Excel workbook to API JSON

Related MCP server: india-stack-mcp

Prerequisites

  1. uv โ€” Python package manager (install guide)

    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. GST Sandbox Public Key Certificate โ€” bundled in certs/ directory (no download needed for sandbox)

  3. GSP Credentials โ€” client-id and client-secret from your GSP onboarding

Quick Start

1. Clone the repo

git clone https://github.com/vishnu27597/gstr1-mcp-server.git
cd gstr1-mcp-server

2. Set up environment

cp .env.example .env
# Edit .env with your credentials and cert path

3. Configure your MCP client

Add the server to your MCP client's configuration file.


MCP Client Setup

Kiro

Edit ~/.kiro/settings/mcp.json (or .kiro/settings/mcp.json in your workspace):

{
  "mcpServers": {
    "gstr1": {
      "command": "uv",
      "args": [
        "--directory", "/absolute/path/to/gstr1-mcp-server",
        "run", "gstr1-mcp-server"
      ],
      "env": {
        "GST_CLIENT_ID": "3jXXbtwkLpt+dd5bAxQKBxTAHGv4nnLl+nwcapkmvK8=",
        "GST_CLIENT_SECRET": "aox4PGWgcFv3MCRUPxf30TQ8t2v6c48mhptufG1QEAk5uu048yfUlPp4tIG5gY2gr4eYTRe6+5p7ehbqXZdvXg==",
        "GST_USERNAME": "TN_NT2.21475",
        "GST_STATE_CD": "33"
      }
    }
  }
}

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "gstr1": {
      "command": "uv",
      "args": [
        "--directory", "/absolute/path/to/gstr1-mcp-server",
        "run", "gstr1-mcp-server"
      ],
      "env": {
        "GST_CLIENT_ID": "3jXXbtwkLpt+dd5bAxQKBxTAHGv4nnLl+nwcapkmvK8=",
        "GST_CLIENT_SECRET": "aox4PGWgcFv3MCRUPxf30TQ8t2v6c48mhptufG1QEAk5uu048yfUlPp4tIG5gY2gr4eYTRe6+5p7ehbqXZdvXg==",
        "GST_CERT_PATH": "/path/to/GSTN_G2B_SANDBOX_UAT_public.cert.cer",
        "GST_USERNAME": "TN_NT2.21475",
        "GST_STATE_CD": "33",
        "GST_BASE_URL": "https://staging-passthrough.gsp.amazon.dev"
      }
    }
  }
}

Cursor

Edit .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "gstr1": {
      "command": "uv",
      "args": [
        "--directory", "/absolute/path/to/gstr1-mcp-server",
        "run", "gstr1-mcp-server"
      ],
      "env": {
        "GST_CLIENT_ID": "3jXXbtwkLpt+dd5bAxQKBxTAHGv4nnLl+nwcapkmvK8=",
        "GST_CLIENT_SECRET": "aox4PGWgcFv3MCRUPxf30TQ8t2v6c48mhptufG1QEAk5uu048yfUlPp4tIG5gY2gr4eYTRe6+5p7ehbqXZdvXg==",
        "GST_CERT_PATH": "/path/to/GSTN_G2B_SANDBOX_UAT_public.cert.cer",
        "GST_USERNAME": "TN_NT2.21475",
        "GST_STATE_CD": "33",
        "GST_BASE_URL": "https://staging-passthrough.gsp.amazon.dev"
      }
    }
  }
}

Environment Variables

Variable

Required

Description

Example

GST_CLIENT_ID

Yes

GSP client ID (Base64 encoded)

3jXXbtwkLpt+...

GST_CLIENT_SECRET

Yes

GSP client secret (Base64 encoded)

aox4PGWgcFv3...

GST_CERT_PATH

No

Override path to .cer file (sandbox cert bundled)

/path/to/cert.cer

GST_USERNAME

Yes

Taxpayer username for sandbox

TN_NT2.21475

GST_STATE_CD

Yes

2-digit state code

33

GST_BASE_URL

No

API base URL (defaults to sandbox)

https://staging-passthrough.gsp.amazon.dev


Filing Workflow

Here's how an AI assistant uses the tools to file a GSTR-1 return:

Step 1: generate_taxpayer_session
       โ†“ (returns access_token)
Step 2: save_gstr1_data (with invoice JSON payload)
       โ†“ (returns reference_id)
Step 3: check_return_status (poll until COMPLETED)
       โ†“
Step 4: proceed_to_file
       โ†“ (returns reference_id)
       โ†’ check_return_status (poll until COMPLETED)
       โ†“
Step 5: get_gstr1_summary
       โ†“ (returns sec_sum + chksum)
Step 6: generate_evc_otp
       โ†“ (OTP sent to taxpayer)
Step 7: file_gstr1 (with OTP + sec_sum + chksum)
       โ†“ (returns ARN โ€” filing acknowledgement)

Example: Save a B2B Invoice

Ask your AI assistant:

"File my GSTR-1 for March 2026. My GSTIN is 33CMNPP5324B9Z0, username TN_NT2.21475. I have one B2B invoice: invoice number TEST-INV-001, dated 15-03-2026, value โ‚น10,000, to buyer GSTIN 33GSPTN0161G1ZH, 18% GST intra-state."

The assistant will:

  1. Call generate_taxpayer_session to authenticate

  2. Call save_gstr1_data with the invoice payload

  3. Call check_return_status to confirm processing

  4. Continue through the filing workflow

Example: Convert Excel and File

"Convert my GSTR-1 Excel at /path/to/GSTR1_output_032026.xlsx and file it for March 2026."

The assistant will:

  1. Call convert_excel_to_payload to read the Excel

  2. Call generate_taxpayer_session to authenticate

  3. Call save_gstr1_data with the converted payload

  4. Complete the filing workflow


Sandbox Details

Property

Value

Base URL

https://staging-passthrough.gsp.amazon.dev

Auth API

/taxpayerapi/v1.0/authenticate

Returns API

/taxpayerapi/v4.0/returns/gstr1

Sandbox OTP

575757 (no real OTP needed)

Test GSTIN

33CMNPP5324B9Z0

Test Username

TN_NT2.21475

State Code

33 (Tamil Nadu)

Counter-party GSTIN

33GSPTN0161G1ZH

Token Expiry

360 minutes


API Payload Rules

  • Intra-state (seller state = POS): use camt (CGST) + samt (SGST). Never iamt.

  • Inter-state (seller state โ‰  POS): use iamt (IGST). Never camt/samt.

  • Invoice date: DD-MM-YYYY in API payload

  • Return period: MMYYYY format (e.g. 032026), must not be future month

  • Batching: Multiple save_gstr1_data calls allowed. System stores the union. Same invoice number replaces previous.


Development

# Install dependencies
uv sync

# Run the server locally
uv run gstr1-mcp-server

# Run tests
uv run pytest

Project Structure

gstr1-mcp-server/
โ”œโ”€โ”€ pyproject.toml              # Package config + dependencies
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE                     # MIT
โ”œโ”€โ”€ .env.example                # Credential template
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ certs/
โ”‚   โ””โ”€โ”€ GSTN_G2B_SANDBOX_UAT_public.cert.cer  # Bundled sandbox cert
โ”œโ”€โ”€ schemas/
โ”‚   โ”œโ”€โ”€ gstr1_schema.json       # Official GSTR-1 upload schema v2.4
โ”‚   โ””โ”€โ”€ sample_payload.json     # Sample GSTR-1 payload from GST portal
โ””โ”€โ”€ src/
    โ””โ”€โ”€ gstr1_mcp_server/
        โ”œโ”€โ”€ __init__.py
        โ”œโ”€โ”€ server.py           # MCP server + 8 tool definitions
        โ”œโ”€โ”€ crypto.py           # AES/RSA encryption for GST APIs
        โ”œโ”€โ”€ gst_api.py          # HTTP client + session management
        โ””โ”€โ”€ excel_converter.py  # GSTR-1 Excel โ†’ API JSON converter

License

MIT


References

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to manage Indian enterprise systems by providing tools for accounting (TallyPrime), invoicing (Zoho Books), and GST compliance (validation, e-invoice generation, and GSTR-2B reconciliation), with dry-run-first writes and an audit trail.
      2
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to build and structurally validate Indian GST e-invoice JSON payloads (INV/CRN/DBN) and render IRP-returned signed QR strings as PNG images.
      1
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables converting Indian GST tax invoices into government INV-01 JSON payloads via OCR and deterministic extraction, with tools to validate GSTINs and re-validate payloads, and reports exactly what it couldn't read.
      3
      MIT