@pathmode/mcp-server 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,244 @@
1
+ # @pathmode/mcp-server
2
+
3
+ Connect Claude Code, Cursor, and other AI agents to your [Pathmode](https://pathmode.io) Intent Layer.
4
+
5
+ Get strategic context, dependency graph analysis, and structured implementation prompts — so your AI agent builds the right thing, not just any thing.
6
+
7
+ ## Features
8
+
9
+ - **Intent context** — Structured specs with objectives, outcomes, constraints, and edge cases
10
+ - **Dependency graph analysis** — Critical path, cycle detection, bottleneck identification
11
+ - **Context export** — Generate CLAUDE.md, .cursorrules, and intent.md files
12
+ - **Workspace strategy** — Vision, non-negotiables, architecture principles
13
+ - **Constitution rules** — Mandatory constraints for all implementations
14
+ - **Implementation tracking** — Status updates and technical decision logging
15
+
16
+ ## Quick Start
17
+
18
+ ```bash
19
+ npx @pathmode/mcp-server
20
+ ```
21
+
22
+ ## Setup
23
+
24
+ ### Claude Desktop
25
+
26
+ Add to `~/.config/Claude/claude_desktop_config.json`:
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "pathmode": {
32
+ "command": "npx",
33
+ "args": ["@pathmode/mcp-server"],
34
+ "env": {
35
+ "PATHMODE_API_KEY": "pm_live_..."
36
+ }
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ### Claude Code
43
+
44
+ Add to `.claude/settings.json`:
45
+
46
+ ```json
47
+ {
48
+ "mcpServers": {
49
+ "pathmode": {
50
+ "command": "npx",
51
+ "args": ["@pathmode/mcp-server"],
52
+ "env": {
53
+ "PATHMODE_API_KEY": "pm_live_..."
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ ### Cursor
61
+
62
+ Add to `.cursor/mcp.json`:
63
+
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "pathmode": {
68
+ "command": "npx",
69
+ "args": ["@pathmode/mcp-server"],
70
+ "env": {
71
+ "PATHMODE_API_KEY": "pm_live_..."
72
+ }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ ### Local Mode (Offline)
79
+
80
+ Read `intent.md` files from your project directory without an API key:
81
+
82
+ ```json
83
+ {
84
+ "mcpServers": {
85
+ "pathmode": {
86
+ "command": "npx",
87
+ "args": ["@pathmode/mcp-server", "--local"]
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ ## Configuration
94
+
95
+ | Method | Details |
96
+ |--------|---------|
97
+ | Environment variable | `PATHMODE_API_KEY=pm_live_...` |
98
+ | Config file | `~/.pathmode/config.json` with `apiKey`, `apiUrl`, `workspaceId` |
99
+ | Local mode | `--local` flag — reads `intent.md` and `.pathmode/intents/*.md` |
100
+
101
+ Get your API key from **Settings > API Keys** in the [Pathmode app](https://pathmode.io).
102
+
103
+ ## Tools
104
+
105
+ ### Intent Management
106
+
107
+ | Tool | Description | Annotations |
108
+ |------|-------------|-------------|
109
+ | `get_current_intent` | Get the active intent (first approved, or most recent) | readOnly |
110
+ | `get_intent` | Get a single intent by ID with full details | readOnly |
111
+ | `list_intents` | List all intents, optionally filtered by status | readOnly |
112
+ | `search_intents` | Search intents by keyword across goals, objectives, and outcomes | readOnly |
113
+ | `update_intent_status` | Update intent status (draft > validated > approved > shipped > verified) | write |
114
+ | `log_implementation_note` | Record a technical decision or implementation note | write |
115
+
116
+ ### Strategic Analysis
117
+
118
+ | Tool | Description | Annotations |
119
+ |------|-------------|-------------|
120
+ | `analyze_intent_graph` | Analyze dependency graph for critical path, cycles, bottlenecks, and risks | readOnly |
121
+ | `get_intent_relations` | Get the dependency graph for a specific intent | readOnly |
122
+
123
+ ### Context & Export
124
+
125
+ | Tool | Description | Annotations |
126
+ |------|-------------|-------------|
127
+ | `export_context` | Generate CLAUDE.md, .cursorrules, or intent.md files | readOnly |
128
+ | `get_agent_prompt` | Get a structured execution prompt for an intent | readOnly |
129
+ | `get_workspace` | Get workspace details including strategy and constitution | readOnly |
130
+ | `get_constitution` | Get mandatory constraint rules for the workspace | readOnly |
131
+
132
+ ### Prompts
133
+
134
+ | Prompt | Description |
135
+ |--------|-------------|
136
+ | `implement-intent` | Full implementation workflow for a specific intent |
137
+ | `review-risks` | Analyze the intent graph for architectural risks |
138
+ | `what-next` | Suggest the highest-priority intent to work on next |
139
+
140
+ ### Resources
141
+
142
+ | URI | Description |
143
+ |-----|-------------|
144
+ | `intent://current` | Currently active intent |
145
+ | `intent://graph` | Full intent dependency graph |
146
+ | `intent://workspace-strategy` | Workspace vision, principles, and active constitution rules |
147
+
148
+ ## Usage Examples
149
+
150
+ ### Example 1: Get Implementation Context
151
+
152
+ **User prompt:** "What should I implement next?"
153
+
154
+ **Expected tool calls:**
155
+ 1. `get_current_intent` — Fetches the first approved intent
156
+ 2. `get_agent_prompt` with `intentId` and `mode: "execute"` — Gets the structured implementation prompt
157
+
158
+ **Expected output:** A full specification with objective, observable outcomes, constraints, edge cases, and verification steps that the AI agent uses to plan and execute the implementation.
159
+
160
+ ---
161
+
162
+ ### Example 2: Analyze Architectural Risks
163
+
164
+ **User prompt:** "Are there any risks in our intent dependency graph?"
165
+
166
+ **Expected tool calls:**
167
+ 1. `analyze_intent_graph` with `analysis: "full"` — Runs complete graph analysis
168
+
169
+ **Expected output:**
170
+ ```json
171
+ {
172
+ "summary": { "total": 12, "statusDistribution": { "draft": 3, "approved": 5, "shipped": 4 } },
173
+ "criticalPath": [
174
+ { "id": "abc", "userGoal": "User authentication", "status": "shipped" },
175
+ { "id": "def", "userGoal": "Role-based access control", "status": "approved" },
176
+ { "id": "ghi", "userGoal": "Admin dashboard", "status": "draft" }
177
+ ],
178
+ "cycles": [],
179
+ "bottlenecks": [
180
+ { "id": "def", "userGoal": "Role-based access control", "dependentCount": 4, "status": "approved" }
181
+ ],
182
+ "orphanCount": 2
183
+ }
184
+ ```
185
+
186
+ The AI agent summarizes: the critical path has 3 steps, "Role-based access control" is a bottleneck blocking 4 other intents and should be prioritized, and 2 intents have no relationships.
187
+
188
+ ---
189
+
190
+ ### Example 3: Generate a CLAUDE.md Context File
191
+
192
+ **User prompt:** "Generate a CLAUDE.md for this project"
193
+
194
+ **Expected tool calls:**
195
+ 1. `export_context` with `format: "claude-md"` — Generates workspace context
196
+
197
+ **Expected output:** A markdown file containing workspace strategy, active constitution rules, and all approved intents formatted as structured context that can be added to any project's `CLAUDE.md` file. The AI agent can write this directly to disk.
198
+
199
+ ---
200
+
201
+ ### Example 4: Search and Track Implementation
202
+
203
+ **User prompt:** "Find all intents related to authentication and mark the login one as shipped"
204
+
205
+ **Expected tool calls:**
206
+ 1. `search_intents` with `query: "authentication"` — Finds matching intents
207
+ 2. `update_intent_status` with `intentId` and `status: "shipped"` — Updates the login intent
208
+ 3. `log_implementation_note` — Documents what was implemented
209
+
210
+ **Expected output:** The search returns matching intents, the status is updated, and a note is logged documenting the implementation approach.
211
+
212
+ ## Troubleshooting
213
+
214
+ **"No Pathmode configuration found"**
215
+ Set the `PATHMODE_API_KEY` environment variable or create `~/.pathmode/config.json`.
216
+
217
+ **Tools return "not available in local mode"**
218
+ Most tools require cloud mode. Set up an API key, or use `--local` for basic intent reading from `intent.md` files.
219
+
220
+ **Connection timeout**
221
+ Ensure your API key is valid and has the correct scopes (read, write). Check your network connection to `pathmode.io`.
222
+
223
+ ## Privacy Policy
224
+
225
+ This MCP server connects to the Pathmode API (`pathmode.io`) to read and write intent specifications, workspace data, and constitution rules on behalf of the authenticated user.
226
+
227
+ **Data collected:** The server transmits your API key for authentication and sends/receives workspace data (intents, constitution rules, workspace strategy) via the Pathmode API.
228
+
229
+ **Data storage:** The MCP server itself does not store any data locally (except in `--local` mode where it reads existing `intent.md` files from your project directory). All persistent data is stored in Pathmode's cloud infrastructure.
230
+
231
+ **Third-party sharing:** No data is shared with third parties. The server communicates exclusively with the Pathmode API.
232
+
233
+ **Data retention:** Data retention follows Pathmode's standard data retention policies. See the full privacy policy at [https://pathmode.io/privacy](https://pathmode.io/privacy).
234
+
235
+ **Contact:** For privacy inquiries, contact privacy@pathmode.io.
236
+
237
+ ## Support
238
+
239
+ - Issues: [github.com/pathmode/mcp-server/issues](https://github.com/pathmode/mcp-server/issues)
240
+ - Documentation: [pathmode.io/docs](https://pathmode.io/docs)
241
+
242
+ ## License
243
+
244
+ MIT
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Pathmode API Client for MCP Server
3
+ * Replicates the CLI api-client for standalone packaging.
4
+ */
5
+ export interface PathmodeConfig {
6
+ apiKey: string;
7
+ apiUrl: string;
8
+ workspaceId: string;
9
+ }
10
+ export interface ApiIntent {
11
+ id: string;
12
+ workspaceId: string;
13
+ journeyId?: string;
14
+ stageId?: string;
15
+ stageName?: string;
16
+ status: string;
17
+ version: number;
18
+ objective: string;
19
+ problemSeverity?: string;
20
+ userGoal: string;
21
+ outcomes: string[];
22
+ healthMetrics: string[];
23
+ strategicAlignment?: string;
24
+ alignmentNotes?: string;
25
+ preconditions: Record<string, any>;
26
+ context: Record<string, any>;
27
+ constraints: string[];
28
+ verification: Record<string, any>;
29
+ externalLinks: any[];
30
+ createdAt: string;
31
+ updatedAt: string;
32
+ shippedAt?: string;
33
+ verifiedAt?: string;
34
+ edgeCases: {
35
+ id: string;
36
+ scenario: string;
37
+ expectedBehavior: string;
38
+ }[];
39
+ evidenceIds: string[];
40
+ relations: {
41
+ targetId: string;
42
+ type: string;
43
+ }[];
44
+ }
45
+ export interface ApiWorkspace {
46
+ id: string;
47
+ name: string;
48
+ urlKey?: string;
49
+ tags: string[];
50
+ strategy: {
51
+ vision?: string;
52
+ tradeoffs?: string[];
53
+ nonNegotiables?: string[];
54
+ architecturePrinciples?: string[];
55
+ } | null;
56
+ constitutionRules: {
57
+ id: string;
58
+ category: string;
59
+ text: string;
60
+ isActive: boolean;
61
+ createdAt: string;
62
+ }[];
63
+ }
64
+ export declare function loadConfig(): PathmodeConfig | null;
65
+ export declare class PathmodeClient {
66
+ private apiKey;
67
+ private apiUrl;
68
+ private workspaceId;
69
+ constructor(config: PathmodeConfig);
70
+ private fetch;
71
+ listIntents(status?: string): Promise<ApiIntent[]>;
72
+ getIntent(id: string): Promise<ApiIntent>;
73
+ getIntentPrompt(id: string, agentType?: string, mode?: string): Promise<{
74
+ prompt: string;
75
+ json: object;
76
+ }>;
77
+ updateIntentStatus(id: string, status: string): Promise<any>;
78
+ logNote(intentId: string, note: string, source?: string): Promise<any>;
79
+ getWorkspace(): Promise<ApiWorkspace>;
80
+ getConstitution(): Promise<any>;
81
+ exportClaudeMd(): Promise<string>;
82
+ exportContext(format: 'claude-md' | 'cursorrules' | 'intent-md', intentId?: string): Promise<string>;
83
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"","sourceRoot":"","sources":["file:///Users/jannelammi/code/Pathmode/packages/mcp-server/src/api-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAA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IACvB,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,cAAc;YAMpB,KAAK;IAmBb,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAOlD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAKzC,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,SAAgB,EAAE,IAAI,SAAY,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAKnH,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAQ5D,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAQrE,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC;IAKrC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;IAK/B,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAKjC,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,GAAG,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM7G"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Pathmode MCP Server
3
+ * Connects Claude Code, Cursor, and other AI agents to your Intent Layer.
4
+ *
5
+ * Usage:
6
+ * npx @pathmode/mcp-server # Cloud mode (uses ~/.pathmode/config.json)
7
+ * npx @pathmode/mcp-server --local # Local mode (reads intent.md from cwd)
8
+ *
9
+ * Add to .claude/settings.json:
10
+ * {
11
+ * "mcpServers": {
12
+ * "pathmode": {
13
+ * "command": "npx",
14
+ * "args": ["@pathmode/mcp-server"],
15
+ * "env": { "PATHMODE_API_KEY": "pm_live_..." }
16
+ * }
17
+ * }
18
+ * }
19
+ */
20
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"","sourceRoot":"","sources":["file:///Users/jannelammi/code/Pathmode/packages/mcp-server/src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;GAkBG"}