Skip to main content
@tags: macros, mcp, model-context-protocol, ai-agents, decorators, annotations

Model Context Protocol (MCP) Macro

#[mcp] macro exposes any query as an MCP endpoint, making it directly accessible to AI agents. Notes:
  • MCP queries must return a single object/value from the query otherwise you will get a compile error.
  • Make sure to enable MCP in your helix.toml file.

Best Practices for MCP Macros

  • Use descriptive query names: choose names that are easy for AI agents to understand and use.
  • Keep query signatures simple: avoid complex parameters or nested structures.

Syntax

Example

  • Schema:
  • Query:
  • cURL:
  • Python SDK: