devtomcp

devtomcp

0

The Dev.to MCP Server is designed to interface with the Dev.to API, enabling functionalities such as searching, reading, and creating articles. It supports both MCP and REST modes, making it versatile for LLM integration and direct HTTP access.

πŸš€ Dev.to MCP Server

License: AGPL v3 Docker Dev.to API


An implementation of a Model Context Protocol (MCP) server for the Dev.to API, providing capabilities for searching, browsing, reading, and creating content on Dev.to.


✨ Features

FeatureDescription
πŸ” Browse Latest ArticlesGet the most recent articles from Dev.to
🌟 Browse Popular ArticlesGet the most popular articles
🏷️ Browse by TagGet articles with a specific tag
πŸ“š Browse by TitleGet articles with a specific title
πŸ“– Read ArticleGet detailed information about a specific article
πŸ‘€ User ProfileGet information about a Dev.to user
πŸ”Ž Search ArticlesSearch for articles using keywords
πŸ‘€ Search Articles by UserSearch all articles by a specific user
πŸ“ Get Article by IDGet detailed information about a specific article
πŸ“ Get Article by TitleGet detailed information about a specific article
🧠 Analyze ArticleAnalyze a specific article (prompt-based, summary output)
🧠 Analyze User ProfileAnalyze a specific user profile (prompt-based, summary output)
πŸ“ Create ArticleCreate and publish new articles
✏️ Update ArticleUpdate your existing articles
πŸ“ Update Article by TitleUpdate your existing articles by title (resolves to ID)
πŸ“œ List My ArticlesList your own published articles
πŸ“ List My Draft ArticlesList your own draft articles
πŸ“ List My Unpublished ArticlesList your own unpublished articles
πŸ“ List My Scheduled ArticlesList your own scheduled articles
πŸ§‘β€πŸ’» Publish Article by IDPublish your own articles by ID
πŸ“ Publish Article by TitlePublish your own articles by title
πŸ§‘β€πŸ’» Unpublish Article by IDUnpublish your own articles by ID
πŸ“ Unpublish Article by TitleUnpublish your own articles by title
πŸ“ Delete ArticleDelete your own articles

🧠 Analyze Tools

FeatureDescription
🧠 Analyze ArticleAnalyze a specific article (prompt-based, summary output)
🧠 Analyze User ProfileAnalyze a specific user profile (prompt-based, summary output)

Note: Analyze tools provide natural language summaries and insights, not raw data dumps.


πŸ“ License

This project is licensed under the GNU Affero General Public License v3.0 (AGPLv3).

COMMERCIAL USE WARNING

If you want to use or deploy this code in any form as a monetised service to others, even if you don't specifically require payment for the code, you need to contact me for permission (this means YOU Smithery/Glama or ANY similar services) - which will only be granted following payment of the appropriate licensing fee. No, you might not be charging for the use of the code itself, and you might be providing the infrastructure, but you'd be using MY code to facilitate YOUR service. That's an intrinsic dependency that MUST be licensed.

For anyone else, whether you're a business or individual, I hope it's of use to you. Enjoy.


βš™οΈ Server Configuration

The server can be configured using the following environment variables:

Environment VariableDescriptionDefault
PORTPort to run the server on8000
LOG_LEVELLogging level (INFO, DEBUG, etc.)INFO

πŸ” Client Authentication

Each client needs to provide their own Dev.to API key for authenticated operations. This is done securely by providing the API key as an environment variable in the client's MCP server configuration.

Note: The key should be provided as DEVTO_API_KEY in the environment section of your MCP client configuration.


πŸš€ Getting Started

🐳 Running with Docker

  1. Clone the repository:
git clone https://github.com/rawveg/devtomcp.git
cd devtomcp
  1. Build and run with Docker Compose:
docker-compose up --build

The server will be available at http://localhost:8000 with the SSE endpoint at http://localhost:8000/sse.


πŸ› οΈ MCP Tools

Analysing Content

  • analyse_article - Analyse a specific article
  • analyse_user_profile - Analyse a specific user

Browsing Content

  • browse_latest_articles() - Get the most recent articles from Dev.to
  • browse_popular_articles() - Get the most popular articles
  • browse_articles_by_tag(tag) - Get articles with a specific tag

Reading Content

  • get_article(id) - Get detailed information about a specific article
  • get_user_profile(username) - Get information about a Dev.to user

Searching Content

  • search_articles(query, page=1) - Search for articles using keywords
  • search_articles_by_user(username, page=1) - Search all articles by a specific user

Managing Content (requires authentication)

  • list_my_articles(page=1, per_page=30) - List your own published articles
  • list_my_draft_articles(page=1, per_page=30) - List your own draft articles
  • list_my_unpublished_articles(page=1, per_page=30) - List your own unpublished articles
  • create_article(title, content, tags="", published=False) - Create a new article
  • update_article(id, title=None, content=None, tags=None, published=None) - Update an existing article
  • delete_article(id) - Delete an existing article
  • publish_article_by_id(id) - Publish your own articles by ID
  • publish_article_by_title(title) - Publish your own articles by title
  • unpublish_article_by_id(id) - Unpublish your own articles by ID
  • unpublish_article_by_title(title) - Unpublish your own articles by title
  • update_article_by_title(title, new_title=None, content=None, tags=None, published=None) - Update an existing article by title (resolves to ID)

🌐 REST API & OpenAPI Tool Server

The Dev.to MCP Server now supports dual-mode operation:

ModeDescription
🟒 SSE/MCPFor LLM/agent integration, using the Model Context Protocol (MCP)
🟦 REST/OpenAPIFor direct HTTP access, OpenAPI tool runners, and OpenAI-compatible tools

