> ## Documentation Index
> Fetch the complete documentation index at: https://docs.earthcare.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an MCP API key

> Returns the `ecn_mcp_…` secret once. Scoped to one organization.



## OpenAPI

````yaml /api/openapi.yaml post /mcp/keys/
openapi: 3.0.3
info:
  title: Earth Care Network API
  version: v1
  description: >
    REST API for the Earth Care Network platform — directory, CRM, context,
    metering/credits, and the prospecting engine.


    This is a **curated** reference covering the headline endpoints with
    accurate paths, methods, auth, and representative request/response bodies.
    ECN's API is largely function-based (DRF `@api_view`/`APIView` without
    serializers), so the raw drf-spectacular dump is sparse today; as the v2
    refactor migrates views to serializer-backed generics, this file is
    superseded by the generated schema (`manage.py spectacular --settings
    ecn.settings_docs`). See https://docs.earthcare.network for guides and the
    MCP surface.
servers:
  - url: https://earthcare.network/api/v1
    description: Production
  - url: https://test.earthcare.network/api/v1
    description: Test
  - url: http://localhost:8000/api/v1
    description: Local
security:
  - TokenAuth: []
tags:
  - name: Auth
    description: Authentication and the current user.
  - name: Directory
    description: The public directory of regenerative businesses.
  - name: Context
    description: AI-ready Context Packs.
  - name: CRM
    description: Contacts, deals, and tasks.
  - name: AI
    description: Metered AI execution through the gateway.
  - name: Credits
    description: Wallet, rate cards, and the usage ledger.
  - name: Prospecting
    description: Go-to-market profiles and lead discovery with buying signals.
  - name: MCP
    description: MCP API key management.
  - name: Automation
    description: Workflow automation.
paths:
  /mcp/keys/:
    post:
      tags:
        - MCP
      summary: Create an MCP API key
      description: Returns the `ecn_mcp_…` secret once. Scoped to one organization.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - organization_id
                - name
              properties:
                organization_id:
                  type: string
                  format: uuid
                name:
                  type: string
                  example: claude-code
      responses:
        '201':
          description: Key created (secret shown once)
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  name:
                    type: string
                  plaintext:
                    type: string
                    example: ecn_mcp_…
                    description: The full secret — shown ONCE, not retrievable later
                  key_prefix:
                    type: string
                    example: ecn_mcp_ab12
                  endpoint:
                    type: string
                    format: uri
                    description: The MCP endpoint to use this key against
                  is_active:
                    type: boolean
                  created_at:
                    type: string
                    format: date-time
components:
  securitySchemes:
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'DRF user token. Format: `Token <token>`'

````