Skip to content
← Blog

Publish Articles With Coding Agents

Learn how to use Claude Code, Codex, and other coding agents to publish articles through a CMS API, CLI, MCP server, or Git repository.

Coding agents such as Claude Code and Codex can write articles and publish them to your site. To make this work, you connect the agent to your content management system (CMS), which is the software that stores and displays your pages. You can connect through an API, which lets one program send requests to another. You can also use a command-line tool (CLI) that runs typed commands, or an MCP server. MCP stands for Model Context Protocol, a standard that lets an agent call tools provided by another program.

A safe setup saves each article as a draft first. You check the text and the preview page, then you publish it yourself. WordPress and Ghost both offer APIs for managing posts. A GitHub commit, which saves a set of changes in a repository, only goes live if your repository is connected to a site build and deploy setup.

Separate writing from publishing

A coding agent can write the article text along with details like the title and tags. A separate script or service should send that article to WordPress, Ghost, or a Git repository. That script handles sign-in credentials and required fields, and it sets the publishing status.

This separation matters because running code or using MCP does not give an agent automatic access to your CMS. Claude Code supports programmatic use and MCP connections. Codex supports command-line workflows and MCP server connections. Neither feature gives you a built-in connection to every CMS.

A successful command or API response does not prove that readers can see the right page. The CMS might save the post as a draft, or a Git commit might still be waiting for a deployment. Always check the live page or preview before you treat the job as done.

Choose between an API, a CLI, and an MCP server

Each connection method links your agent to a publishing action in a different way.

Route How it works Best fit Main limitation
API A script sends article data to a platform endpoint. Repeatable publishing with control over fields and status. Each platform has its own login method and content format.
CLI The agent runs a command that calls a script or publishing tool. Local development and existing Git workflows. Commands are usually built for one project or platform.
MCP An MCP server exposes publishing actions as tools for the agent. Letting an agent call CMS actions through a clear interface. The server still needs platform-specific code and permissions.

The MCP specification defines stdio and Streamable HTTP as standard transports. A transport is the channel an MCP client, such as your agent, uses to talk to an MCP server. Those transports do not include a ready-made tool for WordPress or Ghost.

For your first setup, pick the route your site already supports. A CMS API works well for direct content management. A CLI fits a repository that already builds and deploys your site. MCP makes sense when you want an agent to call a publishing service through named tools.

Publish to WordPress or Ghost

WordPress accepts new posts through its REST API at POST /wp/v2/posts. A request can include the title and content, plus an excerpt and featured media. You can also attach categories and tags, and you can set a status. The API documents five status values:

  • draft
  • pending
  • private
  • future
  • publish

Your publisher script can map the article fields to WordPress and set the status to draft. After you review the post, a second action can change the status to publish. WordPress.com also requires authentication before you create a post. Check the permissions and settings on your specific site, because plugins and custom fields can change what the API expects.

Ghost offers an Admin API for creating and managing posts. Your agent can write the draft, and a script or MCP server can send it to Ghost through that API. Check Ghost’s current documentation for authentication rules. The docs also list the supported API version and the content format Ghost expects. Having access to the Ghost API does not mean Claude Code or Codex already has permission to use it.

Publish from a Git repository

A Git workflow works well if your site stores articles as Markdown files, which are plain-text files with simple formatting marks. The agent creates or edits a file in your content folder. It then commits the change locally or pushes it to GitHub.

You can also use GitHub’s repository contents API to create or update a file. To update an existing file, you must send its current blob SHA, which is the unique ID of the version already stored. The API also requires a commit message and the right repository permissions.

A commit does not make an article public on its own. Your repository must connect to a build process that publishes the site online. After you commit, check that the deployment finished and that the live page looks right.

Connect Claude Code or Codex

Claude Code connects to local MCP servers using stdio and to remote servers using HTTP. You can add and check MCP servers using its command-line tools. Codex also documents how to configure and list MCP servers. In both cases, the server must provide the publishing actions you need.

A publishing MCP server might offer one tool to create a draft and another tool to publish an approved post. The server author designs those tools, since MCP does not define standard publishing commands. The server author decides which actions exist and what each action can change.

Keep the difference between an MCP client and an MCP server clear. Codex can act as a client that connects to MCP servers. OpenAI’s developer documentation states that the Codex MCP server was removed in a September 2026 update. Even without that server, Codex can still connect to other MCP servers as a client.

Other coding agents follow the same pattern if they support running commands or connecting to MCP servers. Check your specific agent version and server setup before you rely on them together.

Review articles before publishing

A draft-first workflow gives you a clear step to check an article before readers see it. Ask the agent to write the article in a consistent format such as Markdown. Then check the fields and links before you send it to your CMS.

Check both the factual claims and the rendered page. A CMS API only stores content, so it will not fact-check the text for you. A successful tool call also does not prove that images and links work on the live page.

Keep draft creation separate from publishing. If you allow the agent to publish directly, make it a deliberate step after your review. This lowers the risk of an unfinished or inaccurate post going live because of a wrong command.

Protect your publishing access

Publishing credentials let a program change your site or repository. Give each integration only the permissions it needs. Keep tokens out of prompts and article files, and never commit them to version control.

Treat MCP servers like any other trusted software. OpenAI warns that an untrusted server can misuse data shared through tools or modify your data. Connect only to servers you trust, and check what each tool is allowed to do.

Plan for retries as well. If a request times out, the agent may not know whether the CMS created the post. Sending the request again can create a duplicate. Before you retry, check the destination for an existing post or commit.

Check platform API limits

API support varies by platform. WordPress and Ghost both document APIs that can create posts. GitHub supports file changes that can trigger a site deployment. Medium is different. Medium’s Help Center, updated November 13, 2026, states that it is not issuing new integration tokens or allowing new integrations. Existing tokens still work, so API-based publishing is a poor default for new Medium setups.

Check your platform’s current documentation before you build an integration. Login methods and permissions depend on the platform, and required fields depend on how your site is configured.

Consider an article publishing service

Unspar is an option if you want article research and publishing without writing your own CMS integration code. It finds topics and researches them. It can write in your voice and fact-check each article.

Unspar can publish to:

  • WordPress or Ghost
  • Medium
  • a GitHub repository or a webhook

Coding agents can connect to Unspar through its REST API. Unspar also provides a CLI and an MCP server.

Unspar focuses on articles and posts. It does not offer ad copy or social media scheduling, and it does not include the live content-score editor found in tools like Surfer or Frase. It is also newer than established tools like Jasper or Surfer, and less known than Copy.ai. Check the current Unspar pricing before you choose a plan.