FrameworkOrchestrator
README.md
# FrameworkOrchestrator
An MCP (Model Context Protocol) server that lets coding assistants such as **GitHub Copilot agent mode, Claude
Code and Cursor** scaffold QA automation frameworks and generate page objects, tests and locators that follow
your house style, compile, and never overwrite your code.
> **Host LLM generates, server guarantees.** The server makes **no LLM API calls** and needs no API keys. Your
> assistant's own model writes the code. The server supplies deterministic context (stack detection, templates,
> conventions, existing classes) and safe actions (scaffold, write, dedupe locators, compile and report errors).
```
You: "Create a Playwright TypeScript framework with a LoginPage and a login test"
└─ assistant ── detect_project ─► plan_framework ─► (you approve the file list) ─► scaffold_framework
generate_class ─► writes the class body ─► write_file ─► add_locators ─► validate ─► fix ─► validate
```
## Supported stacks
| Template pack | Stack | Class kinds | `add_locators` |
|---|---|---|---|
| `selenium-java-testng-pom` | Selenium 4 + Java 21 + TestNG + Maven, Page Object Model | page, test, util, api_client | `By` fields or `@FindBy` |
| `playwright-ts-test-pom` | Playwright Test + TypeScript + npm, Page Object Model with fixtures | page, test | `getByRole` / `getByLabel` / `getByTestId` ... |
New stacks are added as data (a template pack plus a conventions file), not code. See
[Adding a stack](#adding-a-stack).
## Tools
| Tool | What it does | Writes? |
|---|---|---|
| `detect_project` | Detects language, build tool, test tool, runner, pattern, base package, matching pack and existing classes (javalang for Java, tree-sitter for TypeScript) | No |
| `list_templates` | Lists template packs and their variables | No |
| `plan_framework` | Builds a manifest of every file it would create (`new` / `exists`) for you to approve | No |
| `scaffold_framework` | Renders the approved manifest (build file, base classes, config, agent instructions) and skips existing files | Yes |
| `generate_class` | Returns a compilable skeleton with `TODO(llm)` markers, related classes with their method signatures, and instructions for the assistant | No |
| `write_file` | Writes a file inside the workspace; refuses `..`, absolute paths and existing files unless `overwrite=true` | Yes |
| `add_locators` | Adds only new, unique locators to a page class (AST-based dedupe, so `testid x` = `[data-testid="x"]` = `getByTestId('x')`) and keeps the class's style | Yes |
| `validate` | Runs `mvn` / `gradle` / `tsc` / `compileall` / `ruff` and returns structured errors (`file`, `line`, `message`, `code`) | No |
| `ping` | Health check | No |
Every write tool supports `dry_run`. Errors come back as `{"status": "error", "errors": [{file, line, message, code}]}`,
never as stack traces. Full contracts: [docs/04-MCP-TOOLS-SPEC.md](docs/04-MCP-TOOLS-SPEC.md).
### Slash commands (MCP prompts)
| Prompt | Arguments | Flow |
|---|---|---|
| `new-framework` | tool, language, pattern, requirements | detect, plan, approve, scaffold, generate, validate |
| `new-page-class` | page_name, description, html_snippet? | one page class plus its locators |
| `add-locators` | page_class_path, html_snippet | pick locators from HTML and add only new ones |
| `jira-to-tests` | jira_text | turn ticket text into tests and page classes |
They appear as `/mcp.framework-orchestrator.<name>` in VS Code Copilot and `/mcp__framework-orchestrator__<name>`
in Claude Code. Resources: `conventions://{pack}` (house style) and `template://{pack}/{kind}` (raw templates).
## Requirements
- Python 3.11+ and [uv](https://docs.astral.sh/uv/)
- To compile generated projects with `validate`: JDK + Maven for the Java pack; Node.js + npm for the Playwright
pack (run `npm install` in the generated project first)
## Install
```bash
git clone https://github.com/vaibhavf775-jpg/framework-orchestrator-mcp.git
cd framework-orchestrator-mcp
uv sync
uv run framework-orchestrator # starts the stdio server; your assistant normally launches it for you
```
## Connect it to your assistant
The repo's own `.mcp.json` and `.vscode/mcp.json` use `--directory .` / `${workspaceFolder}`, so they only work
when this repo is the open workspace (handy for developing the server). To use it **from your test project**,
point `--directory` at the absolute path of your clone.
**Claude Code** (`.mcp.json` in your project, or `claude mcp add`):
```json
{
"mcpServers": {
"framework-orchestrator": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/framework-orchestrator", "framework-orchestrator"]
}
}
}
```
**VS Code / GitHub Copilot** (`.vscode/mcp.json` in your project):
```json
{
"servers": {
"framework-orchestrator": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/framework-orchestrator", "framework-orchestrator"]
}
}
}
```
Check it is connected with `/mcp` in Claude Code or **MCP: List Servers** in VS Code, then ask the assistant to
call `ping`. On Windows use a path like `C:/Users/you/framework-orchestrator`.
## Example requests
- *"What automation stack is this project?"* → `detect_project`
- *"Create a Selenium Java TestNG framework with base package com.acme.qa and a LoginPage + LoginTest."*
- *"Scaffold a Playwright TypeScript framework named acme-e2e for https://qa.acme.com."*
- *"Add locators for this HTML to pages/CheckoutPage.ts: `<button data-testid="pay">Pay now</button>` ..."*
- `/mcp__framework-orchestrator__new-page-class` with a page name, a description and an HTML snippet
The assistant always shows the planned file list and waits for your approval before anything is written. Re-running
a scaffold skips every file that already exists.
## Safety guarantees
- **No overwrites.** Existing files are reported as `skipped`. Only an explicit `overwrite=true` replaces a file,
and the bundled prompts ask you before using it.
- **Root-scoped writes.** Paths with `..`, absolute paths and symlinks that escape the workspace are refused (`OUTSIDE_ROOT`).
- **Approval first.** `plan_framework` writes nothing; `scaffold_framework` only writes the manifest you approved.
- **Minimal edits.** `add_locators` inserts lines and never reformats existing ones; line endings are preserved.
- **No network or LLM calls** from the server. `validate` runs your local toolchain with a 300 s timeout and no shell.
## Development
```bash
uv run ruff check . # lint
uv run mypy src # strict type check
uv run pytest -q # unit + MCP stdio integration tests
# Optional: scaffold the Playwright pack, add locators, npm install and type-check it for real
FO_RUN_NPM=1 uv run pytest -q tests/integration/test_playwright_tsc.py
```
Project rules for contributors (human or AI) are in [CLAUDE.md](CLAUDE.md): no LLM clients in the server, every
prompt in RICE-PoT format, a thin `server.py` with logic in `core/`, safe writes, AST parsing instead of regex for
source code, functions under 40 lines and modules under 300.
### Layout
```
src/framework_orchestrator/
server.py MCP registration only (tools, prompts, resources)
core/ detector, planner, scaffolder, generator, locators, writer, validator, ...
core/parsers/ javalang (Java), tree-sitter (TypeScript), build-output parsers
templates/<pack>/ pack.yaml + scaffold/ + kinds/ Jinja2 templates (StrictUndefined)
conventions/<pack>.md house style, served as conventions://<pack> and copied into generated projects
prompts/ RICE-PoT slash commands; prompts/_internal/ holds tool instructions
tests/ unit, integration (real MCP client over stdio), fixtures and golden files
```
### Adding a stack
1. Create `templates/<tool>-<language>-<runner>-<pattern>/` with `pack.yaml` (`detect`, `variables`, `kinds`,
`naming`), `scaffold/` and `kinds/` templates that compile with every `TODO(llm)` left in place.
2. Write `conventions/<pack>.md`.
3. Add a fixture project, a detector test and golden-file render tests.
No Python changes are needed for a new stack in a supported language. A new *language* needs a parser registered in
`core/parsers/sources.py` and, for `add_locators`, a `LocatorEditor` registered in `core/locators.py`.
Details: [docs/05-TEMPLATES-AND-CONVENTIONS.md](docs/05-TEMPLATES-AND-CONVENTIONS.md).
## Design docs
| Doc | Contents |
|---|---|
| [01-ARCHITECTURE](docs/01-ARCHITECTURE.md) | Responsibilities, components and request flow |
| [02-PROJECT-STRUCTURE](docs/02-PROJECT-STRUCTURE.md) | Folder and module layout |
| [03-RICE-POT-STANDARD](docs/03-RICE-POT-STANDARD.md) | Mandatory prompt format: Role, Instructions, Context, Example, Parameters, Output, Tone |
| [04-MCP-TOOLS-SPEC](docs/04-MCP-TOOLS-SPEC.md) | Contract for every tool, prompt and resource |
| [05-TEMPLATES-AND-CONVENTIONS](docs/05-TEMPLATES-AND-CONVENTIONS.md) | Template packs, variables and conventions files |
| [06-IMPLEMENTATION-PLAN](docs/06-IMPLEMENTATION-PLAN.md) | The phased build plan (phases 0 to 6) with their prompts |
| [07-TESTING-AND-VALIDATION](docs/07-TESTING-AND-VALIDATION.md) | Test strategy and done criteria |
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues