mcp_server.py 977 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. strategy: dict | None = None,
  23. ):
  24. # Service pulls configuration exclusively from the project's .env.
  25. svc = ResolveService()
  26. return await svc.resolve(
  27. subject=subject,
  28. context=context,
  29. constraints=constraints,
  30. hints=hints,
  31. debug=debug,
  32. strategy=strategy,
  33. )