AI Assistant Integration

TLang ships a Model Context Protocol server that gives AI coding assistants — Claude, Cursor, GitHub Copilot, and others — full access to TLang's compiler, runtime, and embedded documentation. The MCP server turns any MCP-compatible assistant into a TLang-aware pair programmer.

Starting the MCP Server

      tlang mcp-server
    

The server communicates over stdin/stdout using JSON-RPC 2.0, following the MCP 2024-11-05 specification. Connect it to your AI assistant using the assistant's MCP configuration. Example configuration for Claude Desktop (claude_desktop_config.json):

      {
        "mcpServers": {
          "tlang": {
            "command": "tlang",
            "args": ["mcp-server"]
          }
        }
      }
    

Available Tools

The MCP server exposes a set of tools that mirror the TLang CLI. The assistant can call these tools directly during a conversation:

When a project context is active, the server also exposes dynamic tools derived from the project's exposed functions, allowing the assistant to call specific generators directly.

Resources

The MCP server exposes embedded documentation as resources the assistant can read to understand TLang before generating code:

These resources are served directly from the binary — no internet connection required.

System Prompt

The MCP server provides a ready-made system prompt for AI assistants. When connected, the assistant automatically receives context about:

This eliminates the need to paste TLang documentation into every conversation. The assistant starts with full context.

AI-Native Workflow

The intended workflow with TLang and an AI assistant:

  1. Describe your model to the assistant (entities, fields, relationships)
  2. The assistant writes the TLang templates using set declarations and template blocks
  3. The assistant calls tlang_both to compile and run the templates
  4. TLang generates all target files — the assistant reviews the output
  5. You add more entities or refine the templates — the assistant regenerates

The AI does the creative work (understanding your domain and writing the template) once. TLang handles the mechanical work (generating the same pattern across all entities) at zero additional AI cost. A project with 200 entities costs the same in AI tokens as a project with 2 — because the AI writes one template, not 200 files.

Project Context

Use the set_project_context tool to point the MCP server at a TLang project:

      # In the assistant conversation:
      # "Set the project context to my-app/"
    

Once set, the server indexes the project and exposes its exposed functions as dynamic tools. The assistant can then call your project's generators directly without writing any CLI commands.