Textile exporters often lose time navigating DGFT notifications, schemes, public notices, trade notices, and eligibility conditions spread across changing web pages and PDFs. A WebMCP can turn that fragmented information into a controlled interface that AI agents use to search, compare, and cite relevant export incentives—without allowing the model to browse or act blindly.
This guide explains how to build a WebMCP for agents to search for textile export incentives on the DGFT portal. It focuses on reliable retrieval, source citations, India-specific trade terminology, safe automation, and a production architecture suitable for exporters, consultants, and B2B platforms.
What Is a WebMCP?
A WebMCP is a web-accessible Model Context Protocol layer that exposes structured tools and resources to AI agents. Instead of asking an agent to scrape a website freely, you define approved operations such as:
- Search DGFT documents by keyword, scheme, product, or date
- Retrieve the text and metadata of a specific notification
- Filter results by exporter type, HS code, or destination market
- Extract eligibility, benefit, validity, and application requirements
- Return source URLs and document references for verification
The protocol layer acts as a contract between the agent and your application. The agent decides when a tool is useful, but your server controls what data can be accessed, how queries are executed, and what output is returned.
For a textile-export use case, the WebMCP should not claim that a scheme applies merely because a keyword appears in a document. It should return evidence, identify uncertainty, and direct the user to the authoritative DGFT source before any commercial or filing decision.
Define the Use Case Before Writing Tools
Start with narrowly defined user questions. Examples include:
- “Which DGFT export incentives may apply to cotton home-textile exports?”
- “Find current notifications mentioning RoDTEP and HS code 6302.”
- “What documents are required for this textile export benefit?”
- “Has the validity period for this incentive changed?”
- “Which notification governs the benefit for exports from India to the UAE?”
These questions require different retrieval dimensions. A basic full-text search may find documents, but a useful system must also understand:
- Product: yarn, fabric, made-ups, garments, carpets, technical textiles, or home textiles
- HS classification: the eight-digit Indian tariff classification where available
- Scheme: RoDTEP, duty drawback, Advance Authorisation, EPCG, remission, or other applicable framework
- Document type: notification, public notice, trade notice, circular, handbook, or FAQ
- Status: active, amended, superseded, expired, or under litigation
- Time: notification date, effective date, shipment date, and claim period
- Exporter context: manufacturer, merchant exporter, MSME, first-time exporter, or e-commerce exporter
Write these requirements as testable user stories. This prevents the WebMCP from becoming a generic chatbot with weak evidence and unclear boundaries.
Recommended Architecture
A robust implementation normally has five layers:
1. DGFT ingestion layer: discovers and downloads permitted public documents and pages.
2. Normalisation layer: extracts text, tables, dates, links, and document metadata.
3. Search and evidence layer: combines keyword, metadata, and semantic retrieval.
4. WebMCP server: exposes safe tools and resources to compatible AI agents.
5. Agent application: presents answers, citations, filters, and human-review prompts.
A simple data flow is:
DGFT pages and PDFs
↓
Crawler / scheduled importer
↓
Text extraction + metadata + OCR where permitted
↓
Keyword index + vector index + document database
↓
WebMCP tools
↓
AI agent with citations and guardrailsUse a relational database such as PostgreSQL for document metadata and structured fields. OpenSearch or Elasticsearch can provide BM25 keyword search, while pgvector, OpenSearch vector search, or a managed vector database can support semantic retrieval. Object storage should retain the original file and a checksum so that extracted content can be audited.
Build a DGFT-Focused Document Corpus
The quality of the agent depends more on the corpus than on the language model. Create an ingestion pipeline that records, at minimum:
- Canonical DGFT URL
- Source page URL
- Document title
- Document type
- Publication date
- Effective date
- Last modified date, if available
- File format and checksum
- Extracted text version
- Language
- Referenced schemes
- HS codes and product terms
- Supersedes, amends, or extends relationships
- Retrieval timestamp
Do not treat a PDF filename as a reliable title. Parse the first page and validate it against the page metadata. For scanned PDFs, use OCR, but preserve the original page numbers and flag OCR-derived text as lower confidence.
A useful document status model is:
active → amended → partially_superseded → superseded
active → expired
active → withdrawn
unknown → requires_reviewStatus should be inferred conservatively. If your pipeline cannot establish that a document is current, return “status requires verification” rather than presenting it as an active incentive.
Respect DGFT’s terms, robots directives, rate limits, access controls, and applicable Indian law. Prefer official feeds, stable public pages, or manually curated source lists where available. Never bypass a CAPTCHA, login, paywall, or technical restriction.
Design Search for Textile Export Language
Textile exporters use commercial terms that may not exactly match legal scheme language. Build a controlled vocabulary and synonym map for terms such as:
- cotton yarn, spun yarn, filament yarn
- woven fabric, knitted fabric, processed fabric
- garments, readymade garments, apparel
- made-ups, bed linen, towels, kitchen linen
- carpets, floor coverings, rugs
- man-made fibre, MMF, synthetic, viscose, polyester
- technical textiles, nonwoven, geotextile
- RoDTEP, duty drawback, remission, export promotion
Keep synonyms separate from legal conclusions. “Garments” can expand retrieval, but it must not automatically prove eligibility for a specific HS code. Store the matched term and the surrounding text as evidence.
Use hybrid retrieval:
- Keyword search for exact scheme names, notification numbers, HS codes, and legal phrases
- Metadata filters for date, document type, scheme, and status
- Semantic search for natural-language questions and related terminology
- Reranking to prioritise official, recent, directly relevant documents
A typical scoring formula can combine BM25, vector similarity, document recency, source authority, and HS-code match. Keep the components visible in logs so that search quality can be tested and improved.
Define the WebMCP Tool Contract
Expose a small number of predictable, read-only tools first. For example:
{
"name": "search_dgft_textile_incentives",
"description": "Search indexed public DGFT documents for textile export incentives and return cited evidence.",
"inputSchema": {
"type": "object",
"properties": {
"query": {"type": "string"},
"hs_code": {"type": "string"},
"scheme": {"type": "string"},
"from_date": {"type": "string", "format": "date"},
"to_date": {"type": "string", "format": "date"},
"limit": {"type": "integer", "minimum": 1, "maximum": 20}
},
"required": ["query"]
}
}Useful tools include:
search_dgft_textile_incentives
Returns ranked results with title, document type, date, status, matched terms, source URL, and evidence snippets.
get_dgft_document
Fetches a specific indexed document using an internal ID. Return extracted text in bounded sections rather than an unlimited document dump.
compare_incentive_documents
Compares two or more documents across dates, eligibility language, rates, exclusions, and amendments. It should show missing fields instead of inventing values.
check_document_status
Returns known amendments, supersession links, effective dates, and the last corpus refresh time.
extract_application_requirements
Extracts explicitly stated documents, forms, declarations, timelines, and authorities from cited passages. Label each item as explicit or inferred.
Avoid an unrestricted browse_url tool in the first release. It creates prompt-injection, data-quality, and audit problems. If live retrieval is essential, constrain it to an allowlist of DGFT domains and return the fetched content as untrusted source material.
Make Every Answer Evidence-Based
The agent should follow a retrieval-and-answer policy such as:
1. Interpret the question and identify missing parameters.
2. Search with exact terms, synonyms, scheme names, and HS codes.
3. Retrieve a small set of high-quality documents.
4. Check dates, amendments, and document status.
5. Extract supporting passages.
6. Answer only from retrieved evidence.
7. Cite the official URL, document title, date, and page or section.
8. State what must be verified with DGFT, a customs broker, or a qualified trade professional.
A good answer distinguishes between:
- Document fact: “The notification states…”
- Search finding: “The indexed corpus returned…”
- Interpretation: “This may be relevant because…”
- Uncertainty: “The source does not establish…”
This is especially important for benefits whose availability can depend on HS classification, declaration requirements, shipping bill details, rate tables, dates, and later amendments. The WebMCP should never guarantee an incentive amount or eligibility without sufficient source evidence.
Handle PDFs, Tables, and Amendments Correctly
DGFT information frequently appears in PDFs containing tables, footnotes, annexures, and scanned pages. Plain text extraction can destroy table relationships. Store structured table cells where possible and retain page coordinates for citations.
For each extracted claim, save:
- Document ID
- Page number
- Character offsets or bounding box
- Extraction method
- Confidence score
- Original URL
When a notification amends an earlier document, create a relationship graph rather than indexing each file in isolation. During retrieval, show the latest amendment alongside the base document. If two documents conflict, the answer should surface the conflict and prefer the authoritative, later document only when the relationship is verified.
Security and Prompt-Injection Defences
Public web pages and PDFs are untrusted input. A malicious or accidentally embedded instruction could tell an agent to ignore its system rules, reveal secrets, or call another tool. Defend the WebMCP with:
- Strict domain and URL allowlists
- Separate treatment of document text and tool instructions
- No secrets in prompts, retrieved content, or client-visible errors
- Schema validation for every tool input
- Maximum query length, result count, and response size
- Output sanitisation for HTML, scripts, and control characters
- Authentication and tenant isolation for private indexes
- Audit logs for user, agent, tool, query, documents, and response
- Rate limiting and circuit breakers for source access
- Human approval for any future filing or transactional action
Use read-only permissions for search tools. Searching for an incentive and submitting an application are different risk classes and should not share an unrestricted agent workflow.
Evaluation: Test the System Like a Trade Analyst
Create a benchmark of real questions covering cotton, MMF, garments, home textiles, technical textiles, and textile machinery. Include ambiguous queries, outdated notifications, near-matching HS codes, and questions where no current result exists.
Measure:
- Recall of relevant official documents
- Precision of the top five results
- Citation correctness
- Page-level evidence accuracy
- Amendment and status detection
- HS-code filter accuracy
- Abstention quality when evidence is insufficient
- Latency and indexing freshness
Add adversarial tests: prompt injection inside a PDF, a fake DGFT URL, a superseded notification ranked above a current one, and a query that asks for a guaranteed benefit. The correct behaviour is to refuse unsupported certainty and provide a verification path.
Deployment and Operations
Run ingestion on a scheduled basis, but do not silently overwrite documents. Version every source and keep a change log. A practical production setup may include:
- Scheduled workers for discovery and download
- Queue-based PDF extraction and OCR
- PostgreSQL for metadata and relationships
- Search index for keyword retrieval
- Vector index for semantic retrieval
- Object storage for originals and extracted artefacts
- WebMCP service behind an API gateway
- Observability for latency, errors, tool calls, and source freshness
Display the corpus refresh date in the user interface. For time-sensitive questions, require a freshness check and explain that official DGFT publications and applicable customs procedures remain authoritative.
Common Mistakes to Avoid
- Building a general web scraper instead of an allowlisted evidence system
- Returning AI-generated scheme summaries without citations
- Ignoring HS-code granularity
- Treating every search result as active
- Losing page numbers during PDF extraction
- Mixing DGFT documents with unverified third-party blogs
- Letting the agent infer rates from incomplete tables
- Exposing a powerful live browser tool without controls
- Failing to log the exact documents used in an answer
- Presenting legal or tax interpretation as definitive advice
A narrow, citation-first WebMCP is more useful than a broad agent that produces confident but unverifiable answers.
Suggested MVP Roadmap
Phase 1: Search and citations
Index a curated set of public DGFT textile-related documents. Implement keyword search, metadata filters, source links, page citations, and a read-only WebMCP search tool.
Phase 2: Structured extraction
Add scheme, HS code, date, status, amendment, eligibility, and document-type fields. Introduce hybrid retrieval and evaluation benchmarks.
Phase 3: Agent workflows
Add document comparison, requirement extraction, multilingual query support, and guided clarification questions. Keep all outputs grounded in retrieved evidence.
Phase 4: Enterprise controls
Add user accounts, organisation workspaces, audit exports, custom source collections, retention policies, and integrations with export documentation systems. Any action that changes records or submits forms should require explicit human approval.
FAQ
Can a WebMCP automatically access the DGFT portal?
It can access permitted public information through approved connectors or an indexed corpus. It should not bypass authentication, CAPTCHA, robots rules, or other access controls.
Can the agent confirm that my textile product qualifies for an incentive?
It can identify potentially relevant provisions and cite official evidence, but eligibility may depend on HS classification, export documentation, dates, declarations, and amendments. Final confirmation should come from the applicable official authority or a qualified professional.
Should I use only vector search?
No. Exact notification numbers, HS codes, scheme names, and legal phrases require keyword search. Hybrid retrieval is generally more reliable.
What should be cited in the answer?
Cite the official DGFT URL, document title, document date, page or section, relevant passage, and any linked amendment or supersession notice.
Apply for AI Grants India
Building a WebMCP that helps Indian exporters discover reliable DGFT incentives is a strong applied-AI opportunity. Apply to AI Grants India for support, visibility, and potential funding for your India-focused AI product.