Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions breathe_hr_mcp/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Entry point for running the Breathe HR MCP server as a module"""

if __name__ == "__main__":
import uvicorn
from .server import app
from .server import mcp

uvicorn.run(app, host="0.0.0.0", port=8000)
mcp.run()
21 changes: 8 additions & 13 deletions breathe_hr_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@

# Configuration
BREATHE_HR_API_KEY = os.getenv("BREATHE_HR_API_KEY")
BREATHE_HR_BASE_URL = os.getenv("BREATHE_HR_BASE_URL", "https://api.breathehr.com/v1")
use_sandbox = os.getenv("USE_SANDBOX_URL")
if use_sandbox:
BREATHE_HR_BASE_URL = "https://api.sandbox.breathehr.info/v1"
else:
BREATHE_HR_BASE_URL = os.getenv("BREATHE_HR_BASE_URL", "https://api.breathehr.com/v1")
MCP_API_KEY = os.getenv("MCP_API_KEY")

# Security
Expand Down Expand Up @@ -48,9 +52,6 @@ async def authenticate_request(request):
# Initialize MCP server
mcp = FastMCP(
name="Breathe HR MCP",
auth=None,
json_response=True,
stateless_http=True,
)

async def breathe_hr_request(
Expand All @@ -65,7 +66,7 @@ async def breathe_hr_request(

url = f"{BREATHE_HR_BASE_URL.rstrip('/')}/{endpoint.lstrip('/')}"
headers = {
"Authorization": f"Bearer {BREATHE_HR_API_KEY}",
"X-API-KEY": f"{BREATHE_HR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json"
}
Expand Down Expand Up @@ -323,21 +324,15 @@ async def auth_middleware(request: Request, call_next):
# Mount the MCP app
app.mount("/mcp", mcp_app)

# Add redirect for /mcp
@app.api_route("/mcp", methods=["GET", "POST"])
async def mcp_redirect():
return RedirectResponse(url="/mcp/", status_code=307)

# Add health check endpoint
@app.get("/")
async def health_check():
return {"status": "ok", "service": "Breathe HR MCP Server"}

return app

# Create the app
app = create_app()

if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
mcp.run()

3 changes: 2 additions & 1 deletion claude_desktop_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"command": "uv",
"args": ["run", "python", "-m", "breathe_hr_mcp"],
"env": {
"BREATHE_HR_API_KEY": "your_breathe_hr_api_key_here"
"BREATHE_HR_API_KEY": "your_breathe_hr_api_key_here",
"USE_SANDBOX_URL": false
}
}
}
Expand Down