Bangladesh Law MCP Server

Bangladesh Law MCP Server

A Model Context Protocol server that lets any AI assistant query the full text of Bangladeshi legislation directly from natural language.

Category
访问服务器

README

Bangladesh Law MCP Server

MIT License Python 3.10+ MCP Dataset size Years covered

A Model Context Protocol server that lets any AI assistant — Claude, Gemini, GPT, Cursor, VS Code, Continue.dev, or any MCP-compatible client — query the full text of Bangladeshi legislation directly from natural language.

Built on top of the Bangladesh Legal Acts Dataset, which contains 1,484+ acts scraped from http://bdlaws.minlaw.gov.bd/ and enriched with the historical government and legal-system context for each act's period.


💚 Credits

This project was made possible by the generous help of two friends:

  • Rubaiyat — for the early feedback, the test queries that shaped the tool surface, and the patient bug reports that turned half-broken prototypes into something that actually works end-to-end.
  • Jarif — for helping debug the stdio transport, walking through MCP-client integration on Windows, and pushing for the polished README and CI setup that make this thing actually shippable.

Thank you both — this project exists because of you. 💚

And of course, thanks to sakhadib and every contributor to the original Bangladesh Legal Acts Dataset — without that carefully curated corpus, none of this would exist.


✨ What you can ask

Once connected, your AI assistant can answer questions like:

  • "Find all Bangladesh acts from the 1970s related to land."
  • "What was the legal framework when the Penal Code 1860 was enacted?"
  • "Show me section 3 of the Code of Criminal Procedure."
  • "Which government was in power when the Bangladesh University of Professionals Act 2009 was passed?"
  • "Search the entire corpus for acts that mention 'environment protection'."
  • "Is the Companies Act 1994 still in force?"

🧰 Tools exposed

Tool Purpose
list_acts Browse acts with filters (year range, language, repealed/active, title substring)
get_act Fetch a complete act by id (full sections, footnotes, government & legal context)
get_section Pull a single section of an act
search_acts Free-text search across titles or section bodies, with snippets
get_statistics Aggregate dataset stats — year range, language distribution, top gov systems, repealed count

Each act is also exposed as an MCP resource at act://<act-id> so clients that prefer resource-style reads can pull the JSON directly.


📦 Installation

1. Clone this repo and the dataset side-by-side

git clone https://github.com/sakhadib/bangladesh-law-mcp.git
git clone https://github.com/sakhadib/Bangladesh-Legal-Acts-Dataset.git

You should now have:

bangladesh-law-mcp/
Bangladesh-Legal-Acts-Dataset/

The server will auto-discover the dataset in this sibling layout. If you keep the dataset anywhere else, set BLA_DATA_DIR to its Data/acts folder (or to the parent Data/ folder).

About Git LFS: the dataset uses LFS for the full corpus. If you only see a few hundred .json files in Bangladesh-Legal-Acts-Dataset/Data/acts/, run git lfs install && git lfs pull inside the dataset repo.

2. Install Python dependencies

cd bangladesh-law-mcp
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate

pip install -r requirements.txt

Or install the package itself:

pip install .

This registers a bangladesh-law-mcp command on your PATH.

3. Sanity check

python server.py

The server should print something like:

[INFO] bangladesh-law-mcp: Loading acts from .../Bangladesh-Legal-Acts-Dataset/Data/acts
[INFO] bangladesh-law-mcp: Indexing 1484 act files
[INFO] bangladesh-law-mcp: Index built: 1484 acts

and then sit silently on stdout (it's waiting for an MCP client on stdin). Press Ctrl+C to stop.


🔌 Connect an AI client

Pick your client. All of them connect over stdio — no API key, no network.

Claude Desktop

Edit claude_desktop_config.json:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "bangladesh-law": {
      "command": "python",
      "args": ["C:\\absolute\\path\\to\\bangladesh-law-mcp\\server.py"]
    }
  }
}

Restart Claude Desktop. You'll see a 🔨 icon with the new tools in the chat composer.

VS Code / Cursor (one-click via .vscode/mcp.json)

A starter config is included at .vscode/mcp.json (edit the absolute path to match your machine):

