Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sacra.com/llms.txt

Use this file to discover all available pages before exploring further.

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:
npm install @openai/agents

Environment variables

Configure the following:
SACRA_API_TOKEN=...
OPENAI_API_KEY=...
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.
import { Agent, MCPServerStreamableHttp, run } from "@openai/agents";

export async function generateCompanyBrief(domain: string = "openai.com") {
  const { OPENAI_API_KEY, SACRA_API_TOKEN } = process.env;

  if (!OPENAI_API_KEY) {
    throw new Error("Missing OPENAI_API_KEY");
  }
  if (!SACRA_API_TOKEN) {
    throw new Error("Missing SACRA_API_TOKEN");
  }

  const mcpServer = new MCPServerStreamableHttp({
    name: "sacra_research_tools",
    url: "https://mcp.sacra.com/mcp",
    requestInit: {
      headers: {
        Authorization: `Token ${SACRA_API_TOKEN}`,
      },
    },
  });

  const agent = new Agent({
    name: "CompanyBriefAgent",
    model: "gpt-5-mini",
    instructions: `
      You are a Company Brief Agent. Your goal is to create a concise
      investor-style company brief using Sacra MCP tools.

      First, use get_company_profile with the provided company_domain.
      Then use get_funding_rounds_for_company.
      Then use get_news_for_company for recent developments.
      If the company profile includes documents and one looks useful,
      you may use get_document_content to pull extra context from one
      relevant Sacra document.

      Format your response as follows:

      # [Company Name]

      **Overview:** [2-4 sentences on what the company does and why it matters]

      **Founding and key people:**
      - [founding year and key people]

      **Funding history:**
      - [important funding rounds, investors, valuations if available]

      **Recent developments:**
      - [important recent news items from Sacra]

      **Why it matters:**
      - [short investor-style takeaway]

      Keep the output concise, factual, and grounded in the Sacra tool results.
    `,
    mcpServers: [mcpServer],
  });

  try {
    await mcpServer.connect();
    const result = await run(
      agent,
      `Create a concise investor-style company brief for ${domain}. Include the business overview, founding and key people, funding history, recent developments, and why the company matters.`,
    );
    return result.finalOutput;
  } finally {
    await mcpServer.close().catch(() => {});
  }
}

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.