Skip to content

Repository files navigation

spawn

Analyze AI agent logs, extract reusable workflow patterns, and generate production-ready MCP/FastMCP servers.

Tagline: The MCP server that builds MCP servers.

License: MITPython 3.11+Tests


30-second demo

Input: an AI agent session log with repeated workflows.

spawn can:

  1. parse the log,
  2. extract recurring workflow patterns,
  3. score which ones are worth automating,
  4. generate a complete MCP/FastMCP server,
  5. validate the generated structure,
  6. learn from build outcomes.

Result: a reusable MCP server instead of a useful pattern trapped in chat history.

spawn pipeline

Before -> after

Before

A repeated agent workflow lives only in a session transcript:

Read issue text -> classify issue -> create checklist -> write report

After

spawn turns that pattern into a reusable MCP/FastMCP server with:

  • tools,
  • tests,
  • pyproject.toml,
  • README,
  • MCP metadata.

See examples/generated-mcp/ for a compact generated-output sample.

Who this is for

spawn is for people building AI agent systems, MCP ecosystems, internal automation, or repeatable tool workflows from messy real-world agent sessions.

It is especially useful when a workflow keeps appearing in agent traces and deserves to become an explicit, testable tool boundary.

What spawn is not

spawn is not a general-purpose coding agent.

It does not replace semantic judgment from the calling AI. It provides the MCP tools, scoring, templates, validation, and memory hooks needed to turn recurring agent workflows into reusable servers.

What is spawn?

spawn is a meta-MCP server that analyzes patterns in AI agent session logs, scores them for buildability, and generates complete MCP server implementations from those patterns.

It closes the loop: your AI agent discovers a useful workflow -> spawn extracts the pattern -> spawn generates a working MCP server that codifies it.

Design Principle: AI-agnostic. spawn provides data and utilities. The calling AI (any MCP-compatible model) provides semantic understanding. No vendor lock-in.

Why it matters

Every AI agent session produces patterns: recurring tool sequences, multi-step workflows, domain-specific conventions. These patterns are valuable but ephemeral - they exist only in session logs and memory.

spawn makes them permanent. It:

  • Extracts recurring patterns from session logs
  • Scores them for automation potential
  • Generates production-ready MCP servers from scored patterns
  • Learns from build outcomes to improve future scoring

How it works

Session logs / transcripts
|
v
PARSE (log_parser)
Extract tool calls, AI actions, user requests
|
v
EXTRACT (pattern_extractor)
Identify recurring sequences and themes
|
v
SCORE (scoring_engine)
Rate patterns for buildability (frequency, complexity, feasibility)
|
v
GENERATE (generator_engine)
Produce complete MCP server: server.py, tools, tests, pyproject.toml
|
v
VALIDATE (validator)
Verify generated code structure and imports
|
v
LEARN (learning_engine)
Record outcomes, refine scoring weights

17 MCP Tools

Primary Tools (AI-driven workflow)

ToolWhat it does
get_log_contentParse a session log, return structured data for AI analysis
find_recurring_themesFrequency analysis to surface potential patterns
define_patternAI defines a pattern it identified from the content
score_patternsScore patterns for buildability (0-100)
generate_previewPreview generated code before committing
generate_mcpGenerate a complete MCP server from a scored pattern
validate_mcpValidate the generated server structure

Library Tools

ToolWhat it does
list_patternsList all defined patterns in the session
get_patternGet details for a single pattern
store_patternSave a pattern to the persistent library
search_patternsSearch the pattern library by keyword or tag
suggest_similarFind similar existing patterns
learn_outcomeRecord build success/failure for scoring refinement

Pipeline Tools

ToolWhat it does
run_pipelineFull end-to-end: analyze -> score -> generate
compare_existingCompare a pattern against existing MCP servers
batch_analyzeProcess multiple log files in batch

Quick Start

# Install
pip install -e ".[dev]"# Run as MCP server
python -m mcp_builder_mcp.server
# Add to .mcp.json
{
"spawn": {
"command": "bash",
"args": ["-c", "cd /path/to/spawn && .venv/bin/python -m mcp_builder_mcp.server"]
}
}

Example Usage

User: "Analyze my last session log for patterns"
AI: calls get_log_content with the log file
AI: calls find_recurring_themes to identify candidates
AI: calls define_pattern for each promising pattern
AI: calls score_patterns to rank them
AI: calls generate_mcp for the top-scoring pattern
-> Complete MCP server generated: server.py, tests, pyproject.toml, README

Architecture

spawn/
├── src/mcp_builder_mcp/
│ ├── server.py # FastMCP server (17 tools)
│ ├── parser/ # Log parsing (multi-format)
│ │ └── log_parser.py
│ ├── extractor/ # Pattern extraction
│ │ └── pattern_extractor.py
│ ├── scorer/ # Buildability scoring
│ │ └── scoring_engine.py
│ ├── generator/ # Code generation
│ │ ├── generator_engine.py
│ │ ├── validator.py
│ │ └── templates/ # Jinja2 templates for generated code
│ ├── store/ # Persistence
│ │ ├── pattern_store.py # JSON-backed pattern library
│ │ ├── learning.py # Outcome tracking + weight refinement
│ │ └── minna_sync.py # Optional memory integration
│ └── models/ # Data models
│ ├── pattern.py
│ └── score.py
└── tests/ # 156 tests (unit + integration + e2e)

Scoring Model

Patterns are scored on 5 dimensions (configurable weights):

DimensionDefault WeightWhat it measures
Frequency0.3How often the pattern appears
Complexity0.2Complex enough to justify automation?
Feasibility0.2Implementable as an MCP server?
Impact0.2Value of automating this pattern
Novelty0.1Already served by existing tools?

Generated Output

For each pattern, spawn generates:

  • server.py - Complete FastMCP server with tool implementations
  • pyproject.toml - Build configuration
  • tests/test_*.py - Test scaffolding
  • README.md - Documentation
  • MCP_INFO.md - MCP metadata

All generated code uses Jinja2 templates (customizable in generator/templates/).

For a compact illustration of the generated-output contract, see examples/generated-mcp/.

Testing

python -m pytest tests/ -v # All 156 tests
python -m pytest tests/unit/ -v # Unit tests
python -m pytest tests/integration/ -v
python -m pytest tests/e2e/ -v

Showcase

See the spawn showcase site for demos and documentation.

License

MIT

About

Analyze AI agent logs, extract reusable workflow patterns, and generate ready MCP/FastMCP servers.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages