Spaces:
Running
Running
add readme
Browse files- .gitattributes +35 -0
- README.md +183 -0
- server.py +1 -1
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
title: SUMIT SERVER MCP
|
| 4 |
+
sdk: docker
|
| 5 |
+
emoji: π
|
| 6 |
+
colorFrom: yellow
|
| 7 |
+
colorTo: green
|
| 8 |
+
short_description: THIS IS MCP SERVER.
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Tatva MCP Server π
|
| 12 |
+
|
| 13 |
+
[](https://opensource.org/licenses/MIT)
|
| 14 |
+
[](https://www.python.org/downloads/)
|
| 15 |
+
[](https://github.com/jlowin/fastmcp)
|
| 16 |
+
|
| 17 |
+
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.
|
| 18 |
+
|
| 19 |
+
## β¨ Features
|
| 20 |
+
|
| 21 |
+
- **Content Fetching**: Retrieve content from any page on the Tatva website
|
| 22 |
+
- **Blog Post Management**: Access and search through all blog posts
|
| 23 |
+
- **Smart Search**: Find posts by keywords or filter by year
|
| 24 |
+
- **Resource Access**: Direct access to homepage, about page, and specific posts
|
| 25 |
+
- **Analysis Tools**: Built-in prompts for post analysis and comparison
|
| 26 |
+
- **Docker Support**: Easy deployment with containerization
|
| 27 |
+
- **Hugging Face Spaces Ready**: Optimized for HF Spaces deployment
|
| 28 |
+
|
| 29 |
+
## π οΈ Available Tools
|
| 30 |
+
|
| 31 |
+
### Content Retrieval
|
| 32 |
+
- `get_page_content(url)` - Fetch content from any specific URL
|
| 33 |
+
- `get_homepage_content()` - Get homepage content
|
| 34 |
+
- `get_about_page()` - Get about page content
|
| 35 |
+
- `get_post_content(post_path)` - Get specific blog post content
|
| 36 |
+
|
| 37 |
+
### Blog Management
|
| 38 |
+
- `get_all_posts_summary()` - List all available blog posts
|
| 39 |
+
- `search_posts_by_keyword(keyword)` - Search posts by keyword
|
| 40 |
+
- `get_posts_by_year(year)` - Filter posts by publication year
|
| 41 |
+
|
| 42 |
+
### Resources
|
| 43 |
+
- `tatva://homepage` - Homepage resource
|
| 44 |
+
- `tatva://about` - About page resource
|
| 45 |
+
- `tatva://posts/{post_path}` - Specific post resource
|
| 46 |
+
|
| 47 |
+
### Analysis Prompts
|
| 48 |
+
- `analyze_post_prompt(post_path)` - Generate analysis prompt for a post
|
| 49 |
+
- `compare_posts_prompt(post1, post2)` - Generate comparison prompt for two posts
|
| 50 |
+
|
| 51 |
+
## π Quick Start
|
| 52 |
+
|
| 53 |
+
### Prerequisites
|
| 54 |
+
- Python 3.13+
|
| 55 |
+
- [uv](https://github.com/astral-sh/uv) package manager
|
| 56 |
+
|
| 57 |
+
### Installation
|
| 58 |
+
|
| 59 |
+
1. **Clone the repository**
|
| 60 |
+
```bash
|
| 61 |
+
git clone https://github.com/yourusername/sumit-mcp-server.git
|
| 62 |
+
cd sumit-mcp-server
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
2. **Install dependencies**
|
| 66 |
+
```bash
|
| 67 |
+
uv sync
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
3. **Run the server**
|
| 71 |
+
```bash
|
| 72 |
+
uv run server.py
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
The server will start on `http://localhost:7860` with the MCP endpoint at `/api/mcp/`.
|
| 76 |
+
|
| 77 |
+
### Docker Deployment
|
| 78 |
+
|
| 79 |
+
1. **Build the image**
|
| 80 |
+
```bash
|
| 81 |
+
docker build -t tatva-mcp-server .
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
2. **Run the container**
|
| 85 |
+
```bash
|
| 86 |
+
docker run -p 7860:7860 tatva-mcp-server
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## π Usage Examples
|
| 90 |
+
|
| 91 |
+
### Fetching Content
|
| 92 |
+
```python
|
| 93 |
+
# Get homepage content
|
| 94 |
+
homepage = get_homepage_content()
|
| 95 |
+
|
| 96 |
+
# Get a specific blog post
|
| 97 |
+
post = get_post_content("2025/09/22/advance_scanner/")
|
| 98 |
+
|
| 99 |
+
# Search for posts about AI
|
| 100 |
+
ai_posts = search_posts_by_keyword("AI")
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
### Using with MCP Clients
|
| 104 |
+
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.
|
| 105 |
+
|
| 106 |
+
## ποΈ Project Structure
|
| 107 |
+
|
| 108 |
+
```
|
| 109 |
+
sumit-mcp-server/
|
| 110 |
+
βββ server.py # Main MCP server implementation
|
| 111 |
+
βββ main.py # Entry point
|
| 112 |
+
βββ pyproject.toml # Project configuration
|
| 113 |
+
βββ Dockerfile # Container configuration
|
| 114 |
+
βββ README.md # This file
|
| 115 |
+
βββ uv.lock # Dependency lock file
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
## π§ Configuration
|
| 119 |
+
|
| 120 |
+
The server is configured to work with:
|
| 121 |
+
- **Base URL**: `https://tatva.sumityadav.com.np`
|
| 122 |
+
- **Port**: 7860 (configurable via `PORT` environment variable)
|
| 123 |
+
- **Transport**: Server-Sent Events (SSE)
|
| 124 |
+
- **Path**: `/api/mcp/`
|
| 125 |
+
|
| 126 |
+
## π Deployment
|
| 127 |
+
|
| 128 |
+
### Hugging Face Spaces
|
| 129 |
+
This server is optimized for deployment on Hugging Face Spaces:
|
| 130 |
+
- Uses port 7860 (HF Spaces standard)
|
| 131 |
+
- Includes proper Docker configuration
|
| 132 |
+
- Supports SSE transport for real-time communication
|
| 133 |
+
|
| 134 |
+
### Environment Variables
|
| 135 |
+
- `PORT`: Server port (default: 7860)
|
| 136 |
+
|
| 137 |
+
## π API Reference
|
| 138 |
+
|
| 139 |
+
### Tools
|
| 140 |
+
|
| 141 |
+
| Tool | Description | Parameters |
|
| 142 |
+
|------|-------------|------------|
|
| 143 |
+
| `get_page_content` | Fetch content from any URL | `url: str` |
|
| 144 |
+
| `get_homepage_content` | Get homepage content | None |
|
| 145 |
+
| `get_about_page` | Get about page content | None |
|
| 146 |
+
| `get_post_content` | Get specific post content | `post_path: str` |
|
| 147 |
+
| `get_all_posts_summary` | List all posts | None |
|
| 148 |
+
| `search_posts_by_keyword` | Search posts | `keyword: str` |
|
| 149 |
+
| `get_posts_by_year` | Filter by year | `year: str` |
|
| 150 |
+
|
| 151 |
+
### Resources
|
| 152 |
+
|
| 153 |
+
| Resource | Description |
|
| 154 |
+
|----------|-------------|
|
| 155 |
+
| `tatva://homepage` | Homepage content |
|
| 156 |
+
| `tatva://about` | About page content |
|
| 157 |
+
| `tatva://posts/{path}` | Specific post content |
|
| 158 |
+
|
| 159 |
+
## π€ Contributing
|
| 160 |
+
|
| 161 |
+
1. Fork the repository
|
| 162 |
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
| 163 |
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
| 164 |
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
| 165 |
+
5. Open a Pull Request
|
| 166 |
+
|
| 167 |
+
## π License
|
| 168 |
+
|
| 169 |
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
| 170 |
+
|
| 171 |
+
## π Links
|
| 172 |
+
|
| 173 |
+
- **Tatva Website**: [tatva.sumityadav.com.np](https://tatva.sumityadav.com.np)
|
| 174 |
+
- **FastMCP**: [GitHub Repository](https://github.com/jlowin/fastmcp)
|
| 175 |
+
- **Model Context Protocol**: [Official Documentation](https://modelcontextprotocol.io/)
|
| 176 |
+
|
| 177 |
+
## π Support
|
| 178 |
+
|
| 179 |
+
For support, questions, or contributions, please open an issue on GitHub or contact the maintainer.
|
| 180 |
+
|
| 181 |
+
---
|
| 182 |
+
|
| 183 |
+
**Made with β€οΈ for the Tatva Sumit**
|
server.py
CHANGED
|
@@ -7,7 +7,7 @@ from urllib.parse import urljoin, urlparse
|
|
| 7 |
import json
|
| 8 |
from typing import List, Dict, Optional
|
| 9 |
|
| 10 |
-
mcp = FastMCP("
|
| 11 |
|
| 12 |
BASE_URL = "https://tatva.sumityadav.com.np"
|
| 13 |
|
|
|
|
| 7 |
import json
|
| 8 |
from typing import List, Dict, Optional
|
| 9 |
|
| 10 |
+
mcp = FastMCP("tatva-sumit")
|
| 11 |
|
| 12 |
BASE_URL = "https://tatva.sumityadav.com.np"
|
| 13 |
|