# Knackly MCP

> Knackly MCP Server generates legal and business documents using smart templates and conditional logic. Your AI client connects to this server to automate document creation from structured templates, handling fields and complex rules for every unique situation. It lets you manage workspaces, track generation history, and build documents through natural conversation.

## Overview
- **Category:** productivity
- **Price:** Free
- **Tags:** document-automation, template-assembly, legal-tech, conditional-logic, contract-generation

## Description

You connect your AI client to Knackly to build and manage complex legal and business documents. You don't just generate files; you automate the entire process using structured templates and conditional logic. Your agent handles the conversation, letting you build documents by simply talking to the server. You can manage your data sources, track history, and set up external notifications all through the same connection.

**Manage Data Records**

To start, you can see all the distinct workspaces you've got with `list_workspaces`. You'll also find `list_catalogs` to see every data catalog available in your workspace. From there, you can pull a list of all data models using `list_data_models` within a specific catalog, or check out all the actual records using `list_data_records` for a data model. When you need to add new info, you run `create_data_record` to drop a new record into a specific data model. If you need all the details on one entry, `get_record_details` pulls every single data point for that record.

**Generate Documents from Templates**

To create a document, your agent uses a template and fills in the fields with data you provide. The server respects conditional logic, so if a section doesn't apply, it just skips it. This keeps your documents accurate, no matter how unique the situation is. You can manage the entire workflow without ever leaving your AI client.

**Track Document History**

Need to see what you generated last week? `list_generated_documents` gives you a list of every previously automated document and all its metadata. You'll also find `list_webhooks` to show every external notification you've set up, and you can manage those connections through `list_webhooks`.

## Tools

### create_data_record
Adds a new record into a specified data model.

### get_record_details
Retrieves all data points for one specific record.

### list_catalogs
Shows all data catalogs available in your workspace.

### list_data_models
Retrieves a list of all data models within a selected catalog.

### list_data_records
Lists all available records for a given data model.

### list_generated_documents
Retrieves a list of previously automated documents and their metadata.

### list_webhooks
Shows all configured webhooks for automated external notifications.

### list_workspaces
Lists all the distinct Knackly workspaces you have access to.

## Prompt Examples

**Prompt:** 
```
Show all apps and templates available for document generation.
```

**Response:** 
```
Apps: 4. Legal (5 templates), Sales (3), HR (4), Finance (2). Legal templates: 'NDA — Mutual' (8 fields), 'Service Agreement' (12 fields), 'Employment Contract' (15 fields), 'Lease Agreement' (10 fields), 'IP Assignment' (6 fields). Most used: 'NDA — Mutual' (234 generations). Would you like to generate a document?
```

**Prompt:** 
```
Generate an NDA for Acme Corp and show the required fields.
```

**Response:** 
```
NDA — Mutual fields: 8. Party A Name (text, required): 'Our Company'. Party B Name: 'Acme Corp'. Effective Date: Apr 26, 2025. Duration (dropdown): 2 years. Governing Law: Delaware. Party A Signatory: 'CEO, Jane Smith'. Party B Signatory: 'CTO, John Doe'. Scope (textarea): 'Software development collaboration'. Document generated! ✅ NDA_AcmeCorp_20250426.pdf (3 pages). Download available.
```

**Prompt:** 
```
Show document generation history for this month.
```

**Response:** 
```
This month: 45 documents generated. By template: NDA (18), Service Agreement (12), Employment Contract (8), Lease Agreement (4), Other (3). By user: Sarah (15), Mike (12), Lisa (10), Others (8). Average generation time: 2.3 seconds. Success rate: 100%.
```

## Capabilities

### Generate Documents from Templates
Creates a document using a template by filling in specific field data, respecting conditional logic rules.

### Manage Data Records
Adds new data entries (`create_data_record`) or pulls detailed information for a specific record (`get_record_details`).

### Discover Data Structure
Lists available data models, catalogs, and workspaces to see what kind of data you can work with.

### Track Document History
Retrieves a log of previously generated documents and the details of the generation process.

### Configure Data Connections
Lists configured webhooks and available apps for integration management.

## Use Cases

