# MCP for agents / Agent 的 MCP 接入

Route: /docs/api/mcp
Updated: 2026-07-08

## English

# MCP for agents

Use MCP when an agent host should discover SorryAssets tools and generate digital assets without operating the GUI.

## What the MCP path is for

- List catalog capabilities and public model ids.
- Estimate cost before spending.
- Submit generation tasks.
- Poll task status.

The desktop app has its own local MCP bridge for app-connected workflows. Use the source MCP server when you want direct backend access.

## Host config

Build the source MCP server, then point your host at the compiled entry.

```bash
pnpm --filter @sorryassets/mcp build
```

```json
{
  "mcpServers": {
    "sorryassets": {
      "command": "node",
      "args": ["/absolute/path/to/apps/mcp/dist/mcp.js"],
      "env": {
        "SORRYASSETS_API_KEY": "sa_your_key",
        "SORRYASSETS_BASE_URL": "https://sorryassets.com"
      }
    }
  }
}
```

## Boundary

The agent holds only an account-scoped `sa_` key. It never receives provider credentials, upstream channel ids, wholesale prices, or upstream URLs.

Reasoning remains in the calling agent. SorryAssets is the generation and asset-workflow tool layer, not a server-side LLM.

## 中文

# Agent 的 MCP 接入

当 Agent host 需要发现 SorryAssets 工具，并在不操作 GUI 的情况下生成数字资产时，使用 MCP。

## MCP 路径负责什么

- 列出目录能力和公开模型 id。
- 在消费前估价。
- 提交生成任务。
- 轮询任务状态。

桌面应用有自己的本地 MCP bridge，用于和应用连接的工作流。如果你希望 Agent 直接访问后端，就使用源码里的 MCP server。

## Host 配置

先构建源码 MCP server，再让 host 指向编译后的入口。

```bash
pnpm --filter @sorryassets/mcp build
```

```json
{
  "mcpServers": {
    "sorryassets": {
      "command": "node",
      "args": ["/absolute/path/to/apps/mcp/dist/mcp.js"],
      "env": {
        "SORRYASSETS_API_KEY": "sa_your_key",
        "SORRYASSETS_BASE_URL": "https://sorryassets.com"
      }
    }
  }
}
```

## 边界

Agent 只持有账户级 `sa_` key。它不会拿到 provider 凭据、上游 channel id、批发价或上游 URL。

推理仍由调用方 Agent 完成。SorryAssets 是生成和资产工作流工具层，不是服务端 LLM。
