Menu: Add an AI API to your app from your editor

Guides

Add an AI API to your app from your editor

Use the Scalaix MCP server and the add_scalaix_endpoint prompt to draft, test, publish and call an endpoint without leaving your editor.

With the Scalaix MCP server connected, your coding assistant can build an endpoint in Scalaix and wire it into the code you have open. This guide adds a support-ticket classifier to an app, start to finish.

1. Connect the server

In Claude Code:

claude mcp add --transport http scalaix https://www.scalaix.com/mcp

Run /mcp, choose scalaix → Authenticate, and approve access in the browser. Leave Build and test endpoints and Publish versions ticked. Tick Manage API keys too if you want the assistant to create the key for you. Other clients: see Connect.

2. Run the prompt

The server ships a prompt, add_scalaix_endpoint. In Claude Code it's a slash command:

/mcp__scalaix__add_scalaix_endpoint "classify support tickets into billing, bug or other with a priority from 1 to 5"

In other clients, pick Add a Scalaix endpoint from the prompts menu, or just ask: "Use Scalaix to add an endpoint that classifies support tickets…".

3. What the assistant does

The prompt has it work in this order, telling you what it's doing:

  1. Reads your code to see the language, the HTTP client, how configuration is loaded and what data the call will have.
  2. Picks a project and collection (list_projects, list_collections), or asks you.
  3. Drafts the endpoint with draft_endpoint: inputs named after the data your code has, and an output schema with exactly the fields your code needs. Nothing is saved yet.
  4. Tests it with test_endpoint and realistic inputs from your code, and adjusts the prompt or schema until the output is right.
  5. Saves and publishes with create_endpoint and publish_collection. It asks first if the collection is already live.
  6. Writes the call with get_integration_code in your language. TypeScript, Python, Go, Java and C# get typed request and response models generated from the endpoint, so the compiler checks the fields you use.
  7. Handles the key: the code reads SCALAIX_API_KEY from the environment. With your OK it calls create_key and puts the key in your git-ignored .env (and SCALAIX_API_KEY= in .env.example), never in source code.
  8. Wires it in and adds a test that mocks the HTTP call.

4. Check the result

  • The endpoint is in the console under the collection you chose, with the version it published and its docs at www.scalaix.com/<project>/<collection>.
  • Calls from your app show up in the project's Usage and in the developer pane's Logs.
  • To change the endpoint later, ask the assistant: it uses update_endpoint, tests, and publishes a new version. Pin a version with ?version= in your code if you want changes to be opt-in.