Provides a time API endpoint that returns the current timestamp, which the MCP agent can query when handling time-related questions
Connects to OpenRouter (an OpenAI-compatible API) to access language models for generating responses to user queries
Offers a chat interface for users to interact with the MCP agent, allowing them to ask time-related and general questions
time-mcp
A minimal agentic AI system that answers time-related and general questions using a tool-augmented LLM pipeline.
Features
- Flask API: Provides the current timestamp.
- MCP Agent Server: Reasoning agent that detects user intent, calls tools (like the time API), engineers prompts, and interacts with an LLM via OpenRouter (OpenAI-compatible API).
- Streamlit UI: Simple chat interface to talk to the AI agent.
Setup
1. Clone and Install Dependencies
2. Environment Variable
Set your OpenRouter API key (get one from https://openrouter.ai):
3. Run the Servers
Open three terminals (or use background processes):
Terminal 1: Flask Time API
Terminal 2: MCP Agent Server
Terminal 3: Streamlit UI
The Streamlit UI will open in your browser (default: http://localhost:8501)
Usage
- Ask the agent any question in the Streamlit UI.
- If you ask about the time (e.g., "What is the time?"), the agent will call the Flask API, fetch the current time, and craft a beautiful, natural response using the LLM.
- For other questions, the agent will answer using the LLM only.
Architecture
- The MCP agent detects intent, calls tools as needed, engineers prompts, and sends them to the LLM.
- Easily extensible to add more tools (just add to the MCPAgent class).
Customization
- Add more tools: Implement new methods in
MCPAgent
and updateself.tools
. - Improve intent detection: Extend
detect_intent()
inMCPAgent
. - Change LLM model: Update the
model
field incall_llm()
.
Requirements
- Python 3.7+
- See
requirements.txt
for dependencies.
Credits
- Built using Flask, Streamlit, OpenRouter, and Python.
- Inspired by agentic LLM design patterns.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
An agentic AI system that answers time-related questions by calling a time API tool and general questions using an LLM, accessible through a simple chat interface.
Related MCP Servers
- -securityFlicense-qualityA server that routes user questions to specialized agents (date, location, weather) or an LLM expert, with a simple Streamlit web interface for easy interaction.Last updated -Python
- -securityFlicense-qualityAn agentic AI system that orchestrates multiple specialized AI tools to perform business analytics and knowledge retrieval, allowing users to analyze data and access business information through natural language queries.Last updated -1Python
- -securityAlicense-qualityA Model Context Protocol server that provides the current time in any timezone with customizable formatting, allowing AI assistants to access accurate time information.Last updated -PythonMIT License
- AsecurityAlicenseAqualityAn AI agent task management system that provides structure and visualization for long-term task planning with support for the Model Context Protocol (MCP) standard.Last updated -151PythonMIT License