Provides time filtering tools that can be integrated into Langflow AI workflows, enabling automated dashboard time period management through MCP protocol
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CX TimeFilter MCP Serverset the Overview tab to the last 7 days"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CX TimeFilter MCP Server
A Model Context Protocol (MCP) server providing time filter tools for CX Dashboard. This server exposes time filtering functionality that can be used by any MCP-compatible client, including Langflow.
π― Features
Set Predefined Time Periods: Last Month, Last 7 days, This Quarter, etc.
Set Custom Date Ranges: Specify exact start and end dates
List Available Periods: Get all supported time periods
HTTP-based MCP Protocol: Easy integration with any MCP client
Optional Authentication: API key protection
Comprehensive Validation: Input validation and error handling
π Quick Start
1. Installation
# Clone or create the project directory
mkdir cx-timefilter-mcp-server
cd cx-timefilter-mcp-server
# Install dependencies
npm install2. Configuration
# Copy environment template
cp env.example .env
# Edit .env file
PORT=3000
NODE_ENV=development
MCP_API_KEY=your-secret-api-key-here
ALLOWED_ORIGINS=http://localhost:3001,https://your-langflow-instance.com3. Run the Server
# Development mode
npm run dev
# Production mode
npm start
# Run tests
npm test4. Verify Installation
# Health check
curl http://localhost:3000/health
# List available tools
curl http://localhost:3000/mcp/tools
# Test a tool (with API key if configured)
curl -X POST http://localhost:3000/mcp/tools/call \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key" \
-d '{
"name": "set_time_period",
"arguments": {
"timePeriodName": "Last Month",
"tabName": "Overview"
}
}'π οΈ Available Tools
1. set_time_period
Set a predefined time period for dashboard tabs.
Parameters:
timePeriodName(string): Exact name of the time periodtabName(string): Dashboard tab name
Example:
{
"name": "set_time_period",
"arguments": {
"timePeriodName": "Last Month",
"tabName": "Overview"
}
}2. set_custom_date_range
Set a custom date range with specific start and end dates.
Parameters:
startDate(string): Start date in YYYY-MM-DD formatendDate(string): End date in YYYY-MM-DD formattabName(string): Dashboard tab name
Example:
{
"name": "set_custom_date_range",
"arguments": {
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"tabName": "Comparison"
}
}3. list_time_periods
List all available predefined time periods.
Parameters: None
Example:
{
"name": "list_time_periods",
"arguments": {}
}π API Endpoints
Endpoint | Method | Description |
| GET | Health check |
| GET | MCP protocol information |
| GET | List available tools |
| POST | Execute a tool |
| POST | Full MCP protocol endpoint |
π Authentication
The server supports optional API key authentication:
Set API Key: Add
MCP_API_KEY=your-secret-keyto.envInclude in Requests: Add
Authorization: Bearer your-secret-keyheaderAlternative Formats:
ApiKey your-secret-keyorKey your-secret-key
π Langflow Integration
Step 1: Add MCP Tools Component
Open your Langflow project
Add an "MCP Tools" component
Configure the connection
Step 2: Configure Connection
{
"serverName": "CX TimeFilter Server",
"connectionMode": "HTTP",
"serverUrl": "http://localhost:3000",
"apiKey": "your-api-key",
"endpoints": {
"tools": "/mcp/tools",
"call": "/mcp/tools/call"
}
}Step 3: Use Tools in Flows
The tools will appear in Langflow and can be used in your AI workflows.
π¦ Deployment
Railway (Recommended)
# Install Railway CLI
npm install -g @railway/cli
# Login and deploy
railway login
railway init
railway upRender
Connect your GitHub repository
Set environment variables
Deploy automatically
Docker
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]π§ͺ Testing
# Run built-in tests
npm test
# Manual testing with curl
curl -X POST http://localhost:3000/mcp/tools/call \
-H "Content-Type: application/json" \
-d '{
"name": "list_time_periods",
"arguments": {}
}'π Supported Time Periods
Calendar Periods:
All Time, Today, Yesterday
This Week, Last Week
This Month, Last Month
This Quarter, Last Quarter
This Year, Last Year
Rolling Periods:
Last 24 hours, Last 7 days, Last 14 days
Last 30 days, Last 90 days, Last 180 days
Last 12 Months
Custom Periods:
Any date range in YYYY-MM-DD format
π§ Development
Project Structure
cx-timefilter-mcp-server/
βββ src/
β βββ server.js # Main server
β βββ tools/
β β βββ timefilter.js # Time filter tools
β βββ utils/
β β βββ mcp-protocol.js # MCP utilities
β βββ middleware/
β β βββ auth.js # Authentication
β βββ test.js # Test suite
βββ package.json
βββ .env
βββ README.mdAdding New Tools
Create tool definition in
src/tools/Add validation schema
Implement execute function
Export in tools array
Update README
π Troubleshooting
Common Issues:
Port already in use: Change
PORTin.envCORS errors: Update
ALLOWED_ORIGINSin.envAuth failures: Check
MCP_API_KEYconfigurationTool not found: Verify tool name matches exactly
Debug Mode:
NODE_ENV=development npm startπ License
MIT License - see LICENSE file for details.
π€ Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests
Submit a pull request
Ready to integrate with Langflow and start filtering time periods via MCP! π