sumit-server / README.md
sumitasthaai's picture
Add Turso database integration and environment variable support
8f3faab unverified
---
license: mit
title: SUMIT SERVER MCP
sdk: docker
emoji: πŸš€
colorFrom: yellow
colorTo: green
short_description: THIS IS MCP SERVER.
---
# Tatva MCP Server πŸš€
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/)
[![FastMCP](https://img.shields.io/badge/FastMCP-2.12.4+-green.svg)](https://github.com/jlowin/fastmcp)
<!-- SAFE-MCP Security Badge -->
<a href="https://api.astha.ai/astha/v1/report/ASM-2025-11-21-QORZJFIAE" target="_blank" rel="noopener noreferrer" style="display:inline-flex;align-items:center;gap:8px;padding:8px 16px;background:#ffffff;border:2px solid #2563eb;border-radius:8px;text-decoration:none;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;transition:transform 0.2s,box-shadow 0.2s;" onmouseover="this.style.transform='translateY(-2px)';this.style.boxShadow='0 4px 12px rgba(0,0,0,0.15)';" onmouseout="this.style.transform='translateY(0)';this.style.boxShadow='none';" title="View detailed security report">
<svg width="24" height="24" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M50 5 L90 27.5 L90 72.5 L50 95 L10 72.5 L10 27.5 Z" stroke="#3b82f6" stroke-width="6" fill="none"/>
<line x1="30" y1="35" x2="70" y2="35" stroke="#3b82f6" stroke-width="5" stroke-linecap="round"/>
<line x1="30" y1="50" x2="70" y2="50" stroke="#3b82f6" stroke-width="5" stroke-linecap="round"/>
<line x1="30" y1="65" x2="70" y2="65" stroke="#3b82f6" stroke-width="5" stroke-linecap="round"/>
</svg>
<div style="display:flex;flex-direction:column;gap:2px;">
<div style="font-size:10px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:0.5px;">SAFE-MCP Verified</div>
<div style="font-size:14px;font-weight:700;color:#111827;">222/300 β€’ LOW</div>
<div style="font-size:8px;color:#9ca3af;">Valid: Nov 2025 - Feb 2026</div>
</div>
</a>
<!-- End SAFE-MCP Badge -->
A Model Context Protocol (MCP) server that provides intelligent access to content from the Tatva website (tatva.sumityadav.com.np). This server enables AI assistants to fetch, analyze, and interact with blog posts, pages, and resources from the Tatva platform.
## ✨ Features
- **Content Fetching**: Retrieve content from any page on the Tatva website
- **Blog Post Management**: Access and search through all blog posts
- **Smart Search**: Find posts by keywords or filter by year
- **Task Management**: Store and retrieve tasks using Turso (libSQL) database
- **Resource Access**: Direct access to homepage, about page, and specific posts
- **Analysis Tools**: Built-in prompts for post analysis and comparison
- **Docker Support**: Easy deployment with containerization
- **Hugging Face Spaces Ready**: Optimized for HF Spaces deployment
- **Environment Configuration**: Automatic loading of environment variables from `.env` file
## πŸ› οΈ Available Tools
### Content Retrieval
- `get_page_content(url)` - Fetch content from any specific URL
- `get_homepage_content()` - Get homepage content
- `get_about_page()` - Get about page content
- `get_post_content(post_path)` - Get specific blog post content
### Blog Management
- `get_all_posts_summary()` - List all available blog posts
- `search_posts_by_keyword(keyword)` - Search posts by keyword
- `get_posts_by_year(year)` - Filter posts by publication year
### Task Management
- `put_task_to_db(task, time_date)` - Add a task to the database with date and time
- `get_task_from_db(today_date)` - Retrieve all tasks for a specific date
### Resources
- `tatva://homepage` - Homepage resource
- `tatva://about` - About page resource
- `tatva://posts/{post_path}` - Specific post resource
### Analysis Prompts
- `analyze_post_prompt(post_path)` - Generate analysis prompt for a post
- `compare_posts_prompt(post1, post2)` - Generate comparison prompt for two posts
## πŸš€ Quick Start
### Prerequisites
- Python 3.13+
- [uv](https://github.com/astral-sh/uv) package manager
### Installation
1. **Clone the repository**
```bash
git clone https://github.com/yourusername/sumit-mcp-server.git
cd sumit-mcp-server
```
2. **Install dependencies**
```bash
uv sync
```
3. **Configure environment variables**
Create a `.env` file in the project root with your Turso credentials:
```bash
TURSO_AUTH_TOKEN=your_turso_auth_token
TURSO_DATABASE_URL=your_turso_database_url
PORT=7860
```
The server will automatically load these from the `.env` file.
4. **Run the server**
```bash
uv run server.py
```
The server will start on `http://localhost:7860` with the MCP endpoint at `/api/mcp/`.
### Docker Deployment
1. **Build the image**
```bash
docker build -t tatva-mcp-server .
```
2. **Run the container**
```bash
docker run -p 7860:7860 tatva-mcp-server
```
## πŸ“– Usage Examples
### Fetching Content
```python
# Get homepage content
homepage = get_homepage_content()
# Get a specific blog post
post = get_post_content("2025/09/22/advance_scanner/")
# Search for posts about AI
ai_posts = search_posts_by_keyword("AI")
```
### Using with MCP Clients
The server exposes MCP tools that can be used by compatible AI assistants and clients. Connect to the server endpoint and use the available tools for content retrieval and analysis.
## πŸ—οΈ Project Structure
```
sumit-mcp-server/
β”œβ”€β”€ server.py # Main MCP server implementation
β”œβ”€β”€ pyproject.toml # Project configuration and dependencies
β”œβ”€β”€ Dockerfile # Container configuration
β”œβ”€β”€ README.md # This file
β”œβ”€β”€ .env # Environment variables (create with your Turso credentials)
β”œβ”€β”€ .gitignore # Git ignore rules
└── uv.lock # Dependency lock file
```
## πŸ”§ Configuration
The server is configured to work with:
- **Base URL**: `https://tatva.sumityadav.com.np`
- **Port**: 7860 (configurable via `PORT` environment variable)
- **Transport**: Server-Sent Events (SSE)
- **Path**: `/api/mcp/`
## 🌐 Deployment
### Hugging Face Spaces
This server is optimized for deployment on Hugging Face Spaces:
- Uses port 7860 (HF Spaces standard)
- Includes proper Docker configuration
- Supports SSE transport for real-time communication
### Environment Variables
The server automatically loads environment variables from a `.env` file in the project root. Create a `.env` file with:
- `TURSO_AUTH_TOKEN`: Authentication token for Turso database (required)
- `TURSO_DATABASE_URL`: Database URL for Turso (libSQL) connection (required)
- `PORT`: Server port (default: 7860, optional)
**Note**: The `.env` file is automatically ignored by git to keep your credentials secure. You can also set these as system environment variables if preferred.
## πŸ“ API Reference
### Tools
| Tool | Description | Parameters |
|------|-------------|------------|
| `get_page_content` | Fetch content from any URL | `url: str` |
| `get_homepage_content` | Get homepage content | None |
| `get_about_page` | Get about page content | None |
| `get_post_content` | Get specific post content | `post_path: str` |
| `get_all_posts_summary` | List all posts | None |
| `search_posts_by_keyword` | Search posts | `keyword: str` |
| `get_posts_by_year` | Filter by year | `year: str` |
| `put_task_to_db` | Add task to database | `task: str`, `time_date: str` |
| `get_task_from_db` | Get tasks for date | `today_date: str` |
### Resources
| Resource | Description |
|----------|-------------|
| `tatva://homepage` | Homepage content |
| `tatva://about` | About page content |
| `tatva://posts/{path}` | Specific post content |
## 🀝 Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## πŸ“„ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## πŸ”— Links
- **Tatva Website**: [tatva.sumityadav.com.np](https://tatva.sumityadav.com.np)
- **FastMCP**: [GitHub Repository](https://github.com/jlowin/fastmcp)
- **Model Context Protocol**: [Official Documentation](https://modelcontextprotocol.io/)
## πŸ“ž Support
For support, questions, or contributions, please open an issue on GitHub or contact the maintainer.
---
**Made with ❀️ for the Tatva Sumit**