automatikstudio

LegalForge MCP Server

Community automatikstudio
Updated

MCP server for legalforge-mcp

LegalForge MCP Server

Model Context Protocol (MCP) server for generating professional legal documents using AI.

Features

  • Privacy Policy - GDPR/CCPA compliant privacy policies
  • Terms of Service - Comprehensive terms for your website/app
  • Cookie Policy - Detailed cookie policies with consent info

Installation

npm install
npm run build

Configuration

Set your Anthropic API key:

export ANTHROPIC_API_KEY=sk-ant-...

Usage

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "legalforge": {
      "command": "node",
      "args": ["/path/to/legalforge-mcp/dist/index.js"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

Programmatic

echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"generate_legal_document","arguments":{"documentType":"privacy","parties":[{"name":"Acme Inc","role":"company","email":"[email protected]"}],"terms":{"websiteUrl":"https://acme.com","siteName":"Acme","services":"Google Analytics, Stripe, Intercom"},"jurisdiction":"California, USA"}}}' | node dist/index.js

Tool: generate_legal_document

Inputs

Parameter Type Required Description
documentType "privacy" | "terms" | "cookie" Type of legal document
parties Party[] Parties involved (company, users)
terms Record<string, string> Document configuration
jurisdiction string Legal jurisdiction

Party Object

Field Type Required Description
name string Party name
role "company" | "user" | "provider" Role
address string - Physical address
email string - Contact email

Terms Object

Key Description
websiteUrl Website URL
siteName Display name for the site
services Comma-separated list of services/technologies

Output

Returns HTML document content (starting from <h2> tags).

Example

const result = await mcpClient.callTool("generate_legal_document", {
  documentType: "privacy",
  parties: [
    {
      name: "TechStartup Inc",
      role: "company",
      email: "[email protected]"
    }
  ],
  terms: {
    websiteUrl: "https://techstartup.com",
    siteName: "TechStartup",
    services: "Google Analytics, Stripe, AWS, Intercom"
  },
  jurisdiction: "European Union"
});

console.log(result.content[0].text); // HTML privacy policy

Development

npm run dev  # Run with tsx (hot reload)
npm run build  # Compile TypeScript
npm start  # Run compiled version

Template Usage

This MCP server serves as a template for building other MCP servers. Key patterns:

  1. Tool registration with Zod schemas for validation
  2. Prompt engineering with structured templates
  3. Error handling with proper MCP error responses
  4. Clean TypeScript setup with ESM modules

License

MIT

MCP Server · Populars

MCP Server · New