I want to connect Claude AI to my OutSystems 11 Personal Environment. Could you please explain the integration process step by step?
If possible, could you also provide an OML file that I can import into OutSystems Service Studio and use as a reference to understand how to connect Claude AI with my OutSystems application?
Please explain each step in detail, including API configuration, authentication, REST API integration, and how to display Claude's responses on an OutSystems screen.
Thank you for your help!
Hi,
Did you already read OutSystems MCP - OutSystems 11 Documentation?
@Sunil Rajput : You can find the exact steps using Claude Code @ https://www.outsystems.com/forums/discussion/107095/unable-to-browse-os-11-mcp-url-getting-405/#Post471220
Hi Sunil,
The MCP links above are about letting Claude work on your code in Service Studio. If what you want is for your app to call Claude at runtime (user types a prompt, the screen shows Claude's answer), you consume the Anthropic Messages API as a regular REST API. Steps:
1. Get an API keyCreate one in the Claude Console (console.anthropic.com). Never put it in client-side logic. Store it in a Site Property (e.g. ClaudeApiKey, Text) and set its value in Service Center, so it only lives on the server.
ClaudeApiKey
2. Consume the REST methodLogic tab > Integrations > REST > right-click > Consume REST API > Add single method. - Method: POST https://api.anthropic.com/v1/messages - Headers: x-api-key (make it an input parameter), anthropic-version: 2023-06-01, content-type: application/json - Request body example:{"model":"MODEL_ID","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]} - Response body example:{"id":"msg_01","type":"message","role":"assistant","content":[{"type":"text","text":"Hi! How can I help?"}],"stop_reason":"end_turn","usage":{"input_tokens":10,"output_tokens":8}} Click Test with your key, then Copy to response body, and Finish. Service Studio generates the request/response structures for you. Replace MODEL_ID with a current model ID from the models page in Anthropic's docs (docs.claude.com).
POST https://api.anthropic.com/v1/messages
x-api-key
anthropic-version: 2023-06-01
content-type: application/json
{"model":"MODEL_ID","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}
{"id":"msg_01","type":"message","role":"assistant","content":[{"type":"text","text":"Hi! How can I help?"}],"stop_reason":"end_turn","usage":{"input_tokens":10,"output_tokens":8}}
3. Wrap it in a server actionCreate AskClaude (input Prompt, output Answer): - Build the request: model, max_tokens, and a Messages list with one item (role = "user", content = Prompt). - Call the REST method, passing Site.ClaudeApiKey to the x-api-key header. - Assign Answer = Response.content.Current.text (or loop the content list and concatenate the items where type = "text").
AskClaude
Prompt
Answer
Site.ClaudeApiKey
Answer = Response.content.Current.text
4. Show it on a screenScreen with a local variable Prompt bound to an Input (or Text Area), a local variable Answer, a Button whose client action calls AskClaude and assigns the output to Answer, and an Expression showing Answer. For a chat, keep a list of {role, content} records, append the user message and Claude's reply each turn, and send the whole list in messages so Claude has the conversation context.
messages
5. Things to handle - Errors: 401 = bad key, 429 = rate limit, 529 = overloaded. Add an Exception Handler and show a friendly message. - Long answers can take a while: raise the REST method Timeout if needed and show a loading state on the button. - Optional: the system field in the body lets you give Claude instructions for your app (tone, language, what it should and shouldn't answer).
system
Hope this helps!