### Drafting an NDA for a new client
A sales specialist needs an NDA. They ask their agent to 'Draft NDA for Acme Corp.' The agent uses `list_data_models` to identify the required fields (Party A Name, Effective Date). It then uses `create_data_record` to map the client data, generating the final, correctly formatted PDF.

### Creating an HR onboarding packet
An HR manager needs to generate a package for a new employee. They ask their agent to compile the packet. The agent checks `list_data_records` for the employee's ID and department, and then uses the document generation tools to assemble the final HR packet.

### Reviewing a legal document template
A legal team member needs to know what fields are required for a 'Service Agreement' template. They ask their agent to check the schema. The agent runs `list_data_models` and reports back the specific fields and data types needed before any generation happens.

### Tracking document compliance
An operations analyst needs to prove that a specific agreement was generated last month. They ask their agent to check the history. The agent calls `list_generated_documents`, providing a clear, auditable list of all past document outputs.

## Benefits

- Automate document creation. Instead of manually filling out templates, your AI client generates final documents by using the `create_data_record` tool to populate required fields and then assembling the final output.
- Centralized data management. Use `list_catalogs` and `list_data_models` to see exactly where your structured data lives, so your agent knows what fields are available for the document.
- Audit every output. The `list_generated_documents` tool gives you a full history, letting you track who created which document and when. No more searching through shared drives.
- Streamline data gathering. If you need details on one specific client, the `get_record_details` tool pulls all necessary information in one API call, instead of requiring multiple database queries.
- Manage integrations easily. Use `list_webhooks` to see all the external connections and apps configured, making sure your document workflow talks to the right systems.
- Scope your work. `list_workspaces` lets your agent switch context and manage multiple, separate business environments without confusion.

## How It Works

The bottom line is, your AI client uses the server to handle the complex steps—from data gathering to document assembly—all in one flow.

1. Subscribe to the Knackly server and provide your API Key.
2. Tell your AI client to perform a task (e.g., 'Create an NDA for Acme Corp').
3. The server executes the necessary tools (like `create_data_record` or `list_data_models`) to gather data, then generates the final document.

## Frequently Asked Questions

**How do I use `create_data_record` with Knackly MCP Server?**
The `create_data_record` tool lets your agent add a new, structured data entry. You need to specify the data model and provide the key-value pairs for the new record.

**What is the difference between `list_data_models` and `list_data_records`?**
`list_data_models` shows you the *structure* (the blueprint) of the data, while `list_data_records` lists the *actual instances* (the data points) that fit that structure.

**Can I track how many documents I generated using `list_generated_documents`?**
Yes. The `list_generated_documents` tool provides historical data, allowing you to see the total count, which templates were used most often, and the average generation time.

**Do I need `list_workspaces` before generating a document?**
It's best practice. Using `list_workspaces` lets your agent confirm which environment (workspace) the data belongs to, preventing mix-ups between different client accounts or business units.

**How does Knackly MCP Server handle conditional content?**
Knackly uses smart templates that contain conditional logic. The server checks the data provided for rules (e.g., 'IF client is 'Enterprise' THEN include Clause X'). The document only includes Clause X if the data supports it.

**What is the function of `list_catalogs` when setting up a new document generation project?**
It shows all available catalogs within your workspace. You use this to see the high-level groupings of data you can draw from, helping you decide where to build your template.

**If I get an error, how can I use `list_webhooks` to troubleshoot my document workflow?**
This tool lets you see all configured webhooks. Checking these helps you verify if the document generation process is successfully calling external systems or if the connection point is broken.

**How can I use `list_data_records` to validate the inputs for a new contract using Knackly MCP?**
It retrieves specific data points from a model. You run this first to confirm the record has the necessary details—like names or dates—before trying to generate the final document.

**Can I generate documents from templates through the AI agent?**
Yes. Browse available templates, inspect their required fields, and generate documents by providing field values. Output documents are created automatically.

**Can I browse available apps and templates?**
Yes. List all Knackly apps and their associated templates with field configurations, data types, and validation rules.

**What API endpoint does Knackly use?**
Knackly uses Bearer authentication against `api.knackly.io/v1`.