Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/seed-bible-mcp/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Free Use Bible MCP Server

An [MCP](https://modelcontextprotocol.io) server that exposes the [Free Use Bible API](https://bible.helloao.org) (BSB, WEB, Hebrew WLC, SBL Greek NT) through four tools:
An [MCP](https://modelcontextprotocol.io) server that exposes the [Free Use Bible API](https://bible.helloao.org) (BSB, WEB, Hebrew WLC, SBL Greek NT) through five tools:

- `getBibleReference` — turns a reference such as `John 3:16` or `Gen 1:1-3 WEB` into a passage result id.
- `fetchChapter` — returns the passage text for a result id from `getBibleReference`.
- `fetchVerse` — returns the text of a verse or verse range within one chapter, for a reference such as `John 3:16` or `Gen 1:1-3 WEB`.
- `getSeedBibleLink` — returns a link to the chapter on [Seed Bible](https://seedbible.org) (`https://seedbible.org/{translationId}/{bookId}/{chapter}`) for a reference such as `John 3:16` or `Ps 23 WEB`.
- `listTranslations` — lists the available translations, optionally filtered by language (e.g. `spa` or `Spanish`) and by name.

`getBibleReference` and `fetchVerse` take an optional `translation` parameter that accepts any translation id from `listTranslations` (e.g. `spa_rv1909`). Without it, the translation is picked from the reference (BSB, WEB, WLC, or SBL), defaulting to BSB.
`getBibleReference`, `fetchVerse`, and `getSeedBibleLink` take an optional `translation` parameter that accepts any translation id from `listTranslations` (e.g. `spa_rv1909`). Without it, the translation is picked from the reference (BSB, WEB, WLC, or SBL), defaulting to BSB.

The server speaks the Streamable HTTP transport at `/mcp` and runs statelessly, so the same code runs on Node.js and on Cloudflare Workers.

Expand Down
13 changes: 13 additions & 0 deletions packages/seed-bible-mcp/src/bible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ export function chapterUrl(
return `${apiBase}/${translation}/${book}/${chapter}.json`;
}

export const SEED_BIBLE_BASE = 'https://seedbible.org';

/**
* Builds a link to a chapter on Seed Bible, e.g. https://seedbible.org/BSB/JHN/3
*/
export function seedBibleUrl(
translation: string,
book: string,
chapter: number
): string {
return `${SEED_BIBLE_BASE}/${encodeURIComponent(translation)}/${encodeURIComponent(book)}/${chapter}`;
}

export function passageTitle(
translation: string,
book: string,
Expand Down
43 changes: 43 additions & 0 deletions packages/seed-bible-mcp/src/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
parseResultId,
resolveTranslationId,
passageTitle,
seedBibleUrl,
} from './bible.js';

export interface BibleMcpOptions {
Expand Down Expand Up @@ -69,6 +70,7 @@ export function createBibleMcpServer(options: BibleMcpOptions = {}): McpServer {
'Use getBibleReference() to interpret a user query into a Bible passage result. ' +
'Then use fetchChapter() to retrieve the full passage text. ' +
'To get the text of a verse or verse range directly, use fetchVerse(). ' +
'To link a reader to a chapter on Seed Bible (seedbible.org), use getSeedBibleLink(). ' +
'Use listTranslations() to find available translations by language or name, then pass a translation id as the translation parameter. ' +
'References can name BSB, WEB (ENGWEBP), Hebrew WLC (heb_wlc), or SBL Greek NT (grc_sbl) directly; other translations need the translation parameter.',
// The default Ajv validator compiles schemas with `new Function`,
Expand Down Expand Up @@ -205,6 +207,47 @@ export function createBibleMcpServer(options: BibleMcpOptions = {}): McpServer {
}
);

server.registerTool(
'getSeedBibleLink',
{
description:
'Get a link to a Bible chapter on Seed Bible (https://seedbible.org/{translationId}/{bookId}/{chapter}), from a reference such as "John 3" or "Gen 1:1-3 WEB".',
inputSchema: {
reference: z
.string()
.describe(
'A chapter, verse, or verse range reference, optionally followed by a translation, e.g. "John 3", "John 3:16" or "Ps 23 WEB". Seed Bible links point to the whole chapter.'
),
translation: translationParam,
},
},
async ({ reference, translation: requestedTranslation }) => {
const translationId = requestedTranslation
? await resolveTranslationId(apiBase, requestedTranslation)
: undefined;
if (translationId === null) {
return unknownTranslation(requestedTranslation!);
}
const ref = await parseQueryToRef(
apiBase,
reference,
translationId
);
if (!ref) {
return error(
`Could not interpret "${reference}" as a Bible reference.`
);
}

const [translation, book, chapter, verses] = ref;
return json({
title: passageTitle(translation, book, chapter, verses),
url: seedBibleUrl(translation, book, chapter),
metadata: { translation, book, chapter, verses },
});
}
);

server.registerTool(
'listTranslations',
{
Expand Down
Loading