mcp_server.py 916 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. """FastMCP transport for Atlas2 tools."""
  2. from __future__ import annotations
  3. from mcp.server.fastmcp import FastMCP
  4. from mcp.server.transport_security import TransportSecuritySettings
  5. from .resolve import ResolveService
  6. mcp = FastMCP(
  7. "atlas2",
  8. transport_security=TransportSecuritySettings(
  9. enable_dns_rebinding_protection=False
  10. ),
  11. )
  12. @mcp.tool(
  13. name="resolve",
  14. description="Resolve a subject string to a canonical entity (atlas2 scaffold).",
  15. )
  16. async def resolve_tool(
  17. subject: str,
  18. context: dict | None = None,
  19. constraints: dict | None = None,
  20. hints: dict | None = None,
  21. debug: dict | None = None,
  22. ):
  23. # Service pulls configuration exclusively from the project's .env.
  24. svc = ResolveService()
  25. return await svc.resolve(
  26. subject=subject,
  27. context=context,
  28. constraints=constraints,
  29. hints=hints,
  30. debug=debug,
  31. )