-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmcp_builder.py
More file actions
33 lines (23 loc) · 831 Bytes
/
mcp_builder.py
File metadata and controls
33 lines (23 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import structlog
from mcp.server.fastmcp import FastMCP
from mcp_template_py.api.tools import Tools
from mcp_template_py.settings import Settings
class MCPBuilder:
logger: structlog.BoundLogger = structlog.get_logger()
@staticmethod
def build_mcp(
settings: Settings | None = None,
) -> FastMCP:
"""Build and configure the MCP server.
Creates a FastMCP instance with tools.
Args:
settings: Application settings
Returns:
Configured FastMCP server instance
"""
settings = settings or Settings()
mcp = FastMCP("mcp-template-py", host=settings.mcp_host, port=settings.mcp_port)
# Register tools directly - preserves original docstrings
tools = Tools()
mcp.add_tool(tools.hello)
return mcp