# Populate the knowledge base

This page fills the help center from the product you are in. Creating the center, the public site, and a custom domain is [Set up Knowledge](https://www.saasco.com/docs/knowledge/setup.md). Walk the codebase, decide the collections, and write the articles a customer would search for in each one. Every claim comes from the repo, the public site, or docs the user pointed at.

The project already has a help center, a **Get started** collection, and an article named **How your help center works**. That article is a sample. Replace it with a real getting-started article for this product, or delete it once **Get started** has one. Do not create a second help center, and do not add a second collection with the same name.

## 1. Use the Saasco MCP

If Saasco is not connected, read https://www.saasco.com/docs/mcp.mdx and follow the steps for this client. Sign in, allowing "Create and change data in your projects". Search with `saasco_search_tools`, then run the tool with `saasco_execute_tool`.

Pass project id `YOUR-PROJECT-ID` on every knowledge tool. On a connection scoped with `?projectId=`, omit `projectId`. Live and test are different projects. Write to the id you were given.

## 2. Read what is already there

Call `knowledge_getHelpCenter` with `YOUR-PROJECT-ID`. If it returns null, call `knowledge_createHelpCenter` with `displayName` set to the product name.

Call `knowledge_listCollections` with that help center id. Note each collection name and the article titles already in it. The `url` on the help center is the public path, such as `/help/acme`. A link to an article is that path plus `/articles/` and the article slug.

The public site is on when a collection has a published public article. A draft or an internal article does not put it on. Do not delete the help center.

## 3. Map collections and articles from the codebase

Read the repo the user has open. Follow the routes, screens, and README, and the public site when it has one. Group what a customer can do into collections. Name each collection for that part of the product, using the noun the product uses.

Keep **Get started** for the first things a new customer does. Add a collection for each other area you found in the code. Skip a name that `knowledge_listCollections` already returned.

For each collection, list the articles a customer would search for to do the tasks that area supports. One article is one task or one question. Include a task only when the code, the site, or the docs the user pointed at show it. Skip implementation detail a customer would not search for.

Call `knowledge_createCollection` for each new collection:

- `projectId`: `YOUR-PROJECT-ID`
- `helpCenterId`: the id from `knowledge_getHelpCenter`
- `name`: the area you found
- `description`: one sentence, optional

Write that list down before you draft. The list is the job. A later step does not add topics the code does not have, and it does not stop while a collection on the list still has an unwritten article.

## 4. Write each article

Take the articles on the map one collection at a time.

Read one Saasco article with a similar job before you write, such as a how-to or a settings page. These reads are plain HTTP to production. Do not use the MCP for them.

List the catalog:

```
GET https://www.saasco.com/api/v2/knowledge/help-centers/cmpq1dx7g0000psp7t3pgo3lp/collections
```

Each collection includes article titles and slugs. Fetch the one article whose job matches:

```
GET https://www.saasco.com/api/v2/knowledge/articles/{slug}?helpCenterId=cmpq1dx7g0000psp7t3pgo3lp
```

`body` is HTML. Use it for shape: how it opens, the order of sections, how long each section is, where a screenshot sits, and how it ends. The words, title, and facts are this product's.

Confirm every sentence against the repo or the running product. Where this product has no equivalent for a section, leave that section out. Add a section only for behavior a reader needs that the example did not cover.

Call `knowledge_createArticle`:

- `projectId`: `YOUR-PROJECT-ID`
- `title`: what a customer would search for
- `description`: one sentence
- `body`: HTML
- `collectionId`: the collection it belongs in
- `type`: `public`
- `state`: `published` when the article matches the product, `draft` when you are unsure

The slug comes from the title. You are the author, because the call runs as the signed-in user. To replace **How your help center works**, call `knowledge_updateArticle` on that article (a new title gets a new slug). If **Get started** already has a real article and the sample is still there, call `knowledge_deleteArticle` on the sample.

When the example article has a screenshot, capture the equivalent screen in this product. Use dummy data, one theme for every shot, and crop to the component with clear space around it and no browser chrome. When a good shot is not possible, leave the image out. Upload with `knowledge_uploadArticleImage` (`pathPrefix` is the article slug) and embed the returned `https://storage.saasco.com` URL in `body`.

A link to another article in this help center uses the help center `url`, `/articles/`, and that article's current slug from the create or update response. Call `knowledge_getArticle` before you update an article. Write only through the MCP. If a call fails, stop and report it.

## 5. Finish the map

Every collection on the map has its articles, published or draft. **How your help center works** is either rewritten for this product or deleted. Then stop.
