A comprehensive collection of examples demonstrating how to integrate and use Alloy's Model Context Protocol (MCP) servers in various applications and frameworks.
# Clone the repository
git clone https://github.com/alloy-automation/mcp-examples
cd mcp-examples
# Install dependencies
pnpm install
# Copy environment variables (already pre-configured!)
cp .env.example .env
# All examples use a single .env file from the root
A minimal example showing how to connect to Alloy MCP servers using TypeScript.
Features:
- Basic server connection
- Tool discovery and invocation
- Error handling
- Response streaming
pnpm run example:basic
A full-featured chat application built with Next.js and Alloy MCP.
Features:
- Real-time chat interface
- Multiple MCP server support
- Tool execution visualization
cd examples/nextjs-chat
pnpm install
pnpm dev
3. Python SDK
Python implementation for Alloy MCP integration.
Features:
- Python MCP client
- Async/await support
- Tool discovery
- Workflow execution
cd examples/python-sdk
pip install -r requirements.txt
python main.py
graph TB
A[Client Application] --> B[Alloy MCP Client]
B --> C[MCP Server 1]
B --> D[MCP Server 2]
B --> E[MCP Server N]
C --> F[Tools & Resources]
D --> G[Workflows]
E --> H[Integrations]
F --> I[External APIs]
G --> J[Business Logic]
H --> K[Third-party Services]
All examples use a centralized configuration from the root .env
file. This simplifies setup and ensures consistency across all examples.
The project uses these pre-configured values:
# Root .env file (used by all examples)
# MCP Server Configuration
NEXT_PUBLIC_ALLOY_API_KEY=<your_api_key_here>
NEXT_PUBLIC_MCP_SERVER_URL=<your_mcp_server_url>
NEXT_PUBLIC_MCP_ACCESS_TOKEN=<your_mcp_access_token>
We welcome contributions!
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
Built with ❤️ by the Alloy team