Skip to content

Commit ec54fe7

Browse files
committed
feat: Add Company Intelligence MCP Server with report generation and news search capabilities
- Implemented WriterAgent for generating company intelligence reports. - Created configuration management for the MCP server. - Developed a FastMCP server exposing tools for generating reports and searching news. - Added workflow for company intelligence including search, curation, writing, and critique. - Introduced example client for interacting with the MCP server. - Configured server settings and health check endpoints. - Added JSON configuration for server setup.
1 parent 623216c commit ec54fe7

16 files changed

Lines changed: 2800 additions & 3 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Thumbs.db
7575
credentials/
7676
.cache/
7777
.serena/
78+
.mcp.json
7879

7980
# Project specific
8081
examples/gpt_newspaper/backend/outputs/

examples/README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Welcome to the Graflow examples! This directory contains progressive examples to
44

55
## 🎉 What's Available
66

7-
**51 comprehensive, production-ready examples** covering:
7+
**54 comprehensive, production-ready examples** covering:
88
-**Task Basics** - Define and execute tasks with parameters
99
-**Workflow Orchestration** - Sequential and parallel task composition
1010
-**Data Flow** - Channels, typed communication, and result storage
@@ -18,6 +18,7 @@ Welcome to the Graflow examples! This directory contains progressive examples to
1818
-**Human-in-the-Loop** - Interactive workflows with human feedback
1919
-**Checkpoint/Resume** - Workflow state persistence and fault tolerance
2020
-**Prompt Management** - YAML and Langfuse prompt template management
21+
-**MCP Server Integration** - Expose workflows as MCP tools with FastMCP
2122

2223
All examples include detailed documentation, real-world use cases, and hands-on experiments!
2324

@@ -200,6 +201,20 @@ Manage LLM prompts with YAML files or Langfuse cloud:
200201

201202
**Note**: Langfuse examples require `langfuse` package and credentials.
202203

204+
### ✅ mcp_server - MCP Server Integration
205+
**Status**: Complete | **Difficulty**: Advanced
206+
207+
Expose Graflow workflows as MCP (Model Context Protocol) tools:
208+
- FastMCP server with REST API endpoints
209+
- Multi-agent workflow with feedback loops (Search → Curate → Write → Critique)
210+
- Company intelligence report generation
211+
- Langfuse tracing integration
212+
- Claude Code MCP configuration
213+
214+
[View MCP server example →](mcp_server/)
215+
216+
**Note**: Requires `fastmcp`, `tavily-python`, and API keys. See directory README for setup.
217+
203218
## Learning Path
204219

205220
**Recommended order for beginners:**
@@ -352,6 +367,7 @@ Some examples require additional packages:
352367
- **Docker examples**: `docker`
353368
- **Visualization**: `grandalf`, `pygraphviz`, `requests`
354369
- **LLM integration**: `litellm` (for LLMClient), `google-adk` (for agents)
370+
- **MCP server**: `fastmcp`, `tavily-python`, `python-dotenv`
355371

356372
## Running Examples
357373

@@ -475,6 +491,18 @@ examples/
475491
│ ├── workflow_with_prompts.py
476492
│ └── prompts/ # Sample YAML prompts
477493
494+
├── mcp_server/ # MCP Server Integration
495+
│ ├── README.md # Setup and usage documentation
496+
│ ├── server.py # FastMCP server
497+
│ ├── workflow.py # Graflow workflow definition
498+
│ ├── client_example.py # Client usage example
499+
│ ├── config.py # Configuration management
500+
│ └── agents/ # Multi-agent implementation
501+
│ ├── search.py # Tavily search agent
502+
│ ├── curator.py # Content curation agent
503+
│ ├── writer.py # Report writer agent
504+
│ └── critique.py # Quality critique agent
505+
478506
└── README.md # This file
479507
```
480508

@@ -500,6 +528,7 @@ examples/
500528
| 12_hitl | ✅ Complete | 4/4 | Human-in-the-Loop workflows |
501529
| 13_checkpoints | ✅ Complete | 4/4 | Checkpoint/Resume for fault tolerance |
502530
| 14_prompt_management | ✅ Complete | 3/3 | Prompt template management |
531+
| mcp_server | ✅ Complete | 3/3 | MCP server with multi-agent workflow |
503532

504533
## Troubleshooting
505534

@@ -563,7 +592,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md) for details.
563592

564593
All planned examples are now complete! 🎉
565594

566-
The **51 examples** provide comprehensive coverage from basic concepts to AI-powered production applications. You can now:
595+
The **54 examples** provide comprehensive coverage from basic concepts to AI-powered production applications. You can now:
567596

568597
1. **Build Production Workflows** - Use patterns from 08_real_world
569598
2. **Scale with Redis** - Deploy distributed workflows from 05_distributed
@@ -576,6 +605,7 @@ The **51 examples** provide comprehensive coverage from basic concepts to AI-pow
576605
9. **Add Human Feedback** - Build interactive workflows with HITL from 12_hitl
577606
10. **Implement Fault Tolerance** - Build resilient workflows with checkpoint/resume from 13_checkpoints
578607
11. **Manage Prompts** - Use YAML or Langfuse for prompt templates from 14_prompt_management
608+
12. **Expose as MCP Tools** - Serve workflows via MCP protocol from mcp_server
579609

580610
Additional examples may be added based on community feedback and emerging use cases.
581611

@@ -607,7 +637,7 @@ uv run pytest tests/tutorial/test_hitl.py -v
607637

608638
## API Notes
609639

610-
**Important**: The examples in this directory use stable, tested API patterns. All 48 examples are fully functional and production-ready. See [docs/examples_api_issues.md](../docs/examples_api_issues.md) for historical notes on API evolution.
640+
**Important**: The examples in this directory use stable, tested API patterns. All 54 examples are fully functional and production-ready. See [docs/examples_api_issues.md](../docs/examples_api_issues.md) for historical notes on API evolution.
611641

612642
## Getting Help
613643

examples/mcp_server/.env.example

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Company Intelligence MCP Server Configuration
2+
# Copy this file to .env and fill in your API keys
3+
4+
# Required API Keys
5+
TAVILY_API_KEY=your-tavily-api-key
6+
OPENAI_API_KEY=your-openai-api-key
7+
8+
# LLM Models
9+
GRAFLOW_LLM_MODEL=gpt-5-mini
10+
WRITER_MODEL=gpt-5-mini
11+
CRITIQUE_MODEL=gpt-5-mini
12+
13+
# Workflow Configuration
14+
MAX_CRITIQUE_ITERATIONS=3
15+
MAX_SEARCH_RESULTS=10
16+
17+
# MCP Server Configuration
18+
MCP_SERVER_HOST=0.0.0.0
19+
MCP_SERVER_PORT=9100
20+
21+
# Langfuse Tracing (optional)
22+
ENABLE_TRACING=true
23+
LANGFUSE_PUBLIC_KEY=your-langfuse-public-key
24+
LANGFUSE_SECRET_KEY=your-langfuse-secret-key
25+
LANGFUSE_HOST=http://localhost:3000

0 commit comments

Comments
 (0)