JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q75334F
  • License MIT

MCP server for FirstToFly Orchestrator - persistent memory for Claude Code

Package Exports

  • @first-to-fly/orchestrator-mcp
  • @first-to-fly/orchestrator-mcp/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@first-to-fly/orchestrator-mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@first-to-fly/orchestrator-mcp

Persistent, structured memory for Claude Code via MCP.

Claude Code has two built-in memory mechanisms — CLAUDE.md (static instructions) and auto memory (a 200-line markdown notepad). Both are local files tied to one machine with no search, no structure, and no way to share context between developers or CI agents.

Orchestrator adds a third layer: a database-backed memory system with typed entities, relationships, relevance-scored recall, and lifecycle management — accessible from any environment via API key.

What it does

  • Recalls past decisions so you don't re-explain architecture every session
  • Remembers error fixes so the same bug doesn't get debugged twice
  • Transfers context between sessions — local, CI, or team members
  • Stores patterns with examples so agents follow your conventions
  • Manages a work queue so webhook events become tasks agents pick up
  • Tracks costs per session so you know what you're spending

Quick Start

  1. Sign up at orchestrator.firsttofly.com and create a project
  2. Generate an API key from the project's Setup page
  3. Run the init command in your project directory:
npx @first-to-fly/orchestrator-mcp init

# or, if you're in a pnpm project:
pnpm dlx @first-to-fly/orchestrator-mcp init

This will:

  • Prompt for your API URL, key, and project slug
  • Validate the API key against the server
  • Create .mcp.json with the MCP server config
  • Append the orchestrator protocol to CLAUDE.md
  • Set up hooks in .claude/settings.local.json for session auto-inject and save reminders
  1. Start a new Claude Code session — the orchestrator auto-connects and injects last session context

Manual Setup

If you prefer to configure manually, create these files in your project root.

.mcp.json

{
  "mcpServers": {
    "orchestrator": {
      "command": "npx",
      "args": ["@first-to-fly/orchestrator-mcp"],
      "env": {
        "ORCHESTRATOR_API_URL": "https://orchestrator-api.firsttofly.com/api/v1",
        "ORCHESTRATOR_API_KEY": "ftfo_your_key_here",
        "ORCHESTRATOR_PROJECT": "your-project-slug"
      }
    }
  }
}

Environment Variables

