@kya-os/init-xmcp-i
v0.1.11
Published
Initialize xmcp-i apps with identity features in one command
Readme
init-xmcp-i
Initialize xmcp-i with identity features in your existing Node.js project.
🚀 Quick Start
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 informationsign-message.ts- Sign messages with server identityverify-signature.ts- Verify signatures against DIDschallenge-response.ts- Handle authentication challengesmcp-capabilities.ts- Display MCP server capabilities
Identity Utilities
generate-identity.ts- Generate new DID identityensure-identity.ts- Ensure identity exists before runningidentity-utils.ts- Helper functions for identity operationsregister-agent.ts- Register with agent registryhandshake.ts- Identity handshake implementation
Scripts Added
npm run generate-identity- Generate a new identitynpm run ensure-identity- Ensure identity existsnpm run register-agent- Register with a registrynpm run check-registration- Check registration statusnpm run dev- Start development with identity
📦 Requirements
- Node.js 20.0.0 or higher
- TypeScript project
- npm, yarn, or pnpm
🎯 Usage
Basic Usage
npx init-xmcp-iWith Options
# 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 enabledsrc/tools/*.ts- Identity-enabled MCP toolssrc/*.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 dependenciestsconfig.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
Generate your identity:
npm run generate-identityStart development:
npm run dev(Optional) Register your agent:
npm run register-agent
🤝 Integration
Express
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
