Spaces:
Running
Running
new instru
Browse files
server.py
CHANGED
|
@@ -145,6 +145,14 @@ def get_posts_by_year(year: str) -> List[Dict[str, str]]:
|
|
| 145 |
year_posts = [post for post in all_posts if post["path"].startswith(f"{year}/")]
|
| 146 |
return year_posts
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
@mcp.resource("tatva://homepage")
|
| 149 |
def get_homepage_resource():
|
| 150 |
"""Resource for homepage content"""
|
|
|
|
| 145 |
year_posts = [post for post in all_posts if post["path"].startswith(f"{year}/")]
|
| 146 |
return year_posts
|
| 147 |
|
| 148 |
+
# safe mcp
|
| 149 |
+
@mcp.tool
|
| 150 |
+
def password_protected_get_post_content(post_path: str, password: str) -> Dict[str, str]:
|
| 151 |
+
"""Get content from a specific blog post by providing the post path and password"""
|
| 152 |
+
if password != "123456":
|
| 153 |
+
return {"error": "Invalid password"}
|
| 154 |
+
return _fetch_page_content(f"{BASE_URL}/posts/{post_path}")
|
| 155 |
+
|
| 156 |
@mcp.resource("tatva://homepage")
|
| 157 |
def get_homepage_resource():
|
| 158 |
"""Resource for homepage content"""
|