Bayān for assistants and developers

Bayān for assistants and developers

Bayān's library is open to chat assistants and to your code. It is read-only, free and needs no account.

Connect an assistant

Paste this address where your assistant adds a remote MCP server.

https://bayanlibrary.com/mcp
  • Claude

    Open Customize > Connectors, choose + Add, then Add custom connector. Enter the address and choose Add. If Claude asks how to sign in, choose No sign in. On a Team or Enterprise plan, an owner adds it under Organization settings > Connectors.

  • ChatGPT

    On the web, open chatgpt.com/plugins, select +, then Add custom MCP server. Enter the address, choose No authentication, and create the plugin. Install it, then type @ in a message to use it. What you see depends on your plan and your workspace settings.

  • Claude Code

    Run these commands in a terminal. The second one lists your servers and shows whether Bayān is connected.

    claude mcp add --transport http bayan https://bayanlibrary.com/mcp
    claude mcp list
  • Cursor

    Add the server to the global file (first line) or to the project file (second line), as in the block below. Save, then check in Customize, in the sidebar, that the server is enabled.

    ~/.cursor/mcp.json
    .cursor/mcp.json
    
    {
      "mcpServers": {
        "bayan": { "url": "https://bayanlibrary.com/mcp" }
      }
    }
  • VS Code

    Run MCP: Add Server from the Command Palette, choose HTTP and paste the address.

  • Any other assistant

    Paste the address where it adds a remote MCP server. No sign-in is needed.

The four tools

Each tool only reads. Every text comes with its reference, its edition and its page on Bayān.

Tool and parametersWhat it returns
searchquery, kinds, works, language, limitPassages, hadith and works that match your words, each with its reference, a snippet, its citation and its page.
get_passageref, context, languageOne passage by its reference: the Arabic text, its stored translation, its citation, the edition and up to 3 neighbouring passages on each side.
get_versesura, aya, end_aya, languageOne verse of the Quran or a run of up to 10 verses: the Arabic text, the translation with its translator, and references to the tafsir passages that comment on them.
lookup_workquery, languageUp to 5 works of the library by title, author or slug. Pass a slug to search to read one work only.

Call it from your code

The same four operations are plain JSON over GET, with the same parameters and no key. The answers below are real, shortened with … where a text is long.

Search

Request

curl -G "https://bayanlibrary.com/api/v1/open/search" \
  --data-urlencode "query=إنما الأعمال بالنيات" \
  --data-urlencode "kinds=hadith" \
  --data-urlencode "works=openiti-0256Bukhari.Sahih.JK000110-ara1" \
  --data-urlencode "limit=1"

Response

{
  "query": "إنما الأعمال بالنيات",
  "semantic": true,
  "hits": [
    {
      "kind": "hadith",
      "ref": "uyFCVK9qT6CuznfB_Rzrww",
      "title": "Sahih al-Bukhari 1",
      "snippet": "رسول الله صلى الله عليه وسلم يقول\n\nإنما الأعمال بالنيات وإنما لكل امرئ ما نوى …",
      "citation": {
        "work": "Sahih al-Bukhari",
        "work_ar": "صحيح البخاري",
        "author": "محمد بن إسماعيل البخاري",
        "volume": 1,
        "page_start": 3,
        "page_end": 3,
        "number": "Sahih al-Bukhari 1",
        "edition": "تحقيق د. مصطفى ديب البغا، دار ابن كثير …",
        "reference": "Sahih al-Bukhari 1"
      },
      "url": "https://bayanlibrary.com/en/h/uyFCVK9qT6CuznfB_Rzrww",
      "work": null
    }
  ]
}

Read a passage with its neighbours

Request

curl "https://bayanlibrary.com/api/v1/open/passages/uyFCVK9qT6CuznfB_Rzrww?context=1&language=en"

Response

