devto-article-mcp

devto-article-mcp

Enables validation and fixing of Dev.to markdown articles locally, and creation of unpublished drafts via the Forem API.

Category
访问服务器

README

Dev.to Article MCP

An offline-first Model Context Protocol server that lets Kiro validate repository-native Dev.to Markdown, preview/apply conservative frontmatter fixes, and create a real unpublished Dev.to draft through the official Forem API.

Why this MCP exists

Kiro can edit files, but it does not inherently know this repository's article tree, publishing constraints, changed-file set, or safe draft workflow. This server adds deterministic diagnostics and a guarded bridge from local content to Dev.to without exposing publish, update, delete, browse, or community-API tools.

Requirements

  • Node.js 24+
  • npm
  • Git (for validate_changed_articles)
  • A Dev.to API key only for live draft creation

Setup

npm ci
npm run build

Configure the built stdio server in your MCP host. Prefer loading secrets from a gitignored .env via Node's --env-file (do not put the real key in mcp.json):

{
  "mcpServers": {
    "devto-article-mcp": {
      "command": "node",
      "args": [
        "--env-file=/absolute/path/devto-article-mcp/.env",
        "/absolute/path/devto-article-mcp/dist/src/index.js"
      ],
      "env": {
        "WORKSPACE_ROOT": "/absolute/path/to/your/repository",
        "ARTICLES_ROOT": "articles"
      }
    }
  }
}

Create .env from .env.example and set DEVTO_API_KEY there. Never commit .env.

Tools

  • validate_article(file) — validate one workspace-relative Markdown file.
  • validate_articles(directory?) — recursively validate Markdown (defaults to ARTICLES_ROOT).
  • validate_changed_articles(base?) — validate staged, unstaged, untracked, or base-relative articles.
  • fix_article(file, mode, hashes, decisions?) — preview or atomically apply the exact reviewed fix plan.
  • create_devto_draft(file) — validate, then create an unpublished draft with published: false.

All tools remain registered without DEVTO_API_KEY; only draft creation returns API_KEY_MISSING. The default test suite and all validation/fixing work fully offline.

Typical Kiro flow

  1. “Validate articles/demo.md.”
  2. Review the path, line, stable rule ID, and suggested correction.
  3. “Preview fixes for that article.”
  4. Explicitly confirm ambiguous changes such as replacing dev-to with devto, then apply.
  5. Revalidate.
  6. “Create an unpublished Dev.to draft from articles/demo.md.”
  7. Open the returned real Dev.to draft URL and verify it remains unpublished.

The request builder strips local frontmatter from body_markdown, maps supported metadata into JSON, and always forces published: false. Local IDs and dates are never used for remote updates.

Configuration

Variable Default Purpose
WORKSPACE_ROOT / DEVTO_WORKSPACE_ROOT process cwd Trusted repository root
ARTICLES_ROOT articles Relative article directory
DEVTO_API_KEY unset Forem credential for draft creation
DEVTO_API_BASE_URL https://dev.to/api Forem API endpoint
LOG_LEVEL info debug, info, warn, or error
MAX_FILE_SIZE_BYTES 1048576 Bounded article read size
PHASE2_LIQUID false Enable optional Liquid diagnostics

Verification

npm test
npm run typecheck
npm run build
npm run test:coverage

The offline suite uses deterministic property-test seeds and is designed to complete in under 30 seconds. A manual command creates one real side-effecting draft:

DEVTO_API_KEY=... npm run smoke:live-draft -- articles/demo.md

This command is intentionally excluded from CI. See docs/runbook.md for troubleshooting and docs/demo/README.md for the recording checklist.

Safety and limitations

  • Workspace containment rejects traversal, outside absolute paths, and symlink escapes.
  • Reads are bounded and require valid UTF-8.
  • Validation and draft creation never modify local files.
  • Fix apply uses dual hashes and same-directory atomic replacement.
  • API keys are never emitted in tool output or logs.
  • The remote surface creates drafts only; it cannot publish or mutate existing posts.
  • HTML <img> validation and Liquid detection are outside the default MVP rule set.

Architecture

The stdio MCP layer calls isolated tool handlers over a core pipeline: path safety → bounded read → YAML/Markdown parsing → pure rule evaluation → deterministic result aggregation. Git detection, fixing, and the Forem client are separate adapters with structured operational errors.

Demo video: https://youtu.be/Mm0uAhi0jcs

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选