Skip to main content
Sacra MCP can be used server-side with a normal Sacra API key. This is the recommended setup if you want to build a user-facing feature like a company brief generator, research copilot, or chat experience powered by Sacra tools. This example uses the OpenAI Agents SDK with Sacra’s MCP server over Streamable HTTP.

High-level flow

  1. Create a Sacra API key in your Organization Settings.
  2. Store it as SACRA_API_TOKEN in your server environment.
  3. Connect to https://mcp.sacra.com/mcp.
  4. Pass the API key in the Authorization header as Token YOUR_API_KEY.
  5. Run an agent that uses Sacra MCP tools to generate a company brief.

Prerequisites

Install dependencies:

Environment variables

Configure the following:
Do not commit API keys to source control.

Migration note for existing M2M users

If you previously used the legacy M2M flow, migrate to API key auth:
  • Remove the Stytch token exchange step.
  • Stop sending Authorization: Bearer ....
  • Use a Sacra API key from your Organization Settings.
  • Send it as Authorization: Token YOUR_API_KEY.

Example: Build a company brief generator

This example asks an agent to generate a concise investor-style company brief for openai.com using Sacra MCP tools.

What this example does

  • Connects directly to Sacra MCP at https://mcp.sacra.com/mcp
  • Authenticates with Authorization: Token YOUR_API_KEY
  • Uses Sacra MCP tools to gather company profile, funding, and recent news
  • Returns a concise company brief that can power a user-facing feature

Security notes

  • Store SACRA_API_TOKEN in a secure secret manager or server environment.
  • Never expose your API key in client-side code.
  • Rotate API keys from your Sacra organization settings if needed.