Skip to content

Commit 9f1de7c

Browse files
committed
Initial Commit
0 parents  commit 9f1de7c

File tree

6 files changed

+744
-0
lines changed

6 files changed

+744
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

README.md

Whitespace-only changes.

main.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
from datetime import date
2+
from typing import TypedDict
3+
4+
import requests
5+
from fastmcp import FastMCP
6+
7+
mcp = FastMCP("WordleMCP")
8+
9+
class WordleAPIData(TypedDict):
10+
id: int
11+
solution: str
12+
print_date: str
13+
days_since_launch: int
14+
editor: str
15+
16+
17+
@mcp.tool(
18+
name="get_wordle_solution",
19+
description="Fetches the Wordle of a particular date provided between 2021-05-19 to 23 days future",
20+
annotations={"readOnlyHint": True}
21+
)
22+
async def get_wordle_data(date: str = date.today().isoformat()) -> WordleAPIData:
23+
"""
24+
Retrieves Wordle puzzle data for a specified date.
25+
26+
This function fetches the complete Wordle solution and associated metadata
27+
for any given date within the supported range.
28+
29+
Args:
30+
date (str, optional): Target date in YYYY-MM-DD format. If not provided,
31+
defaults to the current date.
32+
33+
Returns:
34+
dict: JSON response containing:
35+
- solution: The 5-letter Wordle answer
36+
- puzzle_id: Sequential puzzle number
37+
- metadata: Additional puzzle information (editor, days since launch, etc.)
38+
39+
Note:
40+
- Date format must be YYYY-MM-DD (ISO 8601)
41+
- Available date range: 2021-05-19 (Wordle launch) to 23 days future
42+
- Returns error for dates outside supported range
43+
"""
44+
45+
url: str = f"https://www.nytimes.com/svc/wordle/v2/{date}.json"
46+
47+
# Make the GET request to the Wordle API
48+
return requests.get(url, timeout=300).json()
49+
50+
51+
if __name__ == "__main__":
52+
mcp.run()

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[project]
2+
name = "mcp-wordle"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.10"
7+
dependencies = [
8+
"fastmcp>=2.9.2",
9+
"requests>=2.32.4",
10+
]

0 commit comments

Comments
 (0)