Code Samples
Explore comprehensive code examples for building MCP integrations. These samples cover common integration patterns and can be used as starting points for your own custom integrations.
Sample Overview
CRM Integration
A complete CRM integration example that demonstrates fetching contacts, searching records, and creating new entries.
Use Cases
Retrieve customer information during conversations
Look up account details and history
Create new leads or contacts from chat
Update CRM records based on meeting outcomes
Python Code
Required Secrets
CRM_BASE_URL
Base URL for your CRM API
CRM_API_KEY
API key for authentication
Database Query
A secure database query integration that allows read-only access to your PostgreSQL or MySQL database.
Use Cases
Query customer data during conversations
Generate reports on demand
Look up product information
Analyze historical data
Python Code
Required Secrets
DATABASE_URL
PostgreSQL connection string
postgresql://user:pass@host:5432/dbname
REST API Wrapper
A flexible REST API wrapper that can connect to any HTTP API.
Use Cases
Connect to internal APIs
Integrate third-party services
Access webhooks and endpoints
Retrieve data from any HTTP source
Python Code
Required Secrets
API_BASE_URL
Base URL for the API
https://api.example.com/v1
API_KEY
Authentication credential
sk_live_xxx...
AUTH_TYPE
Authentication type
bearer, api-key, or basic
Slack Notifications
Send messages and notifications to Slack channels.
Use Cases
Alert teams about important events
Share meeting summaries
Post workflow results
Send reminders and notifications
Python Code
Required Secrets
SLACK_BOT_TOKEN
Slack Bot User OAuth Token (starts with xoxb-)
Web Scraping
Extract data from web pages (use responsibly and respect robots.txt).
Use Cases
Research competitor websites
Extract product information
Gather public data
Monitor web content
Python Code
Required Secrets
This integration does not require secrets, but you may want to add:
USER_AGENT
Custom User-Agent string
Yes
PROXY_URL
Proxy server for requests
Yes
Template Structure Reference
All MCP servers follow this basic structure:
Python Template
Key Elements
Server()
Creates the MCP server instance
@app.tool()
Decorator to register a tool
async def
Tools should be async for performance
Docstring
Describes the tool for the AI
TextContent
Standard return type for text responses
Environment variables
Secure way to access secrets
Next Steps
Start building
Deploy your integration
Troubleshoot issues
Last updated
Was this helpful?

