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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。