Connect an MCP server

Connect an MCP server so your agent can use its tools. With Linear, for example, you can give it tools to search and create issues.

To manage Platica from an assistant such as Claude, use the Platica MCP server.

Before you start

You need an agent, its id in AGENT_ID and the MCP server's URL.

  • If the server needs no credentials, start at step 2.
  • If it uses OAuth, follow If the server uses OAuth.
  • If it uses a token, store it as a secret in step 1.

To use the platform, see Connect an MCP server.

  1. Store the credential as a secret

    Send the token when you create the secret. Later reads don't return its value. (Create a secret)

    import { Platic } from "platic-sdk";
    
    const platic = new Platic({ apiKey: process.env.PLATIC_API_KEY! });
    const agentId = process.env.AGENT_ID!;
    
    const secret = await platic.secrets.create({
      name: "Linear · token",
      kind: "bearer",
      value: process.env.LINEAR_TOKEN!,
    });

    Keep the secret's id in SECRET_ID.

  2. Connect the server

    Platica tests it in the same call and tells you which tools it offers. (Connect an MCP server)

    const server = await platic.tools.mcp.create({
      name: "Linear",
      url: "https://mcp.linear.app/mcp",
      auth: { type: "bearer" },
      secrets: { "auth.token": secret.id },
    });

    Save the server's id in MCP_ID. Check discoveredTools to choose the tools you need. If verified is false, follow nextStep.

  3. Choose which tools to install

    Select the tools the agent needs. This example installs search_issues and create_issue. (Choose tools)

    const synced = await platic.tools.mcp.syncTools(server.id, {
      tools: ["search_issues", "create_issue"],
    });

    Send the complete list of tools you want to keep. Omitted tools are uninstalled. The response includes their ids in installedTools, in each tool's id field.

  4. Connect them to the agent

    Each tool is connected separately, with its id. It applies right away, without publishing the agent. (Connect a tool)

    for (const tool of synced.installedTools) {
      await platic.agents.tools.connect(agentId, tool.id);
    }

Check it worked

Use List the agent's tools to check that both Linear tools are assigned. Ask the agent to find a known issue and check the result.

If you change the connection later, the server goes back to pending_config: bind the secret again, test it and choose the tools again. The connections to your agents are kept. See Update an MCP server.

If the server uses OAuth

Some servers don't accept a fixed token: a person has to sign in and authorize. Skip step 1 and, in step 2, connect the server with "auth": { "type": "oauth2" } and no secrets. Then ask for the authorization page. (Start OAuth)

const { authorizeIn } = await platic.tools.mcp.startOAuth(server.id);

// When the person authorizes:
await platic.tools.mcp.test(server.id);

Open authorizeIn with an account that has access to the workspace and complete authorization. You don't need to send or receive OAuth tokens through the API. Then continue with step 3.

Next steps