# `orchestrator.intake.factory`
<!-- generated by `orchestrator understand`; the PKG is source of truth, edits here are advisory -->

[← Episteme](../README.md) · [Architecture](../architecture.md)

**Source:** [`src/orchestrator/intake/factory.py`](../../src/orchestrator/intake/factory.py)

1 types · 13 functions · python

## Changing this safely

**Tested by** (7): `tests.intake.test_factory`, `tests.intake.test_jira_source`, `tests.intake.test_mcp_preferred`, `tests.intake.test_mcp_source`, `tests.intake.test_openspec_source`, `tests.intake.test_web`, `tests.sdlc.test_feature_runner`

**Most depended-upon here** — a change to these reaches the most code (call graph, ≤4 hops):

- [`IntakeNotConfiguredError`](../../src/orchestrator/intake/factory.py#L36) — reaches **31** symbols
- [`build_service_for`](../../src/orchestrator/intake/factory.py#L272) — reaches **23** symbols
- [`_build_service`](../../src/orchestrator/intake/factory.py#L40) — reaches **9** symbols
- [`_build_mcp_service`](../../src/orchestrator/intake/factory.py#L196) — reaches **5** symbols
- [`_with_server`](../../src/orchestrator/intake/factory.py#L100) — reaches **2** symbols
- [`mcp_server_for`](../../src/orchestrator/intake/factory.py#L61) — reaches **2** symbols

## Documented in

`docs/specs/build-documents/SSPN-49-build.md#4-pkg-what-the-graph-knows`

## Types

### `IntakeNotConfiguredError`

[`src/orchestrator/intake/factory.py:36`](../../src/orchestrator/intake/factory.py#L36)

- **Extends** (1): `RuntimeError`
- **Called by** (5 production · 2 test): [`_build_mcp_service`](../../src/orchestrator/intake/factory.py#L196), [`build_confluence_service`](../../src/orchestrator/intake/factory.py#L107), [`build_jira_service`](../../src/orchestrator/intake/factory.py#L134), [`build_notion_service`](../../src/orchestrator/intake/factory.py#L162), [`build_service_for`](../../src/orchestrator/intake/factory.py#L272), [`_raise`](../../tests/sdlc/test_feature_runner.py#L85), [`builder`](../../tests/intake/test_web.py#L130)

## Functions

### `_build_mcp_service`

[`src/orchestrator/intake/factory.py:196`](../../src/orchestrator/intake/factory.py#L196)

- **Called by** (5): [`build_confluence_service`](../../src/orchestrator/intake/factory.py#L107), [`build_jira_service`](../../src/orchestrator/intake/factory.py#L134), [`build_mcp_confluence_service`](../../src/orchestrator/intake/factory.py#L222), [`build_mcp_jira_service`](../../src/orchestrator/intake/factory.py#L234), [`build_mcp_service`](../../src/orchestrator/intake/factory.py#L245)
- **Calls** (4): [`IntakeNotConfiguredError`](../../src/orchestrator/intake/factory.py#L36), [`MCPSourceAdapter`](../../src/orchestrator/intake/mcp_source.py#L208), [`_build_service`](../../src/orchestrator/intake/factory.py#L40), [`from_config`](../../src/orchestrator/mcp/registry.py#L66)

### `_build_service`

[`src/orchestrator/intake/factory.py:40`](../../src/orchestrator/intake/factory.py#L40)

- **Called by** (6): [`_build_mcp_service`](../../src/orchestrator/intake/factory.py#L196), [`build_confluence_service`](../../src/orchestrator/intake/factory.py#L107), [`build_file_service`](../../src/orchestrator/intake/factory.py#L173), [`build_jira_service`](../../src/orchestrator/intake/factory.py#L134), [`build_notion_service`](../../src/orchestrator/intake/factory.py#L162), [`build_openspec_service`](../../src/orchestrator/intake/factory.py#L183)
- **Calls** (9): [`BacklogService`](../../src/orchestrator/intake/service.py#L179), [`GapAnalyzer`](../../src/orchestrator/intake/gaps.py#L124), [`IntentExtractor`](../../src/orchestrator/intake/intents.py#L164), [`JiraAdapter`](../../src/orchestrator/intake/jira.py#L114), [`JiraConfig`](../../src/orchestrator/intake/jira.py#L80), [`SpecWriter`](../../src/orchestrator/intake/specs.py#L119), `getenv`, [`load_gap_rules`](../../src/orchestrator/intake/gaps.py#L118), `orchestrator.core.llm.LiteLLMClient`

### `_with_server`

[`src/orchestrator/intake/factory.py:100`](../../src/orchestrator/intake/factory.py#L100)

- **Called by** (2): [`build_confluence_service`](../../src/orchestrator/intake/factory.py#L107), [`build_jira_service`](../../src/orchestrator/intake/factory.py#L134)
- **Calls** (1): `replace`

### `build_confluence_service`

[`src/orchestrator/intake/factory.py:107`](../../src/orchestrator/intake/factory.py#L107)

- **Calls** (8): [`ConfluenceAdapter`](../../src/orchestrator/intake/confluence.py#L98), [`ConfluenceConfig`](../../src/orchestrator/intake/confluence.py#L61), [`IntakeNotConfiguredError`](../../src/orchestrator/intake/factory.py#L36), [`_build_mcp_service`](../../src/orchestrator/intake/factory.py#L196), [`_build_service`](../../src/orchestrator/intake/factory.py#L40), [`_with_server`](../../src/orchestrator/intake/factory.py#L100), [`for_confluence`](../../src/orchestrator/intake/mcp_source.py#L68), [`mcp_server_for`](../../src/orchestrator/intake/factory.py#L61)
- **Documented in**: `docs/specs/archive/BLOCK-C-DESIGN.md#2-reuse-vs-build-new`

### `build_file_service`

[`src/orchestrator/intake/factory.py:173`](../../src/orchestrator/intake/factory.py#L173)

- **Calls** (3): [`FileSourceAdapter`](../../src/orchestrator/intake/file_source.py#L76), [`FileSourceConfig`](../../src/orchestrator/intake/file_source.py#L48), [`_build_service`](../../src/orchestrator/intake/factory.py#L40)

### `build_jira_service`

[`src/orchestrator/intake/factory.py:134`](../../src/orchestrator/intake/factory.py#L134)

- **Called by** (0 production · 1 test): [`test_jira_builder_unconfigured_raises`](../../tests/intake/test_jira_source.py#L260)
- **Calls** (8): [`IntakeNotConfiguredError`](../../src/orchestrator/intake/factory.py#L36), [`JiraConfig`](../../src/orchestrator/intake/jira.py#L80), [`JiraSourceAdapter`](../../src/orchestrator/intake/jira_source.py#L129), [`_build_mcp_service`](../../src/orchestrator/intake/factory.py#L196), [`_build_service`](../../src/orchestrator/intake/factory.py#L40), [`_with_server`](../../src/orchestrator/intake/factory.py#L100), [`for_jira`](../../src/orchestrator/intake/mcp_source.py#L80), [`mcp_server_for`](../../src/orchestrator/intake/factory.py#L61)

### `build_mcp_confluence_service`

[`src/orchestrator/intake/factory.py:222`](../../src/orchestrator/intake/factory.py#L222)

- **Calls** (2): [`_build_mcp_service`](../../src/orchestrator/intake/factory.py#L196), [`for_confluence`](../../src/orchestrator/intake/mcp_source.py#L68)

### `build_mcp_jira_service`

[`src/orchestrator/intake/factory.py:234`](../../src/orchestrator/intake/factory.py#L234)

- **Calls** (2): [`_build_mcp_service`](../../src/orchestrator/intake/factory.py#L196), [`for_jira`](../../src/orchestrator/intake/mcp_source.py#L80)

### `build_mcp_service`

[`src/orchestrator/intake/factory.py:245`](../../src/orchestrator/intake/factory.py#L245)

- **Calls** (2): [`_build_mcp_service`](../../src/orchestrator/intake/factory.py#L196), [`from_env`](../../src/orchestrator/intake/mcp_source.py#L92)

### `build_notion_service`

[`src/orchestrator/intake/factory.py:162`](../../src/orchestrator/intake/factory.py#L162)

- **Calls** (4): [`IntakeNotConfiguredError`](../../src/orchestrator/intake/factory.py#L36), [`NotionAdapter`](../../src/orchestrator/intake/notion.py#L97), [`NotionConfig`](../../src/orchestrator/intake/notion.py#L55), [`_build_service`](../../src/orchestrator/intake/factory.py#L40)

### `build_openspec_service`

[`src/orchestrator/intake/factory.py:183`](../../src/orchestrator/intake/factory.py#L183)

- **Calls** (2): [`OpenSpecSourceAdapter`](../../src/orchestrator/intake/openspec_source.py#L172), [`_build_service`](../../src/orchestrator/intake/factory.py#L40)

### `build_service_for`

[`src/orchestrator/intake/factory.py:272`](../../src/orchestrator/intake/factory.py#L272)

- **Called by** (9 production · 12 test): [`_go`](../../src/orchestrator/cli.py#L1210), [`_load_ticket`](../../src/orchestrator/cli.py#L2498), [`_run_ingest`](../../src/orchestrator/cli.py#L312), [`_run_openspec_draft`](../../src/orchestrator/cli.py#L403), [`_stage_intake`](../../src/orchestrator/sdlc/autorun.py#L551), [`ingest_preview`](../../src/orchestrator/plugin/server.py#L67), [`intake_analyze`](../../src/orchestrator/sdlc/activities.py#L177), [`run_feature`](../../src/orchestrator/sdlc/feature_runner.py#L623), [`run_preview`](../../src/orchestrator/intake/web/app.py#L88), [`test_configured_mcp_confluence_builds`](../../tests/intake/test_mcp_source.py#L176), [`test_confluence_builder_configured_wires_confluence_source`](../../tests/intake/test_factory.py#L106), [`test_confluence_builder_unconfigured_raises`](../../tests/intake/test_factory.py#L86), [`test_dispatch_routes_to_kind_builder`](../../tests/intake/test_factory.py#L44), [`test_file_builder_needs_no_credentials`](../../tests/intake/test_factory.py#L100), [`test_generic_mcp_unconfigured_raises`](../../tests/intake/test_mcp_source.py#L159), [`test_malformed_uri_propagates_source_uri_error`](../../tests/intake/test_factory.py#L74), [`test_notion_builder_configured_wires_notion_source`](../../tests/intake/test_factory.py#L94), [`test_notion_builder_unconfigured_raises`](../../tests/intake/test_factory.py#L80), [`test_openspec_is_a_supported_kind`](../../tests/intake/test_openspec_source.py#L143), [`test_unconfigured_mcp_confluence_raises`](../../tests/intake/test_mcp_source.py#L170), [`test_unsupported_kind_raises_with_supported_list`](../../tests/intake/test_factory.py#L66)
- **Calls** (2): [`IntakeNotConfiguredError`](../../src/orchestrator/intake/factory.py#L36), [`parse_source_uri`](../../src/orchestrator/intake/service.py#L40)

### `mcp_server_for`

[`src/orchestrator/intake/factory.py:61`](../../src/orchestrator/intake/factory.py#L61)

- **Called by** (2 production · 8 test): [`build_confluence_service`](../../src/orchestrator/intake/factory.py#L107), [`build_jira_service`](../../src/orchestrator/intake/factory.py#L134), [`test_a_lone_unrestricted_server_is_trusted`](../../tests/intake/test_mcp_preferred.py#L69), [`test_a_malformed_config_falls_back_rather_than_exploding`](../../tests/intake/test_mcp_preferred.py#L92), [`test_disabled_servers_are_skipped`](../../tests/intake/test_mcp_preferred.py#L83), [`test_env_var_naming_an_absent_server_is_ignored`](../../tests/intake/test_mcp_preferred.py#L62), [`test_env_var_overrides_the_allow_list_scan`](../../tests/intake/test_mcp_preferred.py#L48), [`test_no_config_means_no_mcp`](../../tests/intake/test_mcp_preferred.py#L28), [`test_picks_the_server_that_allow_lists_the_tool`](../../tests/intake/test_mcp_preferred.py#L34), [`test_several_unrestricted_servers_decline_to_guess`](../../tests/intake/test_mcp_preferred.py#L75)
- **Calls** (2): `getenv`, [`load_mcp_configs`](../../src/orchestrator/mcp/config.py#L57)
- **Documented in**: `docs/specs/conversational-source-access.md#what-already-exists-build-on-this-do-not-rebuild`, `docs/specs/conversational-source-access.md#why`

## Imports

`__future__.annotations`, [`orchestrator.core.llm`](../../src/orchestrator/core/llm/__init__.py#L1), [`orchestrator.intake.confluence`](../../src/orchestrator/intake/confluence.py#L1), [`orchestrator.intake.file_source`](../../src/orchestrator/intake/file_source.py#L1), [`orchestrator.intake.gaps`](../../src/orchestrator/intake/gaps.py#L1), [`orchestrator.intake.intents`](../../src/orchestrator/intake/intents.py#L1), [`orchestrator.intake.jira`](../../src/orchestrator/intake/jira.py#L1), [`orchestrator.intake.jira_source`](../../src/orchestrator/intake/jira_source.py#L1), [`orchestrator.intake.mcp_source`](../../src/orchestrator/intake/mcp_source.py#L1), [`orchestrator.intake.notion`](../../src/orchestrator/intake/notion.py#L1), [`orchestrator.intake.openspec_source`](../../src/orchestrator/intake/openspec_source.py#L1), [`orchestrator.intake.service`](../../src/orchestrator/intake/service.py#L1), [`orchestrator.intake.source`](../../src/orchestrator/intake/source.py#L1), [`orchestrator.intake.specs`](../../src/orchestrator/intake/specs.py#L1), [`orchestrator.mcp.config`](../../src/orchestrator/mcp/config.py#L1), [`orchestrator.mcp.registry`](../../src/orchestrator/mcp/registry.py#L1), `os`, `typing.Any`, `typing.TYPE_CHECKING`

## Imported by

[`orchestrator.cli`](orchestrator.cli.md), [`orchestrator.intake.web.app`](../../src/orchestrator/intake/web/app.py#L1), [`orchestrator.plugin.server`](orchestrator.plugin.server.md), [`orchestrator.sdlc.activities`](../../src/orchestrator/sdlc/activities.py#L1), [`orchestrator.sdlc.autorun`](orchestrator.sdlc.autorun.md), [`orchestrator.sdlc.feature_runner`](orchestrator.sdlc.feature_runner.md), [`orchestrator.sdlc.run_control`](../../src/orchestrator/sdlc/run_control.py#L1), [`tests.intake.test_factory`](../../tests/intake/test_factory.py#L1), [`tests.intake.test_jira_source`](../../tests/intake/test_jira_source.py#L1), [`tests.intake.test_mcp_preferred`](../../tests/intake/test_mcp_preferred.py#L1), [`tests.intake.test_mcp_source`](../../tests/intake/test_mcp_source.py#L1), [`tests.intake.test_openspec_source`](../../tests/intake/test_openspec_source.py#L1), [`tests.intake.test_web`](../../tests/intake/test_web.py#L1), [`tests.sdlc.test_feature_runner`](../../tests/sdlc/test_feature_runner.py#L1)
