#!/usr/bin/env python3 """ Sequential Thinking MCP Server Stub (Beat 1) This is a minimal implementation for testing the wrapper infrastructure. In later beats, this will be replaced with the full Sequential Thinking MCP server. """ from fastapi import FastAPI, HTTPException from pydantic import BaseModel from typing import Dict, Any, Optional import uvicorn app = FastAPI(title="Sequential Thinking MCP Server Stub") class ToolRequest(BaseModel): tool: str payload: Dict[str, Any] class ToolResponse(BaseModel): result: Optional[Any] = None error: Optional[str] = None @app.get("/health") async def health(): """Health check endpoint""" return {"status": "ok"} @app.post("/mcp/tool") async def call_tool(request: ToolRequest) -> ToolResponse: """ Tool call endpoint - stub implementation In Beat 1, this just echoes back the request to verify the wrapper works. Later beats will implement the actual Sequential Thinking logic. """ if request.tool != "mcp__sequential-thinking__sequentialthinking": return ToolResponse( error=f"Unknown tool: {request.tool}" ) # Stub response for Sequential Thinking tool payload = request.payload thought_number = payload.get("thoughtNumber", 1) total_thoughts = payload.get("totalThoughts", 5) thought = payload.get("thought", "") next_thought_needed = payload.get("nextThoughtNeeded", True) return ToolResponse( result={ "thoughtNumber": thought_number, "totalThoughts": total_thoughts, "thought": thought, "nextThoughtNeeded": next_thought_needed, "message": "Beat 1 stub - Sequential Thinking not yet implemented" } ) if __name__ == "__main__": uvicorn.run( app, host="127.0.0.1", port=8000, log_level="info" )