# ranjith-kumar-kuruba/sf-field-doc-mcp architecture

> Architecture diagram of the GitHub repository ranjith-kumar-kuruba/sf-field-doc-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ranjith-kumar-kuruba/sf-field-doc-mcp
- Repository: https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp

## Overview

This is a local MCP server for drafting and saving Salesforce custom-field documentation. An assistant calls the proposal tool, which reads a field XML file and derives bounded description and help-text drafts from its label, type, and supplied purpose. The assistant presents the draft for developer review; after the developer’s choices, it calls the save tool, which updates selected XML tags in place. Both tools, their handlers, and the stdio bootstrap are implemented in `src/index.ts`; the README documents the review loop. The map reflects the shown single-file implementation rather than assuming separate internal services.

Main entry points: [`src/index.ts`](https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts) (MCP Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mcp["MCP Interface"]
  node_server["MCP Server<br/>[index.ts]"]
  node_stdio["Stdio Transport<br/>[index.ts]"]
  node_tool_catalog["Tool Catalog<br/>[index.ts]"]
end

subgraph group_drafting["Drafting"]
  node_proposal_handler["Proposal Handler<br/>[index.ts]"]
  node_draft_logic["Draft Generation<br/>[index.ts]"]
end

subgraph group_metadata["Metadata Updates"]
  node_field_xml["Field XML Files"]
  node_save_handler["Save Handler<br/>[index.ts]"]
  node_tag_upsert["XML Tag Upsert<br/>[index.ts]"]
end

node_developer(("Developer"))
node_assistant(("AI Assistant"))

node_server -->|"connects"| node_stdio
node_server -->|"registers"| node_tool_catalog
node_assistant -->|"calls tools"| node_server
node_server -->|"dispatches"| node_proposal_handler
node_proposal_handler -->|"generates draft"| node_draft_logic
node_draft_logic -->|"reads"| node_field_xml
node_proposal_handler -->|"returns draft"| node_assistant
node_assistant -->|"requests review"| node_developer
node_developer -->|"provides choices"| node_assistant
node_server -->|"dispatches"| node_save_handler
node_save_handler -->|"updates tags"| node_tag_upsert
node_save_handler -->|"writes"| node_field_xml

click node_server "https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts"
click node_stdio "https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts"
click node_tool_catalog "https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts"
click node_proposal_handler "https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts"
click node_draft_logic "https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts"
click node_save_handler "https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts"
click node_tag_upsert "https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_stdio,node_tool_catalog toneBlue
class node_proposal_handler,node_draft_logic toneAmber
class node_field_xml,node_save_handler,node_tag_upsert toneMint
class node_developer,node_assistant toneIndigo
```

## Components

### MCP Interface

- [MCP Server](https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts): `src/index.ts`
- [Stdio Transport](https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts): `src/index.ts`
- [Tool Catalog](https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts): `src/index.ts`

### Drafting

- [Proposal Handler](https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts): `src/index.ts`
- [Draft Generation](https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts): `src/index.ts`

### Metadata Updates

- **Field XML Files**
- [Save Handler](https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts): `src/index.ts`
- [XML Tag Upsert](https://github.com/ranjith-kumar-kuruba/sf-field-doc-mcp/blob/master/src/index.ts): `src/index.ts`

### Other components

- **Developer**
- **AI Assistant**

## Connections

- MCP Server → Stdio Transport: connects (evidence: `src/index.ts`)
- MCP Server → Tool Catalog: registers (evidence: `src/index.ts`)
- AI Assistant → MCP Server: calls tools (evidence: `README.md`)
- MCP Server → Proposal Handler: dispatches (evidence: `src/index.ts`)
- Proposal Handler → Draft Generation: generates draft (evidence: `src/index.ts`)
- Draft Generation → Field XML Files: reads (evidence: `src/index.ts`)
- Proposal Handler → AI Assistant: returns draft (evidence: `src/index.ts`)
- AI Assistant → Developer: requests review (evidence: `README.md`)
- Developer → AI Assistant: provides choices (evidence: `README.md`)
- MCP Server → Save Handler: dispatches (evidence: `src/index.ts`)
- Save Handler → XML Tag Upsert: updates tags (evidence: `src/index.ts`)
- Save Handler → Field XML Files: writes (evidence: `src/index.ts`)
