🤖 Built-in Model Context Protocol (MCP) Server
RustAPI features an embedded Model Context Protocol server. AI agents (like Claude Desktop or AGY agents) can query tools, inspect resources, and fetch prompts via JSON-RPC over Streamable HTTP at POST /mcp.
🛠️ Registering Tools (@app.tool)
import rustapi
app = rustapi.Engine()
@app.tool(description="Search product catalog for AI agents")
def search_catalog(category: str, max_price: float = 100.0):
return f"Found 5 items in {category} under ${max_price}"
📄 Registering Resources (@app.resource)
@app.resource(uri="config://system", mime_type="application/json")
def get_system_config():
return '{"status": "healthy", "region": "us-east"}'