MCP for Bangladesh Construction codes and regulations

And how I made it!

Share
MCP for Bangladesh Construction codes and regulations
Photo by Md Arafat Ul Alam / Unsplash

TL:DR: I have built an MCP(using mintlify) for 'building construction legal code. Link: https://docs.sayed.app/mcp , You can use with Claude, Chatgpt or with any LLMs that support MCP tooling.

Bangladesh legal codes, regulations doesn't have any standard format to publish on the internet. Everything is scattered. As, I am from Civil Engineering background, I wanted to build this system where AI agents, crawer can cite the legal constructions info correctly.
The blog post will be about how I actually organized the corpus in markdown and how to use it, not about how to build MCP!


So far, I have added 3 codes in the site.

1. BNBC 2020,

2. BNBC 2006,

3. ঢাকা মহানগর ইমারত বিধিমালা, ২০২৫


My main method is to split the PDF pages into single page and save them in a folder per page. If the PDF is copy-able/extract-able , keep them in PDF file otherwise PNG. Then, in general sending wellknown PDF extraction tools and OCR tools then extract the main content. The PDF extraction tools: pymupdf4llm, pymupdf, markitdown, pdfplumber, easyocr and few others. Then, build the skeleton content. Then, send swarm of AI agents per reasonable pages(like 5 pages per agent) and fix up the content. Then, again send specialized agents for table fixer, figure fixer and overall content quality checks. In that way, the LLM wont hallucinate or assume any content! Here how I extracted those specific content:

BNBC 2020
BNBC 2020 is the main legal code for building constructions in Bangladesh. The main PDF is in english and publish as copyable PDF. I split the PDF first. Then, I ran those 3 types of pdf tools pymupdf4llm,markitdown, pdfplumberto extract the main content then followed the LLMs way to fix up. It was easy.

BNBC 2006
BNBC 2006 code was in image based PDF. So, I splits the PDF into PNG images, 1 per folder. Then, ran local OCR. Then, send agents to fix up.

ঢাকা মহানগর ইমারত বিধিমালা, ২০২৫
This code is in Bangla. Bangladesh govt offices uses ANSI fonts and mixup many glyph and it doesnt follow any standard font or method. You just cant copy any content from those PDF! You can check by yourself here. I have to built a learning method and mapping every character with real bangla unicode range and extract the primary content. Here few example of mapping:

1: 'প', 2: 'হ', 3: 'া', 4: 'য়', 5: 'ন', 7: 'ও',
8: 'র', 9: 'ণ', 10: 'ি', 11: 'ত', 13: 'ম', 14: 'য',
15: 'ল', 16: '়', 17: 'য', 18: 'প', 19: 'ি', 20: 'র',
21: 'খ', 23: '২', 24: '৬', 25: 'অ', 26: 'গ্র', 27: '১',
28: '৪', 29: '৩', 30: 'ব', 32: 'া', 33: 'ল', 34: 'ড',
35: 'ে', 36: 'স', 37: 'ব', 38: '০', 39: '৫', 40: '৬',
41: 'র', 42: 'এ', 43: 'হ', 44: 'আ', 45: 'ং', 46: '৯',
47: '্', 48: 'ই', 50: 'দ', 51: 'ক', 52: 'ষ', 53: 'ক',
55: 'ন', 56: 'ূ', 57: 'ধ', 58: 'য', 59: 'থ', 60: 'য',
61: 'া', 62: 'শ', 65: 'ঢ', 66: 'ভ', 67: '়', 68: 'ত',
69: 'া', 70: 'জ', 71: 'া', 72: '্য', 73: 'ষ', 74: 'থ',
75: 'ে', 78: 'ন', 80: 'দ', 81: 'ক্', 82: 'ি', 83: 'চ',
84: 'ী', 86: '়', 87: 'ফ', 88: 'র', 89: 'উ', 90: 'র',
91: 'দ্ব', 92: 'পূ', 93: 'উ', 94: 'ো', 95: 'ন', 96: 'গ',
97: 'থ', 98: '্', 99: 'প', 100: 'ব', 101: 'ড', 102: 'ক',
103: 'ব', 104: 'ৈ', 105: 'গু', 106: 'থ', 107: 'ক', 108: 'স',
109: 'ট', 110: 'ব', 111: 'া', 112: 'ট', 113: 'ো', 114: '৭',
115: '৮', 116: 'ক্', 117: '্', 118: 'য', 119: '্', 120: 'ব',
121: 'ব', 122: 'গ', 123: 'ী', 124: 'মূ', 126: 'প', 127: 'ছ',
128: 'র', 129: 'স', 130: 'ে', 131: 'ল', 132: 'বৃ', 133: 'ৎ',
134: 'ন', 135: 'দ', 136: 'ক', 137: 'প', 138: 'ৌ', 139: 'ব',
140: '্', 141: 'য', 142: 'ি', 144: 'ড্', 146: 'ড', 148: 'ি',
149: 'ফু', 150: '্', 151: 'দু', 152: 'ই', 153: 'ে', 154: 'ি',
155: 'র', 156: 'র', 157: 'প', 158: 'স্ন', 159: 'স', 160: 'ঝ',
161: 'া', 162: 'ম', 163: 'উ', 164: 'ে', 165: 'ত্ব', 166: 'ঐ',
167: 'এ', 168: 'ি', 169: 'ু', 170: 'ধ', 171: 'ক', 172: 'য',
173: 'ে', 175: 'সূ', 176: 'য', 177: 'া', 178: 'ে', 179: 'য',
181: 'ধূ', 182: 'ম্র', 183: 'ঝ', 184: 'ি', 185: 'হু', 186: 'ৃ',
187: '৪', 189: 'য', 190: '়', 191: 'তু', 192: 'শষ্', 193: 'ট্য',
195: 'ক', 196: 'ি', 198: 'প্য', 199: 'ক', 200: 'উঁচ', 201: 'ু',
202: 'খু', 203: 'ম', 204: 'ন্', 205: 'য', 206: '্স', 207: 'লু',
208: 'ড়', 209: 'র্', 210: 'র', 211: 'ট্র',

Then, I sent the agents to fix up.


How to use the MCP?

You can use MCP from you AI chatbox to terminal. I will show you how to use from claude.

  1. Go to https://docs.sayed.app and copy the MCP url: https://docs.sayed.app/mcp
  1. Click on Customize and click on Add
  1. Provide a name which you will use to call this MCP tool.
  1. Confirm 'Add' and connect

You can provide the always allow permission ad it is safe and secure by Mintlify.

  1. Ask questions and get correct answer directly from the code.

If you have any questions, suggestions, ask me here or email me or send me texts.
After full completion of the site, I will publish the repo and you can directly edit the content on github. Thanks.

Read more