A LangGraph-based project that deploys AI agents as both a streaming API and MCP (Model Context Protocol) tools.
This project contains two LangGraph agents:
- Summarizer: Takes text input and returns a concise summary
- Search: Web search agent that answers questions using Tavily API
Agents are exposed via:
- LangGraph streaming API (
/assistants,/threads,/runs) - MCP JSON-RPC protocol (
/mcp/)
- Python 3.9+
- OpenAI API key
- Tavily API key (for search agent)
-
Clone the repository and navigate to the project directory
-
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- Create
.envfile with your API keys:
OPENAI_API_KEY=your_openai_key
TAVILY_API_KEY=your_tavily_keyStart the LangGraph development server:
langgraph dev --no-browserThe server runs on http://127.0.0.1:2024 by default.
To run in the background:
langgraph dev --no-browser &Ensure the server is up and running in the background first.
Test both agents with their streaming API endpoints:
python client/test_agents.py --test-allIndividual tests:
python client/test_agents.py --test-summarizer
python client/test_agents.py --test-search
python client/test_agents.py --list # List available assistantsTest agents exposed as MCP tools:
python client/test_mcp.py --allIndividual test suites:
python client/test_mcp.py --json-rpc # Test MCP JSON-RPC methods
python client/test_mcp.py --openapi # Fetch OpenAPI spec
python client/test_mcp.py --endpoints # Test endpoint patterns
python client/test_mcp.py --assistants # Test assistants APILANGGRAPH_BASE_URL: API endpoint (default:http://127.0.0.1:2024)LANGSMITH_API_KEY: API key for authentication (optional for local dev)OPENAI_API_KEY: OpenAI API key (required)TAVILY_API_KEY: Tavily API key (required for search agent)
Both test scripts support custom base URLs:
python client/test_agents.py --base-url https://your-deployment-url
python client/test_mcp.py --base-url https://your-deployment-url.
├── agents/
│ ├── search.py # Web search agent
│ └── summarize.py # Text summarization agent
├── client/
│ ├── test_agents.py # Test streaming API
│ └── test_mcp.py # Test MCP protocol
├── langgraph.json # LangGraph configuration
├── requirements.txt # Python dependencies
└── .env # Environment variables (create this)
POST /assistants/search- List available assistantsPOST /threads- Create a new threadPOST /threads/{thread_id}/runs/stream- Stream agent execution
POST /mcp/- JSON-RPC 2.0 endpointinitialize- Initialize MCP sessiontools/list- List available toolstools/call- Invoke a toolresources/list- List resourcesprompts/list- List prompts