{
  "servers": {
    "bangladesh-law": {
      "type": "stdio",
      "command": "python",
      "args": ["C:\\absolute\\path\\to\\bangladesh-law-mcp\\server.py"]
    }
  }
}

Then in VS Code run MCP: List Servers from the command palette and start bangladesh-law.

Gemini (via an MCP-compatible adapter)

Gemini itself doesn't speak MCP natively, but open-source MCP bridges (LangChain's MCP adapter, the MCP Inspector, etc.) let you expose MCP tools to Gemini. After installing such an adapter, point it at:

python /absolute/path/to/bangladesh-law-mcp/server.py

GPT / ChatGPT (via MCP plugin / LangChain)

Same story — wire the stdio server into any MCP-aware orchestrator (LangChain's MCPAdapter, AutoGen, CrewAI, etc.). The tool surface described above is what your GPT agent will see.

Continue.dev / Cline / Roo Code

Add to your MCP config:

{
  "mcpServers": [
    {
      "name": "bangladesh-law",
      "command": "python",
      "args": ["/absolute/path/to/bangladesh-law-mcp/server.py"]
    }
  ]
}

🌐 Live Hosted Instance (Fly.io)

The server is deployed as an always-on Streamable HTTP endpoint on Fly.io. Any MCP client that supports remote servers can connect to:

https://bangladesh-law-mcp.fly.dev/mcp

A liveness check is available at:

https://bangladesh-law-mcp.fly.dev/healthz

Connecting a remote-capable client

VS Code / Cursor (Streamable HTTP):

{
  "servers": {
    "bangladesh-law": {
      "type": "streamableHttp",
      "url": "https://bangladesh-law-mcp.fly.dev/mcp"
    }
  }
}

Claude Desktop (if/when remote MCP is supported):

{
  "mcpServers": {
    "bangladesh-law": {
      "type": "streamableHttp",
      "url": "https://bangladesh-law-mcp.fly.dev/mcp"
    }
  }
}

Note: Most desktop MCP clients today only support stdio. The hosted endpoint is primarily for web-based agents, custom integrations, and future clients that support remote MCP. For local use, the stdio transport (above) remains the simplest option.

Deploying your own instance

  1. Install flyctl and sign up.

  2. Push this repo to GitHub.

  3. Create a Fly app:

    fly launch --no-deploy   # generates fly.toml, uses the Dockerfile
    
  4. Deploy:

    fly deploy --remote-only
    
  5. (Optional) Set up auto-deploy on push — add a FLY_API_TOKEN GitHub secret (created with fly tokens create deploy) and the included .github/workflows/deploy.yml will deploy on every push to main.


⚙️ Configuration

Env var Default Purpose
BLA_DATA_DIR <repo>/../Bangladesh-Legal-Acts-Dataset/Data/acts (or sibling) Where to find the act JSON files. Accepts the acts/ folder or its parent Data/ folder.
BLA_LOG_LEVEL INFO One of DEBUG, INFO, WARNING, ERROR. Logs go to stderr so the stdio JSON-RPC stream stays clean.
TRANSPORT stdio stdio for local clients, http for hosted/Streamable-HTTP mode (Fly.io, Docker).
HOST / PORT 0.0.0.0 / 8000 Bind address and port for the HTTP transport.

🛠 Development

Run a one-liner smoke test (no client needed):

python -c "import asyncio, server
async def m():
    out = await server.mcp.call_tool('get_statistics', {})
    print(out[1])
asyncio.run(m())"

Lint:

pyflakes server.py

The included GitHub Actions workflow (.github/workflows/ci.yml) lints and byte-compiles on Python 3.10, 3.11, and 3.12 for every push and PR.


🗂 Project layout

bangladesh-law-mcp/
├── .dockerignore
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   └── workflows/
│       ├── ci.yml
│       └── deploy.yml        # auto-deploy to Fly.io
├── .gitignore
├── Dockerfile                # multi-stage build (clones dataset with LFS)
├── LICENSE
├── README.md
├── SECURITY.md
├── fly.toml                  # Fly.io app config (always-on free tier)
├── pyproject.toml
├── requirements.txt
└── server.py                 # the entire MCP server

🙏 Thanks

The full credit list lives at the top of this README in the 💚 Credits section — please scroll up.


📄 License

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选