🚦 Switching Modes

Set the mode in your .env file:

SERVER_MODE=sse   # For SSE/MCP (default)
# or
SERVER_MODE=rest  # For REST API & OpenAPI toolserver

πŸ”‘ Authentication in REST Mode

  • Provide your Dev.to API key in the Authorization header as a Bearer token:
    Authorization: Bearer YOUR_DEVTO_API_KEY
    
  • No need to set DEVTO_API_KEY in .env for REST mode.

πŸ“– OpenAPI & Swagger UI

πŸ§‘β€πŸ’» Example: List My Articles (REST)

curl -X GET "http://localhost:8000/list_my_articles?page=1&per_page=30&max_pages=10" \
  -H "Authorization: Bearer YOUR_DEVTO_API_KEY"

πŸ› οΈ REST Endpoints

  • All major tools are available as REST endpoints (see /docs for details)
  • Each endpoint includes rich OpenAPI metadata, examples, and tags for easy discovery
  • update_article_by_title - Update your own articles by title (resolves to ID)

πŸ€– Why This Matters

  • Use as a traditional REST API, an OpenAPI toolserver, or an LLM/agent tool providerβ€”all from one codebase!
  • Plug-and-play with OpenAI, LangChain, and any OpenAPI-compatible client
  • Beautiful, interactive documentation out of the box

πŸ–₯️ Client Configuration

Claude Desktop Configuration

Add the MCP server in Claude Desktop's config.json:

{
  "mcpServers": {
    "devto": {
      "url": "http://localhost:8000/sse"
    }
  }
}

Cursor Configuration

Add the MCP server in Cursor's configuration:

{
  "mcpServers": {
    "devto": {
      "url": "http://localhost:8000/sse"
    }
  }
}

NOTE

Some clients may require the use of serverUrl instead of url, eg: Windsurf IDE by Codium.

Programmatic Access with Python

import asyncio
import os
from fastmcp.client import Client

async def main():
    # Set environment variable for authentication
    os.environ["DEVTO_API_KEY"] = "your_dev_to_api_key_here"
    
    # Connect to the MCP server
    client = Client("http://localhost:8000/sse")
    
    # Use the client
    async with client:
        # Get popular articles
        results = await client.call_tool("browse_popular_articles", {})
        print(results)

if __name__ == "__main__":
    asyncio.run(main())

☁️ Deploying to Google Cloud Run

For deploying to Google Cloud Run:

  1. Follow the Google Cloud Run Quickstart to set up your environment

  2. Set up your Dev.to API key as a secret:

    gcloud secrets create devto-api-key --data-file=- <<< "your_api_key_here"
    
  3. Deploy with the secret mounted in SSE mode:

    gcloud run deploy devtomcp \
       --source . \
       --platform managed \
       --allow-unauthenticated \
       --region [REGION] \
       --set-env-vars="LOG_LEVEL=<<LOG_LEVEL>>" \
       --set-env-vars="DEVTO_API_KEY=<<DEVTO_API_KEY>>" \
       --set-env-vars="SERVER_MODE=sse" \
       --set-env-vars="DEVTO_API_BASE_URL=<<DEVTO_API_BASE_URL>>" \
       --format="json"
    

    Environment Variables

    VariableDescriptionDefault
    LOG_LEVELLogging level (INFO, DEBUG, etc.)INFO
    DEVTO_API_KEYDev.to API keyNone
    DEVTO_API_BASE_URLDev.to API base URLhttps://dev.to/api
    SERVER_MODEThe server mode to deploy insse

    These variables must be set on the command line for gcloud run deploy as the .env file is not mounted to the container.

    Alternative deploy in REST mode with OpenAPI Tools:

    gcloud run deploy devtomcp \
       --source . \
       --platform managed \
       --allow-unauthenticated \
       --region [REGION] \
       --set-env-vars="LOG_LEVEL=<<LOG_LEVEL>>" \
       --set-env-vars="SERVER_MODE=rest" \
       --set-env-vars="DEVTO_API_BASE_URL=<<DEVTO_API_BASE_URL>>" \
       --format="json"
    

    Environment Variables

    VariableDescriptionDefault
    LOG_LEVELLogging level (INFO, DEBUG, etc.)INFO
    SERVER_MODEServer mode to deploy inrest
    DEVTO_API_BASE_URLDev.to API base URLhttps://dev.to/api

    These variables must be set on the command line for gcloud run deploy as the .env file is not mounted to the container.

Region Selection The region should be selected according to the region of your associated project. A list of available regions can be found here.

⚠️ Security Warning - SSE Mode:

  • The --allow-unauthenticated flag makes your server publicly accessible

  • Since this is a single-user server with your API key, you MUST implement additional security measures:

  • When deploying in REST mode (recommended for Cloud Run) the above security considerations don't apply, as each request to the server in this mode needs to be accomanied by an Authorization Bearer Token Authorization: Bearer <<your_dev_to_api_key_here>> immediately limiting destructive access.

See for detailed security configuration instructions.


⚠️ Error Handling

The server returns standard MCP error responses:

{
  "status": "error",
  "message": "Error description",
  "code": 401
}

Common error codes:

  • 401: Authentication failed (missing or invalid API key)
  • 404: Resource not found
  • 422: Invalid parameters
  • 500: Server error

πŸ”’ Security Considerations

  • The server uses environment variables for API key configuration, providing proper security isolation
  • Each client connection uses its own configured API key
  • All API credential handling happens server-side
  • Use HTTPS in production environments
  • Use secure secret management for API keys in cloud deployments

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


πŸ™ Acknowledgments


πŸ“¬ Contact

For questions, suggestions, or support, please open an issue.