Official Python client SDK for Translation Helps MCP Server
Project description
translation-helps-mcp-client
Official Python client SDK for the Translation Helps MCP Server.
Installation
pip install translation-helps-mcp-client
Quick Start
import asyncio
from translation_helps import TranslationHelpsClient
# Import your AI provider's SDK
# from anthropic import Anthropic
async def main():
# Create a client instance
async with TranslationHelpsClient() as mcp_client:
# Get available tools and prompts
tools = await mcp_client.list_tools()
prompts = await mcp_client.list_prompts()
# Convert to your AI provider's format
available_tools = [{
"name": tool["name"],
"description": tool.get("description"),
"input_schema": tool.get("inputSchema"),
} for tool in tools]
# Note: Prompts provide instructions/templates - refer to your provider's docs for usage
# Send user query to AI WITH available tools
# The AI will decide which tools to call!
# response = await ai_client.messages.create(
# model="your-model",
# messages=[{"role": "user", "content": "What does John 3:16 say?"}],
# tools=available_tools
# )
# When AI requests a tool call, execute it via SDK:
# result = await mcp_client.call_tool(tool_name, tool_args)
# Feed result back to AI for final response
asyncio.run(main())
Usage with Context Manager
import asyncio
from translation_helps import TranslationHelpsClient
async def main():
async with TranslationHelpsClient() as client:
scripture = await client.fetch_scripture({
"reference": "John 3:16"
})
print(scripture)
asyncio.run(main())
API Reference
TranslationHelpsClient
Main client class for interacting with the Translation Helps MCP server.
Constructor
TranslationHelpsClient(options: Optional[ClientOptions] = None)
Options:
serverUrl: Optional[str]- Server URL (default: production server)timeout: Optional[int]- Request timeout in ms (default: 30000)headers: Optional[Dict[str, str]]- Custom headers
Methods
async connect() -> None
Initialize connection to the MCP server. Automatically called by convenience methods.
async close() -> None
Close the HTTP client connection.
async fetch_scripture(options: FetchScriptureOptions) -> str
Fetch Bible scripture text.
text = await client.fetch_scripture({
"reference": "John 3:16",
"language": "en",
"organization": "unfoldingWord",
"format": "text", # or "usfm"
"includeVerseNumbers": True
})
async fetch_translation_notes(options: FetchTranslationNotesOptions) -> Dict
Fetch translation notes for a passage.
notes = await client.fetch_translation_notes({
"reference": "John 3:16",
"language": "en",
"includeIntro": True,
"includeContext": True
})
async fetch_translation_questions(options: FetchTranslationQuestionsOptions) -> Dict
Fetch translation questions for a passage.
questions = await client.fetch_translation_questions({
"reference": "John 3:16",
"language": "en"
})
async fetch_translation_word(options: FetchTranslationWordOptions) -> Dict
Fetch translation word article by term or reference.
# By term
word = await client.fetch_translation_word({
"term": "love",
"language": "en"
})
# By reference (gets words used in passage)
words = await client.fetch_translation_word({
"reference": "John 3:16",
"language": "en"
})
async fetch_translation_word_links(options: FetchTranslationWordLinksOptions) -> Dict
Fetch translation word links for a passage.
links = await client.fetch_translation_word_links({
"reference": "John 3:16",
"language": "en"
})
async fetch_translation_academy(options: FetchTranslationAcademyOptions) -> Any
Fetch translation academy articles.
articles = await client.fetch_translation_academy({
"reference": "John 3:16",
"language": "en",
"format": "json" # or "markdown"
})
async get_languages(options: Optional[GetLanguagesOptions] = None) -> Dict
Get available languages and organizations.
languages = await client.get_languages({
"organization": "unfoldingWord"
})
async list_tools() -> List[MCPTool]
List all available MCP tools.
async list_prompts() -> List[MCPPrompt]
List all available MCP prompts.
async call_tool(name: str, arguments: Dict[str, Any]) -> Dict[str, Any]
Call any MCP tool directly.
async get_prompt(name: str, arguments: Optional[Dict[str, Any]] = None) -> Dict[str, Any]
Get a prompt template.
Examples
Basic Usage
import asyncio
from translation_helps import TranslationHelpsClient
async def main():
client = TranslationHelpsClient()
await client.connect()
# Fetch scripture
scripture = await client.fetch_scripture({
"reference": "John 3:16"
})
# Fetch comprehensive helps
notes = await client.fetch_translation_notes({
"reference": "John 3:16"
})
questions = await client.fetch_translation_questions({
"reference": "John 3:16"
})
words = await client.fetch_translation_word({
"reference": "John 3:16"
})
await client.close()
asyncio.run(main())
Error Handling
try:
scripture = await client.fetch_scripture({
"reference": "John 3:16"
})
except Exception as e:
print(f"Failed to fetch scripture: {e}")
Custom Server URL
client = TranslationHelpsClient({
"serverUrl": "https://your-custom-server.com/api/mcp",
"timeout": 60000 # 60 seconds
})
License
MIT
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file translation_helps_mcp_client-1.0.0.tar.gz.
File metadata
- Download URL: translation_helps_mcp_client-1.0.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe39e5ead80beb7770afcd17210b05e60e2d70edefd11ae11469e7b97b15b083
|
|
| MD5 |
1eab2008e9dc2cf7f4f6d3585114506b
|
|
| BLAKE2b-256 |
74c8b57316baf924670b4a43e978375139a94bb8bddaa4d988aeb69c7b25717c
|
File details
Details for the file translation_helps_mcp_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: translation_helps_mcp_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ba6f6302c9996d4087da8f5155b283358f165c646ce0ce484a72debef429cd3
|
|
| MD5 |
49c70109bca33c7b89e4803a6e708022
|
|
| BLAKE2b-256 |
4b56f883c1acf526baf35ac301da57ff05561b9b40118f625f3426db6a2c1e20
|