Analyzes GitHub repositories to extract business value, technical benefits, tech stack information, and key features for case study generation.
Retrieves documents from Google Drive for processing and saves generated case studies back to Google Drive as part of the document workflow.
Uses Ollama with Gemma3 8B-Instruct model for local LLM processing to extract structured business insights from documents and repositories.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Case Study Generator MCP Serveranalyze github.com/acme/ecommerce-platform for business insights"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Case Study Generator MCP Server
A Model Context Protocol (MCP) server that processes document content and GitHub repositories with Gemma3 to extract structured business insights for case study generation.
Overview
This MCP server provides three main capabilities:
Document Processing - Extract business insights from documents (proposals, case studies, contracts)
GitHub Repository Analysis - Analyze repositories for business value and technical benefits
Company Research - Real-time web research using Tavily + AI analysis for company insights
The server uses Gemma3 8B-Instruct via Ollama for local LLM processing, ensuring privacy and control over your data.
Architecture
User → Claude Desktop → Google Drive (retrieve) → MCP Server (process) → Claude Desktop (reason & write) → Google Drive (save)Claude Desktop: Handles document retrieval, reasoning, writing, and saving
MCP Server: Processes data with Gemma3 and returns structured insights
Ollama/Gemma3: Local LLM for business analysis and insight extraction
Prerequisites
Required Software
Python 3.11+ - Programming language runtime
Ollama - Local LLM inference server
Gemma3 Model - Language model for analysis
Install Ollama
Visit ollama.ai and install for your platform.
After installation, pull the Gemma3 model:
ollama pull gemma3n:e4bVerify Ollama is running:
ollama listInstallation
Option 1: Using venv (Recommended)
# Clone the repository
git clone <repository-url>
cd case-study-mcp
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtOption 2: Using Poetry
# Clone the repository
git clone <repository-url>
cd case-study-mcp
# Install with Poetry
poetry install
poetry shellConfiguration
Environment Variables (Optional)
Create a .env file in the project root:
# GitHub API token for higher rate limits (optional)
GITHUB_TOKEN=your_github_token_here
# Tavily API key for web search company research (optional)
TAVILY_API_KEY=your_tavily_api_key_here
# Ollama configuration
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=gemma3n:e4b
# Logging level
LOG_LEVEL=INFOGitHub Token Setup
For better GitHub API rate limits, create a personal access token:
Go to GitHub Settings → Developer settings → Personal access tokens
Generate a new token with
public_reposcopeAdd to
.envfile or set as environment variable
Tavily API Setup (For Company Research)
For real company research capabilities, get a Tavily API key:
Sign up at tavily.com
Get your API key from the dashboard
Add
TAVILY_API_KEY=your_key_hereto.envfile
Note: Without Tavily, company research will use LLM pattern matching only.
Usage
Starting the MCP Server
# Run the server
python mcp_server.pyThe server communicates via stdio and will wait for MCP protocol messages.
Integration with Claude Desktop
Add to your Claude Desktop MCP configuration:
{
"mcpServers": {
"case-study-mcp": {
"command": "python",
"args": ["/path/to/case-study-mcp/mcp_server.py"],
"cwd": "/path/to/case-study-mcp"
}
}
}Example Usage in Claude Desktop
User: "Create a case study for TechCorp using github.com/example/ecommerce-platform and my retail proposal document"
Claude: "I'll analyze the repository and document to create your case study..."
[Claude uses MCP tools:]
1. process_document_text(text="retail proposal content", doc_type="proposal")
2. analyze_github_repo(repo_url="github.com/example/ecommerce-platform")
3. research_company_basic(company_name="TechCorp")
[Claude synthesizes results into compelling case study]MCP Tools
1. process_document_text
Extract business insights from document content.
Parameters:
text(required): Document content textdoc_type(optional): Type of document - "proposal", "case_study", "contract", or "general"
Returns:
{
"success": true,
"document_type": "proposal",
"insights": {
"challenges": ["Legacy platform scalability issues"],
"solutions": ["Microservices architecture"],
"metrics": ["90% improvement in load times"],
"context": "Mid-market e-commerce company",
"key_stakeholders": ["CTO", "Engineering Team"],
"timeline": "6-month implementation"
}
}2. analyze_github_repo
Analyze GitHub repository for business value.
Parameters:
repo_url(required): GitHub repository URL
Returns:
{
"success": true,
"repository": {
"url": "github.com/example/repo",
"name": "example/ecommerce-platform",
"tech_stack": ["Python", "React", "Docker"],
"stars": 1250,
"language": "Python"
},
"business_analysis": {
"problem_solved": "Scalable e-commerce platform",
"key_features": ["Microservices", "Redis caching"],
"business_value": "Enables 10x traffic scaling",
"technical_benefits": ["Horizontal scaling", "Fault tolerance"],
"target_users": "Mid to large-scale e-commerce businesses",
"scalability": "Designed for high-traffic peaks",
"integration_points": ["CRM systems", "Payment gateways"]
}
}3. research_company_basic
Real company research using web search + AI analysis.
Parameters:
company_name(required): Name of the companycompany_context(optional): Additional context about the company
Returns:
{
"success": true,
"company": {
"name": "TechCorp",
"profile": "Technology company specializing in...",
"industry": "Technology",
"business_model": "SaaS"
},
"insights": {
"challenges": ["Digital transformation needs"],
"opportunities": ["Cloud migration potential"],
"technology_needs": ["Scalable infrastructure"]
},
"web_search_used": true,
"search_sources": [
{"title": "TechCorp - About Us", "url": "https://techcorp.com/about"},
{"title": "TechCorp on LinkedIn", "url": "https://linkedin.com/company/techcorp"}
]
}Testing
Manual Testing
Test each tool individually:
# Test document processing
echo '{"text": "Sample proposal text", "doc_type": "proposal"}' | python test_document.py
# Test GitHub analysis
echo '{"repo_url": "github.com/microsoft/vscode"}' | python test_github.py
# Test company research
echo '{"company_name": "Microsoft"}' | python test_company.pyHealth Check
The server provides a health check resource:
URI: health://statusReturns status of all components including Gemma3, GitHub API, and processors.
Troubleshooting
Common Issues
1. Ollama Connection Error
Error: Failed to connect to OllamaSolution: Ensure Ollama is running (ollama serve) and the model is pulled (ollama pull gemma3n:e4b).
2. GitHub Rate Limit
Error: GitHub API rate limit exceededSolution: Add a GitHub token to your .env file for higher limits.
3. Model Not Found
Error: Model ollama3n:4b not foundSolution: Pull the model with ollama pull ollama3n:4b.
4. Import Errors
ImportError: No module named 'mcp'Solution: Install dependencies with pip install -r requirements.txt.
5. Company Research Limited
Warning: Tavily not configured. Company research will use LLM patterns only.Solution: Get a Tavily API key from tavily.com and add to .env file.
Performance Optimization
Memory Usage: Ollama3n 4B requires ~4-6GB RAM for optimal performance
Processing Time: Document processing typically takes 5-15 seconds
Concurrent Requests: Server handles one request at a time by design
Logging
Enable debug logging:
export LOG_LEVEL=DEBUG
python mcp_server.pyProject Structure
case-study-mcp/
├── mcp_server.py # Main MCP server entry point
├── gemma3_client.py # Gemma3/Ollama client wrapper
├── document_processor.py # Document analysis processor
├── github_analyzer.py # GitHub repository analyzer
├── company_researcher.py # Company research processor
├── prompts.py # Gemma3 prompt templates
├── pyproject.toml # Poetry configuration
├── requirements.txt # Pip dependencies
├── README.md # This file
├── project_config.md # Project specification
└── workflow_state.md # Development workflow trackingDevelopment
Contributing
Fork the repository
Create a feature branch
Make changes with tests
Submit a pull request
Code Style
Use Black for formatting:
black .Use isort for imports:
isort .Use mypy for type checking:
mypy .
License
MIT License - see LICENSE file for details.
Support
For issues and questions:
Check the troubleshooting section above
Review the project configuration in
project_config.mdOpen an issue with detailed error logs and steps to reproduce