An MCP server that generates company intelligence reports. Accessible via REST API using FastMCP.
# 1. Navigate to directory
cd examples/mcp_server
# 2. Install dependencies
uv add fastmcp tavily-python
# 3. Set environment variables
cp .env.example .env
# Set TAVILY_API_KEY and OPENAI_API_KEY in .env
# 4. Start server
uv run python server.py
# 5. Run workflow only (without server)
uv run python workflow.py "Treasure Data"
# 6. Client example
uv run python client_example.py "Treasure Data"This MCP server executes the following workflow using a company name as input to generate an intelligence report for business meeting preparation:
Search → Curate → Write → Critique → Output
↑ ↓
└──── Feedback Loop ─┘
-
Search: Collect information from multiple sources using Tavily API
- Company news
- Industry trends
- Company profile
- Competitor information
-
Curate: Filter and organize search results with LLM
- Relevance scoring
- Deduplication
- Category classification
-
Write: Generate intelligence report with LLM
- Executive summary
- Detailed sections
- Key talking points for meetings
-
Critique: Evaluate the report with LLM
- Accuracy, completeness, relevance, structure, source quality
- Sends back to Write if criteria not met (max 3 iterations)
-
Output: Export final report in Markdown format
cd examples/mcp_server
cp .env.example .env
# Edit .env file to set your API keysTAVILY_API_KEY=your-tavily-api-key
OPENAI_API_KEY=your-openai-api-keyLANGFUSE_PUBLIC_KEY=your-langfuse-public-key
LANGFUSE_SECRET_KEY=your-langfuse-secret-key
LANGFUSE_HOST=http://localhost:3000
ENABLE_TRACING=trueGRAFLOW_LLM_MODEL=gpt-5-mini # Default model
WRITER_MODEL=gpt-5-mini # Model for Writer
CRITIQUE_MODEL=gpt-5-mini # Model for Critique
MAX_CRITIQUE_ITERATIONS=3 # Maximum revision count
MAX_SEARCH_RESULTS=10 # Maximum search results
MCP_SERVER_HOST=0.0.0.0 # Server host
MCP_SERVER_PORT=9100 # Server port# Navigate to directory
cd examples/mcp_server
# Start server
uv run python server.py
# Or start with uvicorn
uv run uvicorn server:app --host 0.0.0.0 --port 9100cd examples/mcp_server
uv run python workflow.py "Treasure Data"| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/config |
GET | Get current configuration |
/mcp |
POST | MCP SSE endpoint |
Generate a comprehensive intelligence report for a company.
Input:
{
"company_name": "Treasure Data",
"enable_tracing": true
}Output:
{
"company_name": "Treasure Data",
"report_markdown": "# Treasure Data Intelligence Report\n...",
"executive_summary": "...",
"key_takeaways": ["Point 1", "Point 2"],
"sections": [...],
"sources_count": 15,
"iterations": 2,
"generated_at": "2024-01-15T10:30:00",
"critique_score": 0.85
}Search for the latest news about a company (lightweight version).
Input:
{
"company_name": "Salesforce",
"max_results": 10
}Search for industry trends.
Input:
{
"company_name": "Sony",
"industry": "Electronics",
"max_results": 10
}cd examples/mcp_server
# After starting the server, in another terminal
uv run python client_example.py "Treasure Data"
# News search only
uv run python client_example.py "Salesforce" --action news
# Industry trends search
uv run python client_example.py "Sony" --action trends# Health check
curl http://localhost:9100/health
# Generate report (via SSE)
curl http://localhost:9100/mcpimport httpx
# Health check
response = httpx.get("http://localhost:9100/health")
print(response.json())
# Check configuration
response = httpx.get("http://localhost:9100/config")
print(response.json())You can use this MCP server from Claude Code.
MCP servers can be configured in three scopes:
| Scope | Storage Location | Use Case |
|---|---|---|
local |
~/.claude.json (under project path) |
Personal use, current project only (default) |
project |
.mcp.json at project root |
Team sharing (commit to version control) |
user |
~/.claude.json |
Available across all projects |
First, start the server:
cd examples/mcp_server && uv run python server.pyIn another terminal, register MCP:
# Local scope (default) - current project only
claude mcp add --transport http company-intel http://localhost:9100/mcp
# Project scope - shared with team (saved to .mcp.json)
claude mcp add --transport http --scope project company-intel http://localhost:9100/mcp
# User scope - available across all projects
claude mcp add --transport http --scope user company-intel http://localhost:9100/mcpCreate .mcp.json in your project root (commit to version control):
{
"mcpServers": {
"company-intelligence": {
"command": "uv",
"args": ["run", "python", "server.py"],
"cwd": "./examples/mcp_server",
"env": {
"TAVILY_API_KEY": "${TAVILY_API_KEY}",
"OPENAI_API_KEY": "${OPENAI_API_KEY}"
}
}
}
}Environment variables can be referenced using ${VAR} format (actual values taken from user's environment).
# List registered servers
claude mcp list
# Get server details
claude mcp get company-intel
# Remove a server
claude mcp remove company-intelRestart Claude Code and use the /mcp command to check connection status.
Workflow execution can be traced with Langfuse:
- Create an account at Langfuse Cloud
- Create a project and obtain API keys
- Set environment variables in the
.envfile - After starting the server, view traces in the Langfuse dashboard
Traces include:
- Total workflow execution time
- Execution time for each task (search, curate, write, critique)
- LLM call details (prompts, responses, token counts)
- Errors and stack traces
examples/mcp_server/
├── __init__.py # Module initialization
├── config.py # Configuration management (dotenv support)
├── workflow.py # Graflow workflow definition
├── server.py # FastMCP server
├── client_example.py # Client example
├── .env.example # Environment variable template
├── claude_mcp_config.json # Claude Code MCP config example
├── README.md # This file
├── README_ja.md # Japanese README
└── agents/
├── __init__.py
├── search.py # Search agent (Tavily)
├── curator.py # Curation agent (LLM)
├── writer.py # Writer agent (LLM)
└── critique.py # Critique agent (LLM)
graflow
fastmcp
tavily-python
litellm
python-dotenv
httpx
uvicorn
pydantic
Installation:
uv add fastmcp tavily-python python-dotenvApache License 2.0