Skip to main content
Glama
jankowtf

MCP Server Template for Cursor IDE

by jankowtf

fetch_railway_docs

Retrieve Railway CLI documentation directly within Cursor IDE to access deployment guides and command references.

Instructions

Fetches the most recent Railway CLI documentation. Optionally, provide a custom URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoOptional custom URL for fetching Railway CLI docs.

Implementation Reference

  • The core handler function that asynchronously fetches Railway CLI documentation from the given URL (default: https://docs.railway.app/guides/cli), returns the raw HTML as TextContent, and handles various errors like timeouts and HTTP errors.
    async def fetch_railway_docs(
        url: str = "https://docs.railway.app/guides/cli",
    ) -> list[types.TextContent]:
        """
        Fetch the most recent Railway CLI documentation.
        """
        headers = {
            "User-Agent": "MCP Railway Docs Fetcher (github.com/modelcontextprotocol/python-sdk)"
        }
    
        try:
            timeout = httpx.Timeout(10.0, connect=5.0)
            async with httpx.AsyncClient(
                follow_redirects=True, headers=headers, timeout=timeout
            ) as client:
                response = await client.get(url)
                response.raise_for_status()
    
                # Optionally, parse specific sections of the docs here
                return [types.TextContent(type="text", text=response.text)]
        except httpx.TimeoutException:
            return [
                types.TextContent(
                    type="text",
                    text="Error: Request timed out while trying to fetch the Railway CLI docs.",
                )
            ]
        except httpx.HTTPStatusError as e:
            return [
                types.TextContent(
                    type="text",
                    text=f"Error: HTTP {e.response.status_code} error while fetching the Railway CLI docs.",
                )
            ]
        except Exception as e:
            return [
                types.TextContent(
                    type="text", text=f"Error: Failed to fetch Railway CLI docs: {str(e)}"
                )
            ]
  • Dispatch logic within the main @app.call_tool() handler (fetch_tool) that checks for the tool name 'fetch_railway_docs' and invokes the handler with the provided or default URL.
    if name == "fetch_railway_docs":
        url = arguments.get("url", "https://docs.railway.app/guides/cli")
        return await fetch_railway_docs(url)
  • Tool object registration returned by @app.list_tools(), specifying the name, description, and input schema (optional 'url' parameter). This defines the tool for MCP clients.
    types.Tool(
        name="fetch_railway_docs",
        description="Fetches the most recent Railway CLI documentation. Optionally, provide a custom URL.",
        inputSchema={
            "type": "object",
            "properties": {
                "url": {
                    "type": "string",
                    "description": "Optional custom URL for fetching Railway CLI docs.",
                },
            },
        },
    ),
  • Input schema definition for the 'fetch_railway_docs' tool, specifying an optional 'url' string property.
    inputSchema={
        "type": "object",
        "properties": {
            "url": {
                "type": "string",
                "description": "Optional custom URL for fetching Railway CLI docs.",
            },
        },
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jankowtf/mcp-hitchcode'

If you have feedback or need assistance with the MCP directory API, please join our Discord server