# itsjustayush/stoneway-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/itsjustayush/stoneway-mcp
- Repository: https://github.com/itsjustayush/stoneway-mcp

## Overview

StoneWay provides a persistent builder profile and scratchpad that people edit in a dashboard and AI agents read or update through MCP or REST. Cloud requests authenticate with a builder key, operate on profile data, and can synchronize GitHub project and language details; agents can alternatively use local files. The graph includes documented capabilities such as public profiles, bio generation, notes, activity, and encrypted configuration. Some subsystem links are README-level; unsampled implementation details are not inferred.

Main entry points: [`apps/web/src/app/api`](https://github.com/itsjustayush/stoneway-mcp/tree/main/apps/web/src/app/api) (Web API routes), [`stoneway_mcp/storage.py`](https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/storage.py) (Storage backends), [`packages/database/src/schema/stoneway.ts`](https://github.com/itsjustayush/stoneway-mcp/blob/main/packages/database/src/schema/stoneway.ts) (Profile data), [`apps/web/src/lib/mcp-http-handler.ts`](https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/lib/mcp-http-handler.ts) (MCP HTTP handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard and API"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_web_api["Web API routes"]
  node_mcp_http["MCP HTTP handler"]
  node_public_profile["Public profiles<br/>[page.tsx]"]
end

subgraph group_agent["Agent access"]
  node_python_server["Python MCP server<br/>[server.py]"]
  node_node_server["Node MCP server<br/>[index.ts]"]
  node_storage["Storage backends<br/>[storage.py]"]
  node_api_client["Cloud API client<br/>[client.py]"]
end

subgraph group_profile["Profile lifecycle"]
  node_profile_models["Profile schemas<br/>[models.py]"]
  node_reconciliation["Reconciliation<br/>[reconciliation.py]"]
  node_bio_generation["Bio generation<br/>[bio_generator.py]"]
end

subgraph group_persistence["Persistence and security"]
  node_profile_db[("Profile data<br/>[stoneway.ts]")]
  node_auth_db[("Identity and sessions<br/>[auth.ts]")]
  node_db_client["Database client<br/>[client.ts]"]
  node_crypto["Encrypted config<br/>[crypto.ts]"]
  node_audit["Audit events<br/>[audit.ts]"]
  node_neon[("Neon PostgreSQL")]
end

subgraph group_integrations["External integrations"]
  node_github["GitHub connector<br/>[github.ts]"]
  node_github_service["GitHub"]
end

node_builder(("Builder"))
node_ai_agent(("AI agent"))

node_builder -->|"edits profile"| node_dashboard
node_dashboard -.->|"saves profile"| node_web_api
node_builder -->|"manages key"| node_web_api
node_web_api -->|"checks session"| node_auth_db
node_web_api -->|"reads and writes"| node_profile_db
node_web_api -->|"encrypts config"| node_crypto
node_web_api -->|"records events"| node_audit
node_ai_agent -->|"uses MCP"| node_python_server
node_ai_agent -->|"uses MCP"| node_node_server
node_python_server -->|"dispatches tools"| node_storage
node_storage -->|"calls cloud API"| node_api_client
node_storage -->|"reconciles updates"| node_reconciliation
node_storage -->|"validates profile"| node_profile_models
node_storage -->|"generates bio"| node_bio_generation
node_api_client -->|"sends REST requests"| node_web_api
node_mcp_http -->|"accesses profile"| node_profile_db
node_mcp_http -->|"uses shared schemas"| node_profile_models
node_web_api -->|"reads and writes"| node_profile_db
node_web_api -->|"triggers sync"| node_github
node_github -.->|"fetches repository data"| node_github_service
node_web_api -->|"merges sync data"| node_reconciliation
node_web_api -->|"records sync events"| node_audit
node_builder -->|"views profile"| node_public_profile
node_profile_db -.->|"configured in"| node_db_client
node_db_client -.->|"queries database"| node_neon

click node_dashboard "https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/app/app/editor/page.tsx"
click node_web_api "https://github.com/itsjustayush/stoneway-mcp/tree/main/apps/web/src/app/api"
click node_mcp_http "https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/lib/mcp-http-handler.ts"
click node_public_profile "https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/app/profile/%5Busername%5D/page.tsx"
click node_python_server "https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/server.py"
click node_node_server "https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/mcp-server/src/index.ts"
click node_storage "https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/storage.py"
click node_api_client "https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/client.py"
click node_profile_models "https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/models.py"
click node_reconciliation "https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/reconciliation.py"
click node_bio_generation "https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/bio_generator.py"
click node_profile_db "https://github.com/itsjustayush/stoneway-mcp/blob/main/packages/database/src/schema/stoneway.ts"
click node_auth_db "https://github.com/itsjustayush/stoneway-mcp/blob/main/packages/database/src/schema/auth.ts"
click node_db_client "https://github.com/itsjustayush/stoneway-mcp/blob/main/packages/database/src/client.ts"
click node_crypto "https://github.com/itsjustayush/stoneway-mcp/blob/main/packages/database/src/crypto.ts"
click node_audit "https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/lib/audit.ts"
click node_github "https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/lib/connectors/github.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_dashboard,node_web_api,node_mcp_http,node_public_profile toneBlue
class node_python_server,node_node_server,node_storage,node_api_client toneAmber
class node_profile_models,node_reconciliation,node_bio_generation toneMint
class node_profile_db,node_auth_db,node_db_client,node_crypto,node_audit,node_neon toneRose
class node_github,node_github_service,node_builder,node_ai_agent toneIndigo
```

## Components

### Dashboard and API

- [Dashboard](https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/app/app/editor/page.tsx): `apps/web/src/app/app/editor/page.tsx`
- [Web API routes](https://github.com/itsjustayush/stoneway-mcp/tree/main/apps/web/src/app/api): `apps/web/src/app/api`
- [MCP HTTP handler](https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/lib/mcp-http-handler.ts): `apps/web/src/lib/mcp-http-handler.ts`
- [Public profiles](https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/app/profile/%5Busername%5D/page.tsx): `apps/web/src/app/profile/[username]/page.tsx`

### Agent access

- [Python MCP server](https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/server.py): `stoneway_mcp/server.py`
- [Node MCP server](https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/mcp-server/src/index.ts): `apps/mcp-server/src/index.ts`
- [Storage backends](https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/storage.py): `stoneway_mcp/storage.py`
- [Cloud API client](https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/client.py): `stoneway_mcp/client.py`

### Profile lifecycle

- [Profile schemas](https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/models.py): `stoneway_mcp/models.py`
- [Reconciliation](https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/reconciliation.py): `stoneway_mcp/reconciliation.py`
- [Bio generation](https://github.com/itsjustayush/stoneway-mcp/blob/main/stoneway_mcp/bio_generator.py): `stoneway_mcp/bio_generator.py`

### Persistence and security

- [Profile data](https://github.com/itsjustayush/stoneway-mcp/blob/main/packages/database/src/schema/stoneway.ts): `packages/database/src/schema/stoneway.ts`
- [Identity and sessions](https://github.com/itsjustayush/stoneway-mcp/blob/main/packages/database/src/schema/auth.ts): `packages/database/src/schema/auth.ts`
- [Database client](https://github.com/itsjustayush/stoneway-mcp/blob/main/packages/database/src/client.ts): `packages/database/src/client.ts`
- [Encrypted config](https://github.com/itsjustayush/stoneway-mcp/blob/main/packages/database/src/crypto.ts): `packages/database/src/crypto.ts`
- [Audit events](https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/lib/audit.ts): `apps/web/src/lib/audit.ts`
- **Neon PostgreSQL**

### External integrations

- [GitHub connector](https://github.com/itsjustayush/stoneway-mcp/blob/main/apps/web/src/lib/connectors/github.ts): `apps/web/src/lib/connectors/github.ts`
- **GitHub**

### Other components

- **Builder**
- **AI agent**

## Connections

- Builder → Dashboard: edits profile (evidence: `README.md`)
- Dashboard → Web API routes: saves profile
- Builder → Web API routes: manages key (evidence: `apps/web/src/app/api/user/key/route.ts`)
- Web API routes → Identity and sessions: checks session (evidence: `apps/web/src/app/api/user/key/route.ts`)
- Web API routes → Profile data: reads and writes (evidence: `apps/web/src/app/api/user/key/route.ts`)
- Web API routes → Encrypted config: encrypts config (evidence: `apps/web/src/app/api/user/key/route.ts`)
- Web API routes → Audit events: records events (evidence: `apps/web/src/app/api/user/key/route.ts`)
- AI agent → Python MCP server: uses MCP (evidence: `README.md`)
- AI agent → Node MCP server: uses MCP (evidence: `README.md`)
- Python MCP server → Storage backends: dispatches tools (evidence: `stoneway_mcp/server.py`)
- Storage backends → Cloud API client: calls cloud API (evidence: `stoneway_mcp/storage.py`)
- Storage backends → Reconciliation: reconciles updates (evidence: `stoneway_mcp/storage.py`)
- Storage backends → Profile schemas: validates profile (evidence: `stoneway_mcp/storage.py`)
- Storage backends → Bio generation: generates bio (evidence: `stoneway_mcp/storage.py`)
- Cloud API client → Web API routes: sends REST requests (evidence: `README.md`)
- MCP HTTP handler → Profile data: accesses profile (evidence: `apps/web/src/lib/mcp-http-handler.ts`)
- MCP HTTP handler → Profile schemas: uses shared schemas (evidence: `apps/web/src/lib/mcp-http-handler.ts`)
- Web API routes → Profile data: reads and writes (evidence: `apps/web/src/app/api/v1/sync/route.ts`)
- Web API routes → GitHub connector: triggers sync (evidence: `apps/web/src/app/api/v1/sync/route.ts`)
- GitHub connector → GitHub: fetches repository data
- Web API routes → Reconciliation: merges sync data (evidence: `apps/web/src/app/api/v1/sync/route.ts`)
- Web API routes → Audit events: records sync events (evidence: `apps/web/src/app/api/v1/sync/route.ts`)
- Builder → Public profiles: views profile (evidence: `README.md`)
- Profile data → Database client: configured in
- Database client → Neon PostgreSQL: queries database
