Skip to main content
Glama

MCP Think

by ddkang1
server.py2.28 kB
#!/usr/bin/env python3 """MCP server implementation for the think tool using FastMCP v2.""" import argparse import asyncio from fastmcp import FastMCP # Initialize FastMCP server mcp = FastMCP("think") @mcp.tool() async def think(thought: str) -> str: """Use the tool to think about something. It will not obtain new information or make any changes, but just log the thought. Use it when complex reasoning or brainstorming is needed. For example, if you explore the repo and discover the source of a bug, call this tool to brainstorm several unique ways of fixing the bug, and assess which change(s) are likely to be simplest and most effective. Alternatively, if you receive some test results, call this tool to brainstorm ways to fix the failing tests. Args: thought: Your thoughts. """ # Return a confirmation return thought def main(): parser = argparse.ArgumentParser(description="Run MCP Think server") parser.add_argument( "--transport", choices=["stdio", "sse", "streamable-http"], default="streamable-http", help="Transport protocol to use (stdio, sse, or streamable-http, default: streamable-http)", ) parser.add_argument( "--host", default="0.0.0.0", help="Host to bind to (default: 0.0.0.0)" ) parser.add_argument( "--port", type=int, default=8000, help="Port to listen on (default: 8000)" ) args = parser.parse_args() if args.transport == "stdio" and (args.host != "0.0.0.0" or args.port != 8000): parser.error("Host and port arguments are only valid when using HTTP transports (sse or streamable-http).") print(f"Starting Think MCP Server with {args.transport} transport...") if args.transport == "stdio": # Use stdio transport mcp.run() elif args.transport == "sse": # Use SSE transport asyncio.run(mcp.run_http_async( transport="sse", host=args.host, port=args.port, )) elif args.transport == "streamable-http": # Use streamable HTTP transport asyncio.run(mcp.run_http_async( transport="streamable-http", host=args.host, port=args.port, )) if __name__ == "__main__": main()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ddkang1/mcp-think'

If you have feedback or need assistance with the MCP directory API, please join our Discord server