MCP server by SWBTS-Faith
Prayer Verse MCP Server
A Model Context Protocol (MCP) server that provides relevant Bible verses for prayer requests using semantic similarity matching and fetches verses directly from bible.com.
Overview
This project provides a prayer assistant that:
- Takes prayer requests as input
- Finds the most relevant Bible topic using semantic similarity
- Fetches matching Bible verses directly from bible.com
- Supports multiple Bible versions (ESV, NIV, KJV, NLT, etc.)
- Uses verse of the day as fallback when no specific verses are found
- Retrieves verse images from bible.com
- Can be used as both a standalone script and an MCP server
Features
- Semantic Matching: Uses SHA256-based embeddings to find relevant topics
- Live Bible Fetching: Fetches verses directly from bible.com in real-time
- Multiple Bible Versions: Supports ESV, NIV, KJV, NLT, NASB, NKJV, MSG, AMP, CSB, NRSV
- Verse of the Day: Automatically fetches daily verses from bible.com/verse-of-the-day
- Smart Fallbacks: Uses verse of the day when no specific verses match or user requests generic verses
- Image Integration: Retrieves verse images from bible.com Open Graph metadata
- MCP Compatible: Can be used as a Model Context Protocol server
- Standalone Mode: Can be run directly from command line
Prerequisites
- Python 3.9 or higher
- SQLite3
- Required Python packages (see Installation section)
Installation
-
Clone or download the project:
cd /path/to/prayer -
Install required Python packages:
pip3 install requests beautifulsoup4 Pillow -
Initialize the databases:
python3 create_verses_db.py python3 process_topics.py
Usage
Standalone Mode
Run the prayer assistant directly with a prayer request:
python3 my_verse_of_the_day.py "help me with anxiety and worry"
This will:
- Find the most relevant topic for your prayer request
- Ask for confirmation of the topic
- Find the most relevant Bible verse
- Generate two images with the verse text
- Display the results
MCP Server Mode
The MCP server can be used with MCP-compatible clients:
python3 mcp_tool.py
The server provides a tool called get_verse_of_the_day that takes a prayer request and optional Bible version, returning relevant verses with URLs and images.
MCP Configuration
For Claude Desktop
-
Locate your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Add the prayer verse server to your config:
{ "mcpServers": { "prayer-verse-server": { "command": "python3", "args": ["/Users/john/repos/prayer/mcp_server.py"], "cwd": "/Users/john/repos/prayer", "env": { "PYTHONPATH": "/Users/john/repos/prayer" } } } } -
Restart Claude Desktop to load the new MCP server.
Quick Setup (Automated)
Option 1: Standard MCP Setup
python3 setup_claude.py
Option 2: Enhanced MCP Setup with .mcp.json
python3 setup_claude_mcp.py
Both scripts will:
- Test the MCP server functionality
- Automatically add the server to your Claude Desktop config
- Provide next steps for usage
See CLAUDE_MCP_GUIDE.md for detailed Claude Desktop integration instructions.
For Other MCP Clients
Option 1: Standard MCP Server
python3 mcp_server.py
Option 2: FastMCP with HTTP Transport
# Requires Python 3.10+ and uv
uv run fastmcp run fastmcp_server.py --transport http
See FASTMCP_GUIDE.md for detailed FastMCP setup instructions.
MCP Server Features
- Proper MCP Protocol: Full implementation of MCP 2024-11-05 specification
- Tool Discovery: Automatically lists available tools
- Error Handling: Comprehensive error responses
- Async Support: Non-blocking request processing
Configuration Files
The project includes several configuration files for different MCP clients:
.mcp.json: Comprehensive MCP server metadata and configurationmcp_config.json: Standard MCP configuration formatclaude_desktop_config.json: Claude Desktop specific configurationmcp_manifest.json: MCP manifest with tool definitions
For most users: Use the automated setup script (python3 setup_claude.py)
For advanced users: Copy the relevant config to your MCP client's configuration directory
Using with Claude
Once configured, you can use the prayer verse server directly in Claude:
Example Claude prompts:
- "Find me a Bible verse for anxiety using the prayer verse tool"
- "Get the verse of the day in NIV version"
- "I'm struggling with fear, can you find a relevant Bible verse?"
Claude will automatically:
- Use the
get_verse_of_the_daytool - Pass your request as the
prayer_requestparameter - Optionally specify a Bible version
- Return formatted verse information with links to bible.com
Project Structure
prayer/
├── README.md # This file
├── mcp_server.py # Proper MCP server implementation
├── fastmcp_server.py # FastMCP server with HTTP transport
├── mcp_tool.py # Legacy MCP server (simplified)
├── my_verse_of_the_day.py # Standalone prayer assistant
├── create_verses_db.py # Script to create verses database
├── process_topics.py # Script to process topics database
├── test_bible_fetching.py # Test script for bible.com integration
├── setup_claude.py # Automated Claude Desktop setup script
├── run_fastmcp.py # FastMCP server runner script
├── pyproject.toml # Python project configuration
├── FASTMCP_GUIDE.md # FastMCP setup and usage guide
├── claude_desktop_config.json # Claude Desktop configuration
├── mcp_manifest.json # MCP manifest file
├── .mcp.json # MCP server metadata and configuration
├── claude_mcp_config.json # Claude Desktop specific configuration
├── mcp_config.json # Standard MCP configuration file
├── topics.db # SQLite database of Bible topics
├── topic-scores.txt # Topic quality scores
├── topic-votes.txt # Topic voting data
└── prayer/ # Sub-project directory
├── main.py
├── pyproject.toml
└── README.md
Database Schema
Topics Database (topics.db)
id: Primary keytopic: Topic nameosis: OSIS referencequality_score: Quality ratingstart_verse_id: Starting verse IDend_verse_id: Ending verse IDvotes: Number of votesembedding: SHA256 embedding for similarity matching
Verses Database (verses.db)
id: Primary keybook: Bible book namechapter: Chapter numberverse: Verse numbertext: Verse textembedding: SHA256 embedding for similarity matching
How It Works
- Input Processing: Takes a prayer request and optional Bible version as input
- Topic Matching: Uses SHA256 hash-based embeddings to find the most relevant topic from local database
- Verse Fetching: Maps topics to Bible references and fetches verses directly from bible.com
- Fallback Logic: If no specific verse is found, automatically fetches the verse of the day from bible.com/verse-of-the-day
- Image Retrieval: Extracts verse images from bible.com Open Graph metadata
- Output: Returns topic, verse text, reference, URL, and image URL
API Reference
MCP Tool: get_verse_of_the_day
Parameters:
prayer_request(string): Your prayer request or concernbible_version(string, optional): Bible version (default: "ESV")
Returns:
topic: The most relevant Bible topicreference: Bible verse reference (e.g., "John 3:16")verse_text: The verse textbible_version: The Bible version usedurl: Direct link to the verse on bible.comimage_url: URL of the verse image (if available)
Example MCP Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_verse_of_the_day",
"arguments": {
"prayer_request": "I'm struggling with fear and anxiety",
"bible_version": "NIV"
}
}
}
Customization
Adding More Verses
Edit create_verses_db.py to add more Bible verses:
verses = [
("John", 3, 16, "For God so loved the world..."),
("Psalm", 23, 1, "The LORD is my shepherd..."),
# Add your verses here
]
Adding More Topics
Add topics to topic-scores.txt and topic-votes.txt, then run:
python3 process_topics.py
Customizing Images
Modify the create_image_with_text function in both scripts to:
- Change image dimensions
- Modify font size and type
- Adjust background colors
- Change text positioning
Troubleshooting
Common Issues
- "No module named 'PIL'": Install Pillow with
pip3 install Pillow - Database not found: Run
create_verses_db.pyandprocess_topics.pyfirst - Permission errors: Ensure the script has write permissions in the directory
- Font issues: The script will fall back to default font if Arial.ttf is not available
Debug Mode
Add debug prints to see the similarity scores:
print(f"Similarity for topic '{topic}': {similarity}")
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
License
This project is open source. Please check the license file for details.
Support
For issues and questions:
- Check the troubleshooting section
- Review the project structure
- Ensure all dependencies are installed
- Verify database files are properly initialized
Version History
-
v2.0.0: Major update with bible.com integration
- Live verse fetching from bible.com
- Multiple Bible version support (ESV, NIV, KJV, NLT, etc.)
- Verse of the day fallback functionality
- Image retrieval from bible.com metadata
- Enhanced error handling and fallbacks
-
v1.0.0: Initial release with MCP server and standalone functionality
- Basic semantic matching using SHA256 embeddings
- Local image generation with PIL
- SQLite database integration