Get the MyTaskly MCP Server running in 5 minutes!
- Python 3.10 or higher
- MyTaskly FastAPI server running on
http://localhost:8080 - JWT secret key from your FastAPI server
cd E:/MyTaskly/MyTaskly-mcp
# Create and activate virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
# Install packages
pip install fastmcp httpx pyjwt python-dotenv pydantic pydantic-settings- Open
.envfile in the project root - Update
JWT_SECRET_KEYto match your FastAPI server's secret key:
JWT_SECRET_KEY=your_actual_jwt_secret_key_hereYou can find it in your FastAPI server at:
E:/MyTaskly/MyTaskly-server/src/app/core/config.py- Look for
JWT_SECRET_KEYorSECRET_KEY
Add this endpoint to your FastAPI server to generate MCP tokens:
# E:/MyTaskly/MyTaskly-server/src/app/api/routes/auth.py
from datetime import datetime, timedelta
import jwt
from src.app.core.config import settings
@router.post("/auth/mcp-token")
async def get_mcp_token(current_user: User = Depends(get_current_user)):
"""Generate JWT token for MCP server access."""
payload = {
"sub": str(current_user.user_id),
"aud": "mcp://mytaskly-mcp-server",
"iss": "https://api.mytasklyapp.com",
"exp": datetime.utcnow() + timedelta(minutes=30),
"iat": datetime.utcnow(),
"scope": "tasks:read tasks:write categories:read notes:read notes:write"
}
token = jwt.encode(payload, settings.JWT_SECRET_KEY, algorithm="HS256")
return {"mcp_token": token, "expires_in": 1800}python -m src.serverYou should see:
============================================================
🚀 Starting MyTaskly MCP Server v0.1.0
============================================================
FastAPI Backend: http://localhost:8080
...
python -m tests.manual_testCreate tests/manual_test.py:
import asyncio
from src.auth import create_test_token
from src.server import get_tasks, health_check
async def test():
# Generate token for user_id=1
token = create_test_token(user_id=1)
print(f"✅ Generated token: {token[:50]}...")
# Test health check (no auth)
health = await health_check()
print(f"✅ Health: {health}")
# Test get_tasks (with auth)
tasks = await get_tasks(authorization=f"Bearer {token}")
print(f"✅ Tasks: {tasks['summary']}")
print(f" Voice: {tasks['voice_summary']}")
asyncio.run(test())- Login to your app and get access token:
curl -X POST http://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "your_username", "password": "your_password"}'- Get MCP token:
curl -X POST http://localhost:8080/auth/mcp-token \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"- Test MCP server (replace YOUR_MCP_TOKEN):
from src.server import get_tasks
import asyncio
async def test():
token = "YOUR_MCP_TOKEN_HERE"
tasks = await get_tasks(authorization=f"Bearer {token}")
print(tasks)
asyncio.run(test())If you see task data returned, your MCP server is working!
- Integrate with chatbot - See
README.mdfor chatbot integration - Add more tools - Extend
src/server.pywith more MCP tools - Deploy - Deploy MCP server separately from FastAPI
- Check that
JWT_SECRET_KEYmatches your FastAPI server
- Make sure your FastAPI server is running on
http://localhost:8080 - Check
FASTAPI_BASE_URLin.env
- Make sure you activated the virtual environment:
venv\Scripts\activate - Install dependencies:
pip install -r requirements.txt
Check the full documentation in README.md