Introduction
Themcp_server
primitive lets you define MCP servers using XanoScript.
Each MCP server corresponds to a collection of tools that an AI agent can access to perform specific tasks with your Xano backend — expressed in code.
MCP servers will typically:
- Declare their name and description
- Include instructions for the AI agent
- Reference existing tools in your workspace
- Support tagging for organization
Anatomy
Every XanoScript MCP server follows a predictable structure. Unlike other primitives, MCP servers are not split into multiple sections. Instead, they have a single block that contains all of the information needed to define the server. Here’s an example of a fully defined MCP server in XanoScript:XanoScript
Parameter definition
Parameter | Required | Description |
---|---|---|
description | no | Optional human-readable description of the server. |
Example: description = "Handles basic database operations" | ||
instructions | no | Instructions for LLMs using the server. While this field is not required, it is strongly encouraged to be used to help LLMs understand the server and its purpose. |
Example: instructions = "This MCP server is designed to handle basic database operations, such as retrieving, updating, adding, and deleting records. Process user queries with the available tools to complete their request to the best of your ability. Do not assume anything about the operation the user is requesting; ask for clarification before execution if necessary." | ||
tags | no | A list of tags used to categorize and organize the server in your workspace. |
Example: tags = ["database"] | ||
tools | ✅ | A list of tools that the server will reference. |
Example: tools = [{name: "get_user_record"}] |
What’s Next
Now that you understand how to define MCP servers in XanoScript, here are a few great next steps:Learn about AI Tools
Create the tools that your MCP server will reference and make available to AI agents.
Try it out in VS Code
Use the XanoScript VS Code extension with Copilot to write XanoScript in your favorite IDE.