Variable Description Required
ORCHESTRATOR_API_URL API endpoint (e.g. https://orchestrator-api.firsttofly.com/api/v1) Yes
ORCHESTRATOR_API_KEY Project API key (starts with ftfo_) Yes
ORCHESTRATOR_PROJECT Project slug Yes

How Context Transfers Between Sessions

  1. Session ends — the agent saves a structured summary: what was accomplished, decisions made, blockers, files modified, next steps
  2. Next session starts — the SessionStart hook auto-calls recall_context, injecting the last session summary and relevant entities into context
  3. Agent picks up where the last left off — no re-explaining, regardless of whether it's the same developer, a different team member, or a CI agent

This works identically for local development, CI pipelines, and team members because Orchestrator is a remote service — not a file on your machine.

Available Tools (27)

Tool What it does
recall_context Retrieve relevant memory for a task. Returns scored entity summaries + last session + matching recipes. The primary entry point — call this at the start of every session.
search_memory Search stored knowledge by keyword. Useful when you know what you're looking for (e.g. "authentication" or "deployment").
list_recent Browse the most recently updated entities, optionally filtered by type. Good for seeing what was stored recently.
get_entity Fetch the full content of a specific entity by type and ID. Use after recall_context or search_memory returns a summary you need details on.
get_last_session Get the previous session's handoff summary directly.
search_sessions Search across past session summaries by keyword. Find what was done in previous sessions.

Store & Update

Tool What it does
store_entity Store a knowledge entity. Deduplicates by type+name — if an entity with the same type and name exists, it updates instead of creating a duplicate. Supports 8 types: module, decision, pattern, requirement, error, task, observation, session.
store_entities Bulk store up to 50 entities in one call. Same deduplication logic.
update_entity Update an existing entity's name, content, tags, or status. Supports optimistic concurrency via expected_version.
delete_entity Delete an entity. Defaults to dry-run mode — set dry_run: false to request deletion, which requires human approval.
store_relationship Link two entities with a typed relationship: depends_on, relates_to, supersedes, caused_by, part_of, or implements.
add_observation Shortcut to store an observation entity. Use for quick insights that don't fit other types.
scaffold_project Auto-generate module, decision, and pattern entities from codebase structure. Safe to re-run — deduplicates.

Sessions

Tool What it does
save_session_summary Save a structured handoff for the next session. Include: summary, tasks completed/in-progress, blockers, files modified, decisions made, next steps.

Error Lifecycle

Tool What it does
check_error Before debugging from scratch, check if a similar error was seen and resolved before. Matches on error message and optional stack trace.
resolve_error Mark an error entity as resolved with the fix and root cause. Completes the check → fix → resolve lifecycle so future sessions benefit.

Work Queue

Tool What it does
claim_next_task Claim the highest-priority unclaimed work item. Returns the task context and a claim token. Work items can be created from GitHub/Slack webhooks or manually.
complete_task Mark a claimed work item as done with a result summary and optional validation artifacts (test results, diffs, logs).
fail_task Mark a claimed work item as failed. If under the retry limit, it's automatically requeued.

Recipes

Tool What it does
get_recipe Fetch a prompt template by name. Recipes can reference entities and accept variables — they're auto-suggested during recall when context matches.
list_recipes List all available recipes for the project.

Built-in Recipes

Recipe Triggers What it does
debug-error debug, error, fix, bug Guided error debugging workflow: check → investigate → store → resolve
new-module new module, create module, scaffold Scaffold a new backend module following conventions
session-handoff end session, wrap up, done for today Template for saving a complete session summary
knowledge-capture learned, discovery, insight, remember Decision tree for choosing the right entity type
bootstrap-knowledge bootstrap, scaffold, index project Comprehensive codebase analysis and knowledge indexing
investigate-area how does, understand, explore Systematic approach to understanding a code area
capture-spec spec, requirement, feature, user story Capture requirements as versioned, structured entities
implement-from-spec implement spec, implement requirement, build feature Implement a feature by reviewing its stored requirements first

Maintenance

Tool What it does
prune_stale Remove entities that haven't been accessed and are older than a threshold (default: 90 days). Dry-run by default — set confirm: true to actually delete. Protected types (session, decision, pattern) are never auto-pruned.
check_staleness List all entities past their type's staleness window. Helps identify knowledge that may need updating or removal.
track_files Record which files were modified and why. Stored as a tagged observation for cross-session queryability.

Approvals

Tool What it does
request_approval Request human approval for a destructive action (delete, prune, bulk operations). Returns an approval ID to poll.
check_approval Check the status of a pending approval request.

Analytics

Tool What it does
report_session_cost Report token usage and estimated cost for the current session. Feeds the analytics dashboard.

Entity Types

Type Purpose Stale after TTL Protected
module Code areas and architecture 180 days Permanent No
decision Architectural choices with rationale, alternatives, tradeoffs 365 days Permanent Yes
pattern Reusable approaches with example files and anti-patterns 365 days Permanent Yes
requirement Specs and requirements with acceptance criteria 365 days Permanent Yes
error Bug + fix pairs with stack traces and root cause 60 days 90 days No
task Completed work with files modified and outcome 30 days 90 days No
observation Quick insights and notes 60 days 90 days No
session Structured handoff summaries between sessions 180 days 180 days Yes

Protected types are never auto-pruned by prune_stale.

Requirement Structured Fields

Requirements support additional structured fields via store_entity:

Field Description Example
acceptance_criteria Testable conditions (WHEN/THEN or checklist) "WHEN user clicks submit THEN form validates"
priority must-have, should-have, or nice-to-have "must-have"
requirement_source Origin of the requirement "Product spec v2", "ticket-123"
scope Affected modules or areas "payments, checkout"

Version History

Every entity update stores a version snapshot. Updates via both API (human) and MCP (agent) are tracked.

API endpoints (not MCP tools — agents don't need version history):

GET /projects/:slug/entities/:type/:id/versions
  → Returns version metadata: version number, editedBy, editedAt, source, changeReason

GET /projects/:slug/entities/:type/:id/versions/:version
  → Returns full content for a specific version (for diff comparison)

The update_entity MCP tool accepts a change_reason parameter to record why a change was made:

update_entity({ type: "requirement", id: "...", content: "...", change_reason: "Updated scope after stakeholder review" })

CLAUDE.md Protocol

The init command appends this protocol to your CLAUDE.md. It tells Claude Code when and how to use the orchestrator tools:

## Orchestrator Protocol

### Session Start
- Context is auto-injected via hook (last session + recalled memory)
- Call `recall_context` with your task description for relevant knowledge

### Progressive Retrieval
- `recall_context` and `search_memory` return summaries by default
- Use `get_entity(type, id)` only for entities you need full content from

### Error Resolution
- Call `check_error` before debugging from scratch — it may have a known fix

### Save Triggers
| Trigger | Entity Type |
|---------|------------|
| Architectural choice | `decision` |
| Reusable pattern found | `pattern` |
| Bug fixed | `error` |
| Task completed | `task` |
| Module created | `module` |
| Requirement clarified | `requirement` |
| Quick insight | `observation` |

### Relationships
Link related entities: `depends_on`, `supersedes`, `caused_by`, `implements`, `part_of`, `relates_to`

### Session Handoff
Before ending a session, call `save_session_summary` with:
- summary, tasksCompleted, tasksInProgress, blockers, filesModified, decisionsMade, nextSteps

### Maintenance
- `prune_stale` — remove unaccessed entities (dry run by default)
- `list_recent` — browse stored knowledge
- `search_memory` — find specific entities

Hooks

The init command sets up two hooks in .claude/settings.local.json:

  • SessionStart: Auto-calls recall_context with the last session summary, so every new session inherits prior context without you doing anything
  • Stop: Prompts Claude to call save_session_summary before the session ends if any meaningful work was done (files changed, bugs fixed, decisions made)

Works Everywhere

Environment How it connects What it gets
Local developer MCP server in Claude Code settings Full memory — recall, store, queue, recipes
CI agent Same MCP config with API key Same memory — PR review agents recall project patterns and past decisions
Team member Shared project, own API key Shared knowledge — one developer stores a decision, another recalls it