Case Study Generator MCP Server
Processes documents, analyzes GitHub repositories, and researches companies using local Gemma3 AI to extract structured business insights for generating compelling case studies.
README
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:e4b
Verify Ollama is running:
ollama list
Installation
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.txt
Option 2: Using Poetry
# Clone the repository
git clone <repository-url>
cd case-study-mcp
# Install with Poetry
poetry install
poetry shell
Configuration
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=INFO
GitHub 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_reposcope - Add 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.py
The 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.py
Health Check
The server provides a health check resource:
URI: health://status
Returns status of all components including Gemma3, GitHub API, and processors.
Troubleshooting
Common Issues
1. Ollama Connection Error
Error: Failed to connect to Ollama
Solution: Ensure Ollama is running (ollama serve) and the model is pulled (ollama pull gemma3n:e4b).
2. GitHub Rate Limit
Error: GitHub API rate limit exceeded
Solution: Add a GitHub token to your .env file for higher limits.
3. Model Not Found
Error: Model ollama3n:4b not found
Solution: 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.py
Project 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 tracking
Development
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.md - Open an issue with detailed error logs and steps to reproduce
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.