{
  "ref": "uyFCVK9qT6CuznfB_Rzrww",
  "kind": "hadith",
  "text": "1 حدثنا الحميدي عبد الله بن الزبير قال … إنما الأعمال بالنيات وإنما لكل امرئ ما نوى …",
  "translation": {
    "text": "1 Al-Humaydi Abd Allah ibn al-Zubayr related to us … Actions are only by intentions, and each man has only what he intended. …",
    "language": "en",
    "translator": null,
    "machine_translated": true,
    "translation_verified": false
  },
  "citation": { … },
  "work": {
    "slug": "openiti-0256Bukhari.Sahih.JK000110-ara1",
    "title": "Sahih al-Bukhari",
    "title_ar": "صحيح البخاري",
    "author": "al-Bukhari",
    "era": "d. 256 AH / 870 CE",
    "kind": "hadith"
  },
  "attribution": {
    "edition": "تحقيق د. مصطفى ديب البغا، دار ابن كثير …",
    "details": {
      "edition_basis": "collated",
      "pagination_basis": "digital_source",
      "numbering_scheme": "bugha",
      "digital_source": "[email protected]",
      "editor": "د. مصطفى ديب البغا",
      "publisher": "دار ابن كثير، اليمامة",
      "place": "بيروت",
      "year_h": 1407,
      "year_g": 1987,
      "printing": "الثالثة"
    },
    "source_url": null
  },
  "url": "https://bayanlibrary.com/en/h/uyFCVK9qT6CuznfB_Rzrww",
  "before": [
    { "ref": "KExnPCFhSsWMx98zAbOChg", "text": "بسم الله الرحمن الرحيم …", "citation": { … } }
  ],
  "after": [
    { "ref": "wii1k3vDSJmApVRY01pRRQ", "text": "2 حدثنا عبد الله بن يوسف قال أخبرنا مالك …", "citation": { … } }
  ]
}

Read a verse

Request

curl "https://bayanlibrary.com/api/v1/open/quran/2/255?language=en"

Response

{
  "sura": 2,
  "aya": 255,
  "end_aya": 255,
  "verses": [
    {
      "sura": 2,
      "aya": 255,
      "text": "ٱللَّهُ لَآ إِلَٰهَ إِلَّا هُوَ ٱلْحَىُّ ٱلْقَيُّومُ …",
      "translation": {
        "text": "Allah! There is no deity save Him, the Alive, the Eternal. …",
        "translator": "Mohammed Marmaduke William Pickthall"
      }
    }
  ],
  "translation_credit": "Mohammed Marmaduke William Pickthall",
  "text_source": "Tanzil · tanzil.net",
  "tafsirs": [
    {
      "ref": "oR-erqc7Sb-PpZe3u8fnuw",
      "url": "https://bayanlibrary.com/en/p/oR-erqc7Sb-PpZe3u8fnuw",
      "citation": {
        "work": "Tafsir al-Jalalayn",
        "work_ar": "تفسير الجلالين",
        "author": "جلال الدين المحلي وجلال الدين السيوطي",
        "volume": 1,
        "page_start": 56,
        "page_end": 56,
        "number": null,
        "edition": "دار الحديث، القاهرة، الأولى",
        "reference": "Tafsir al-Jalalayn, 1:56"
      },
      "first_aya": 255,
      "last_aya": 255
    },
    …
  ],
  "url": "https://bayanlibrary.com/en/c/2-255"
}

Find a work

Request

curl -G "https://bayanlibrary.com/api/v1/open/works" --data-urlencode "query=jalalayn"

Response

{
  "query": "jalalayn",
  "works": [
    {
      "slug": "openiti-0911Suyuti.TafsirJalalayn.JK000818-ara1",
      "title": "Tafsir al-Jalalayn",
      "title_ar": "تفسير الجلالين",
      "author": "al-Mahalli & al-Suyuti",
      "era": "d. 911 AH / 1505 CE",
      "kind": "quran"
    }
  ]
}

Limits

  • Each address may make 60 requests a minute. Past that the answer is 429: wait a minute.
  • A search returns up to 10 hits, a query is 2 to 200 characters, and a search may name up to 20 works. A passage comes with up to 3 neighbours on each side. A run of verses is at most 10.
  • A search finds by meaning within a daily allowance per address. Past it, it finds by words only, and the answer says so with "semantic": false.

How to cite

Every answer carries what a citation needs.

  • Name the work, the author, the volume and page or the hadith number, and give the passage url.
  • Quote verses and hadith exactly as returned. Never complete or paraphrase them inside quotation marks.
  • A translation is the library's own machine rendering unless a translator is credited.
  • Bayān is a library. It gives texts and where they are, and gives no ruling.

What is not served

The open library serves the shared library: classical works in Arabic with their stored translations, and the Quran. It does not serve fatwas, narrator records, private bases or anything that belongs to an account, and it states no hadith grade.

For assistants that read instructions

A skill file tells an assistant when to use the library, how to search it and how to cite it. Save it as bayan-library/SKILL.md in your assistant's skills folder. The full reference is a single text file.

Skill fileFull reference