npm package: @kya-os/init-xmcp-i
Description: Initialize xmcp-i apps with identity features in one command
Author: XMCP-I Team
Latest version: 0.1.11

# init-xmcp-i

Initialize xmcp-i with identity features in your existing Node.js project.

## 🚀 Quick Start

```bash
npx init-xmcp-i@latest
```

## 📋 What it does

`init-xmcp-i` sets up xmcp-i in your existing Node.js project with:

- ✅ **DID-based identity generation** - Automatic cryptographic identity creation
- ✅ **Identity-enabled tools** - Pre-configured tools with signing capabilities
- ✅ **Framework detection** - Automatic setup for Next.js or Express
- ✅ **TypeScript support** - Full TypeScript configuration
- ✅ **Security best practices** - Proper .gitignore for sensitive files
- ✅ **Registry integration** - Optional agent registration support

## 🛠️ Features

### Identity Tools Created

- `identity-info.ts` - Get server identity information
- `sign-message.ts` - Sign messages with server identity
- `verify-signature.ts` - Verify signatures against DIDs
- `challenge-response.ts` - Handle authentication challenges
- `mcp-capabilities.ts` - Display MCP server capabilities

### Identity Utilities

- `generate-identity.ts` - Generate new DID identity
- `ensure-identity.ts` - Ensure identity exists before running
- `identity-utils.ts` - Helper functions for identity operations
- `register-agent.ts` - Register with agent registry
- `handshake.ts` - Identity handshake implementation

### Scripts Added

- `npm run generate-identity` - Generate a new identity
- `npm run ensure-identity` - Ensure identity exists
- `npm run register-agent` - Register with a registry
- `npm run check-registration` - Check registration status
- `npm run dev` - Start development with identity

## 📦 Requirements

- Node.js 20.0.0 or higher
- TypeScript project
- npm, yarn, or pnpm

## 🎯 Usage

### Basic Usage

```bash
npx init-xmcp-i
```

### With Options

```bash
# Skip prompts and use defaults
npx init-xmcp-i --yes

# Specify package manager
npx init-xmcp-i --package-manager pnpm

# Custom paths
npx init-xmcp-i --tools-path src/mcp-tools --identity-path src/identity

# Skip identity generation
npx init-xmcp-i --skip-identity

# Specify registry URL
npx init-xmcp-i --registry https://registry.knowthat.com
```

## 🔧 CLI Options

- `-y, --yes` - Skip confirmation prompts
- `--package-manager <manager>` - Specify package manager (npm, yarn, pnpm)
- `--tools-path <path>` - Custom tools directory path
- `--route-path <path>` - Custom Next.js route path
- `--identity-path <path>` - Custom identity files path
- `--skip-tools` - Skip tool creation
- `--skip-route` - Skip route creation
- `--skip-identity` - Skip identity generation
- `--registry <url>` - Registry URL for agent registration
- `-v, --version` - Show version
- `-h, --help` - Show help

## 🏗️ What Gets Modified

### Files Created

- `xmcp.config.ts` - xmcp-i configuration with identity enabled
- `src/tools/*.ts` - Identity-enabled MCP tools
- `src/*.ts` - Identity utility files (or custom path)
- `src/app/mcp/route.ts` - Next.js route handler (if applicable)

### Files Updated

- `package.json` - Added scripts and dependencies
- `tsconfig.json` - Updated for xmcp-i compatibility
- `.gitignore` - Added identity file exclusions

## 🔐 Security

Identity files contain private keys and are automatically:
- Excluded from git via .gitignore
- Generated locally on first run
- Never shared or transmitted

## 📚 After Initialization

1. Generate your identity:
   ```bash
   npm run generate-identity
   ```

2. Start development:
   ```bash
   npm run dev
   ```

3. (Optional) Register your agent:
   ```bash
   npm run register-agent
   ```

## 🤝 Integration

### Express

```typescript
import { xmcpHandler } from '@xmcp/adapter';

app.post("/mcp", xmcpHandler);
app.get("/mcp", xmcpHandler);
```

### Next.js

Automatically configured at `/mcp` route in App Router.

## 📄 License

MIT © XMCP-I Team

## 🔗 Links

- [xmcp-i Documentation](https://github.com/modelcontextprotocol-identity/xmcp-i)
- [Model Context Protocol](https://modelcontextprotocol.io)
- [Report Issues](https://github.com/modelcontextprotocol-identity/xmcp-i/issues)