# DeepWriter MCP

## Using DeepWriter MCP

The DeepWriter Model Context Protocol (MCP) server allows you to seamlessly integrate DeepWriter's content generation capabilities with Claude and other MCP-compatible AI assistants. This guide will help you set up and use the DeepWriter MCP server.

### Prerequisites

Before getting started, ensure you have:

* Node.js (v17 or higher)
* npm (v6 or higher)
* A DeepWriter API key [(see Getting Your API Key)](https://docs.deepwriter.com/api-access)
* An MCP-compatible client (such as Claude for Desktop)

### Installation

1. Clone the repository:

   ```bash
   bashgit clone https://github.com/yourusername/deepwriter-mcp.gitcd deepwriter-mcp
   ```
2. Install dependencies:

   ```bash
   bashnpm install
   ```
3. Create a `.env` file in the root directory with your DeepWriter API key:

   ```
   DEEPWRITER_API_KEY=your_api_key_here
   ```
4. Build the project:

   ```bash
   bashnpm run build
   ```

### Integration with Claude for Desktop

To connect the DeepWriter MCP server with Claude for Desktop:

1. Open your Claude for Desktop configuration file:
   * macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
   * Windows: `%APPDATA%\Claude\claude_desktop_config.json`
2. Add the server configuration:

   ```json
   json{  "mcpServers": {    "deepwriter": {      "command": "node",      "args": ["/ABSOLUTE/PATH/TO/deepwriter-mcp/build/index.js"],      "env": {        "DEEPWRITER_API_KEY": "your_api_key_here"      }    }  }}
   ```
3. Restart Claude for Desktop to load the new configuration.

### Using DeepWriter Tools with Claude

Once you've set up the MCP server, you can use DeepWriter's features directly within Claude. Here are some examples:

#### Listing Your Projects

To see all your DeepWriter projects, ask Claude:

```
Can you list all my Deepwriter projects?
```

Claude will use the `listProjects` tool to fetch and display your projects.

#### Creating a New Project

To create a new project, you can say:

```
Create a new Deepwriter project titled "My Science Fiction Novel" with my email address user@example.com
```

Claude will use the `createProject` tool to set up your new project.

#### Getting Project Details

To view details about a specific project:

```
Show me the details for my Deepwriter project with ID "proj_123456"
```

Claude will retrieve the project information using the `getProjectDetails` tool.

#### Updating a Project

To update an existing project:

```
Update my Deepwriter project "proj_123456" to change the title to "New Title" and add the following prompt: "Write a story about space explorers discovering a new planet"
```

Claude will use the `updateProject` tool to modify your project.

#### Generating Content

To generate content for a project:

```
Generate content for my Deepwriter project "proj_123456"
```

Claude will use the `generateWork` tool to create new content based on your project settings.

#### Deleting a Project

To delete a project:

```
Delete my Deepwriter project with ID "proj_123456"
```

Claude will confirm and then use the `deleteProject` tool to remove the project.

### Troubleshooting

#### Common Issues

1. **API Key Problems**:
   * Ensure your DeepWriter API key is correctly set in both the `.env` file and Claude configuration
   * Verify the API key has not expired (remember, keys are only viewable on creation)
2. **Connection Issues**:
   * Check that your MCP server is running before trying to use it with Claude
   * Verify the path to your build directory is correct in the Claude configuration
3. **Tool Execution Errors**:
   * Double-check parameter names and formats when making requests
   * Ensure project IDs are valid when referencing existing projects

#### Debugging

For additional debugging information, run the server with the DEBUG environment variable:

```bash
bashDEBUG=deepwriter-mcp:* node build/index.js
```

You can also check Claude for Desktop logs at:

* macOS: `~/Library/Logs/Claude/mcp*.log`
* Windows: `%APPDATA%\Claude\logs\mcp*.log`

### Advanced Usage

#### Using Environment Variables

Instead of hardcoding your API key in the Claude configuration, you can reference environment variables:

```json
json{  "mcpServers": {    "deepwriter": {      "command": "node",      "args": ["/path/to/deepwriter-mcp/build/index.js"],      "env": {        "DEEPWRITER_API_KEY": "${DEEPWRITER_API_KEY}"      }    }  }}
```

This approach allows you to manage sensitive credentials more securely.

#### Batch Operations

You can perform batch operations by asking Claude to execute multiple actions in sequence:

```
First, list all my DeepWriter projects. Then, create a new project called "Marketing Content" with my email user@example.com.
```

Claude will execute these operations in order and provide the results of each.

### Next Steps

* Explore the [Deepwriter API documentation](https://deepwriter.com/docs) for more advanced features
* Check the [GitHub repository](https://github.com/yourusername/deepwriter-mcp) for updates and new features
* Join the community on Discord to share tips and get help from other users
