> ## Documentation Index
> Fetch the complete documentation index at: https://spec.conveniencepro.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# ConveniencePro Tool Protocol

> Open specification for browser-native developer tools with MCP compatibility

# ConveniencePro Tool Protocol (CTP)

**Version 1.0.0** | [GitHub](https://github.com/titan-alpha/ctp)

CTP is an open specification for building browser-native developer tools that are inherently compatible with the [Model Context Protocol (MCP)](https://modelcontextprotocol.io). It enables developers to create tools that work seamlessly in web browsers while maintaining full interoperability with AI-powered development environments.

## Why CTP?

<CardGroup cols={2}>
  <Card title="Browser-Native" icon="browser">
    Tools execute directly in the browser using Web APIs, ensuring privacy and eliminating server dependencies.
  </Card>

  <Card title="MCP Compatible" icon="plug">
    Automatic conversion to MCP format enables integration with Claude, Cursor, and other AI tools.
  </Card>

  <Card title="Type-Safe" icon="shield-check">
    Full TypeScript support with comprehensive schemas and validation.
  </Card>

  <Card title="LLM-Ready" icon="robot">
    Built-in AI hints and instructions help LLMs use your tools effectively.
  </Card>
</CardGroup>

## Quick Example

```typescript theme={null}
import type { ToolDefinition, ToolFunction } from '@conveniencepro/ctp-core';

export const myToolDefinition: ToolDefinition = {
  id: 'hello-world',
  name: 'Hello World',
  description: 'A simple greeting tool',
  category: 'utilities',
  tags: ['hello', 'greeting', 'demo'],
  method: 'POST',
  parameters: [
    {
      name: 'name',
      type: 'text',
      label: 'Your Name',
      description: 'Name to greet',
      required: true,
    },
  ],
  outputDescription: 'Greeting message',
  example: {
    input: { name: 'World' },
    output: { message: 'Hello, World!' },
  },
  executionMode: 'client',
};

export const myToolFn: ToolFunction<{ message: string }> = (params) => {
  return {
    success: true,
    data: { message: `Hello, ${params.name}!` },
  };
};
```

## Architecture

```mermaid theme={null}
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor':'#ffffff','primaryTextColor':'#0f172a','primaryBorderColor':'#6366f1','lineColor':'#475569','secondaryColor':'#f8fafc','tertiaryColor':'#fefce8','clusterBkg':'#ffffff','clusterBorder':'#cbd5e1','fontSize':'15px','fontFamily':'ui-sans-serif, system-ui, -apple-system, sans-serif'}}}%%
flowchart TB
    subgraph core["&nbsp;<br/><b>Core Packages</b><br/>&nbsp;"]
        direction LR
        A["<b>@conveniencepro/ctp-core</b><br/><i>Types & Validation</i>"]
        B["<b>@conveniencepro/ctp-runtime</b><br/><i>Execution Engine</i>"]
        C["<b>@conveniencepro/ctp-discovery</b><br/><i>OpenAPI & Manifests</i>"]
    end

    A --> B --> C

    SPACER1[" "]

    subgraph sdk["&nbsp;<br/><b>Embeddable SDK</b><br/>&nbsp;"]
        D["<b>@conveniencepro/ctp-sdk</b><br/><i>Widget with Autosense</i>"]
    end

    C --> SPACER1
    SPACER1 --> D

    SPACER2[" "]

    subgraph output["&nbsp;<br/><b>Discovery Formats</b><br/>&nbsp;"]
        direction LR
        E["<b>OpenAPI 3.1</b>"]
        F["<b>MCP Manifest</b>"]
        G["<b>llms.txt</b>"]
    end

    D --> SPACER2
    SPACER2 --> E
    SPACER2 --> F
    SPACER2 --> G

    classDef coreStyle fill:#ffffff,stroke:#6366f1,stroke-width:3px,color:#0f172a,rx:12,ry:12
    classDef sdkStyle fill:#ffffff,stroke:#3b82f6,stroke-width:3px,color:#0f172a,rx:12,ry:12
    classDef outputStyle fill:#ffffff,stroke:#10b981,stroke-width:3px,color:#0f172a,rx:12,ry:12
    classDef spacerStyle fill:none,stroke:none,color:transparent

    class A,B,C coreStyle
    class D sdkStyle
    class E,F,G outputStyle
    class SPACER1,SPACER2 spacerStyle

    style core fill:#fefce8,stroke:#ca8a04,stroke-width:4px,stroke-dasharray:0,rx:16,ry:16,color:#422006
    style sdk fill:#eff6ff,stroke:#2563eb,stroke-width:4px,stroke-dasharray:0,rx:16,ry:16,color:#1e3a8a
    style output fill:#f0fdf4,stroke:#059669,stroke-width:4px,stroke-dasharray:0,rx:16,ry:16,color:#14532d

    linkStyle default stroke:#475569,stroke-width:3px
```

## npm Packages

| Package                                                                                      | Description                               |
| -------------------------------------------------------------------------------------------- | ----------------------------------------- |
| [`@conveniencepro/ctp-core`](https://npmjs.com/package/@conveniencepro/ctp-core)             | Core types and validation                 |
| [`@conveniencepro/ctp-runtime`](https://npmjs.com/package/@conveniencepro/ctp-runtime)       | Tool execution engine                     |
| [`@conveniencepro/ctp-discovery`](https://npmjs.com/package/@conveniencepro/ctp-discovery)   | Discovery document generators             |
| [`@conveniencepro/ctp-sdk`](https://npmjs.com/package/@conveniencepro/ctp-sdk)               | Embeddable SDK                            |
| [`@conveniencepro/ctp-spec`](https://npmjs.com/package/@conveniencepro/ctp-spec)             | Specification constants                   |
| [`@conveniencepro/ctp-examples`](https://npmjs.com/package/@conveniencepro/ctp-examples)     | Example tool implementations              |
| [`@conveniencepro/ctp-mcp-server`](https://npmjs.com/package/@conveniencepro/ctp-mcp-server) | MCP server for AI-powered tool generation |

## Get Started

<CardGroup cols={2}>
  <Card title="Read the Specification" icon="book" href="/specification/overview">
    Understand the complete CTP protocol
  </Card>

  <Card title="Build Your First Tool" icon="hammer" href="/implementation/creating-tools">
    Step-by-step guide to creating tools
  </Card>

  <Card title="View Examples" icon="code" href="/examples/overview">
    Reference implementations
  </Card>

  <Card title="LLM Tool Generator" icon="robot" href="/llm-prompts/tool-generator">
    Have AI generate tools for you
  </Card>

  <Card title="MCP Server" icon="plug" href="https://github.com/titan-alpha/ctp-mcp-server">
    AI-powered tool generation via Model Context Protocol
  </Card>
</CardGroup>
