Skip to content

atlas.server

atlas.server

Atlas MCP server — single 'atlas' tool with dynamic description.

One tool, one string input. The tool description changes on every list_tools call to reflect the current project state (installed modules, available verbs). All routing goes through the Atlas runtime class.

build_description

build_description(atlas: Atlas) -> str

Return the dynamic tool description based on project state.

Source code in src/atlas/server.py
def build_description(atlas: Atlas) -> str:
    """Return the dynamic tool description based on project state."""
    if not atlas.is_initialized:
        return "Atlas project assistant. Run: atlas init — or: atlas list"

    modules = ", ".join(atlas.installed_modules)
    verbs = ["add", "create", "edit", "remove", "list", "sync"]

    if (
        atlas.router.find_all_with_command("check")
        or atlas.router.find_all_with_command("test")
    ):
        verbs.append("just")
    if atlas.router.has_category_installed("vcs"):
        verbs.append("vcs")
    if atlas.router.has_category_installed("platform"):
        verbs.append("crud")

    return (
        f"Atlas project assistant.\n"
        f"Modules: {modules}\n"
        f"Verbs: {', '.join(verbs)}\n"
        f"Retrieve: atlas <module> [filter] — "
        f"Syntax: spaces filter, commas combine, -- separates\n"
        f"Help: atlas list"
    )

build_input_help

build_input_help(atlas: Atlas) -> str

Return the dynamic input field description.

Source code in src/atlas/server.py
def build_input_help(atlas: Atlas) -> str:
    """Return the dynamic input field description."""
    if not atlas.is_initialized:
        return (
            "Atlas command string. "
            "Examples: 'init', 'list', 'list modules'"
        )

    examples: list[str] = []
    for name in atlas.installed_modules[:3]:
        examples.append(f"'{name}'")
    if len(atlas.installed_modules) > 1:
        pair = ", ".join(atlas.installed_modules[:2])
        examples.append(f"'{pair}'")

    example_str = ", ".join(examples) if examples else "'python', 'python linter'"
    return (
        f"Atlas command string. "
        f"Retrieve: {example_str}. "
        f"Verb: 'add <module>', 'just <task>', 'list modules'. "
        f"Passthrough: '<module> -- <message>'."
    )

build_prompt_list

build_prompt_list() -> list[Prompt]

Return the list of MCP prompts Atlas exposes.

Source code in src/atlas/server.py
def build_prompt_list() -> list[Prompt]:
    """Return the list of MCP prompts Atlas exposes."""
    return [
        Prompt(
            name="atlas-context",
            description="Project context — auto-injected at session start",
            arguments=[],
        )
    ]

build_prompt_result

build_prompt_result(
    atlas: Atlas, name: str
) -> GetPromptResult

Build the GetPromptResult for the named prompt.

Source code in src/atlas/server.py
def build_prompt_result(atlas: Atlas, name: str) -> GetPromptResult:
    """Build the GetPromptResult for the named prompt."""
    if name != "atlas-context":
        raise ValueError(f"Unknown prompt: {name!r}")
    if not atlas.is_initialized:
        text = "Atlas: project not initialized — run `atlas init`"
    else:
        text = atlas.build_session_brief()
    return GetPromptResult(
        messages=[
            PromptMessage(
                role="user",
                content=TextContent(type="text", text=text),
            )
        ]
    )

main_sync

main_sync() -> None

Synchronous entry point for console_scripts.

Source code in src/atlas/server.py
def main_sync() -> None:
    """Synchronous entry point for console_scripts."""
    import asyncio

    async def _run() -> None:
        async with stdio_server() as streams:
            await server.run(streams[0], streams[1], server.create_initialization_options())

    asyncio.run(_run())