Skip to main content

Introduction

The mcp_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
mcp_server "My MCP Server" {
  description = "Handles basic database operations"
  canonical = "-T6UaAe0"
  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 = ["database"]
  tools = [{name: "get_user_record"}]
}

Parameter definition

ParameterRequiredDescription
descriptionnoOptional human-readable description of the server.
Example: description = "Handles basic database operations"
instructionsnoInstructions 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."
tagsnoA list of tags used to categorize and organize the server in your workspace.
Example: tags = ["database"]
toolsA 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.
https://mintlify.s3.us-west-1.amazonaws.com/xano-997cb9ee/images/vscode.svg

Try it out in VS Code

Use the XanoScript VS Code extension with Copilot to write XanoScript in your favorite IDE.
I