Spec-Driven Integration: Turning API Sprawl Into a Governed Capability Fleet for AI
Alpha release of a new integration approach that translates your existing data and APIs into standardized APIs, MCP, and agent skills for AI.
Join the DZone community and get the full member experience.
Join For FreeMost enterprises are not short on APIs. The average organization runs more than a thousand SaaS applications and tens of thousands of internal endpoints, with AI-related API traffic growing faster than any other category. The problem isn't supply — it's that nobody can reliably find, govern, or safely reuse what already exists. And now there's a new layer of consumers showing up at the door: copilots and agents that want to call all of it, often in unpredictable patterns, sometimes a thousand times in a runaway loop.
If you've been wiring up Model Context Protocol (MCP) servers for the last year, you've probably already lived the pattern. The first integration goes great. The second feels a little ad-hoc. By the fifth or sixth, you realize you're rebuilding API sprawl one layer up — except this time the ungoverned thing is talking directly to a model.
The honest answer is that the existing toolchain — API gateways, iPaaS, ad-hoc MCP servers, generated SDKs — was not designed for this. We need a different unit of work, and a different methodology for how that unit gets specified, validated, and operated.
This article walks through one such approach: Spec-Driven Integration (SDI) as a methodology, and the Naftiko Framework as an open source reference implementation that just shipped its first alpha.
The Integration Problem, Restated
Three compounding challenges define modern integration work:
- API sprawl. Endpoints are inconsistently shaped, poorly documented, and duplicated across teams. Reuse is invisible, so teams rebuild what already exists.
- Context fragmentation. AI workflows depend on the right data, in the right shape, at the right time — but integration layers are usually too coarse or too opaque to deliver that reliably without dumping raw provider complexity into a context window.
- Drift between intent and behavior. Integration logic lives in code, configuration, and tribal knowledge. As systems evolve, intent diverges from behavior invisibly. Specs age like bananas.
These are not tooling problems. They are specification problems. The artifact that should be the source of truth — the contract between systems — is treated as documentation written after the fact, instead of the thing that actually runs.
Spec-Driven Integration in Plain Terms
Spec-Driven Integration is the integration-domain cousin of spec-driven development. It rests on a small set of principles that I keep coming back to:
- Specifications as the lingua franca. The integration spec is the single source of truth. It defines what is consumed from upstream systems, how inputs and outputs are shaped, and what is re-exposed downstream. Maintaining an integration means evolving its spec. Everything else is derived.
- Executable specifications. A spec is only valuable if it is precise enough to produce a working integration directly. If it cannot be executed as-is, the gap is a signal of incompleteness — not an invitation for interpretation.
- Continuous refinement. Specs are linted, validated, and analyzed for ambiguity throughout their lifecycle, not at a single approval gate.
- Bidirectional feedback. Production behavior feeds back into the spec. Metrics, incidents, and real usage shape spec evolution. The spec is a living artifact, not a snapshot.
- Branching for exploration. A single spec can give rise to multiple integration variants — optimized for cost, performance, consumer type, or context granularity.
The key shift from older approaches (code-first, "generate the spec from the code", documentation-first) is that the spec is not a description of the integration. The spec is the integration.
The Unit of Work: A Capability
SDI needs a concrete artifact to be effective, and that artifact is the capability. A capability is a bounded integration unit that declares two things in a single declarative document:
- What it consumes — the upstream APIs it calls, with authentication, base URIs, and operations.
- What it exposes — the downstream contract it offers to humans or agents, as MCP tools, Agent Skills, or REST endpoints.
Here is a real example from the Shipyard tutorial that ships with the Naftiko Framework:
naftiko: "1.0.0-alpha1"
capability:
consumes:
- namespace: registry
type: http
baseUri: "https://registry.shipyard.dev/api/v1"
resources:
- name: ships
path: "/ships"
operations:
- name: list-ships
method: GET
exposes:
- type: mcp
port: 3001
namespace: shipyard-tools
description: "Shipyard MCP tools for fleet management"
tools:
- name: list-ships
description: "List ships in the shipyard"
call: registry.list-ships
outputParameters:
- type: array
mapping: "$."
items:
type: object
consumes declares where the data lives. exposes declares what the agent sees. call: registry.list-ships is the wire between the two. The outputParameters block reshapes the upstream payload — renaming fields, dropping noise the agent does not need — so the model never sees the raw API surface. This is what right-sized context looks like in practice: smaller, typed outputs aligned to a task instead of a 1:1 endpoint-to-tool dump that wastes tokens and degrades accuracy.
The Capability Engine
For specifications to be executable, the runtime has to interpret them directly. Generating code from a spec reintroduces drift; the engine has to read the spec at runtime and handle every integration concern itself: HTTP consumption, authentication, data transformation, format conversion, and exposure via REST, MCP, or Skill surfaces.
The Naftiko Framework packages this engine as a self-contained Docker container. Any capability spec can be deployed without build pipelines, language runtimes, or bespoke infrastructure. The engine is the stable layer; the spec is the variable one.
The workflow becomes:
- Specify — Author the capability spec.
- Validate — Lint and analyze for completeness, consistency, and ambiguity.
- Execute — Run the engine against the spec; no codegen, no compilation.
- Refine — Evolve the spec based on production feedback.
What is deployed always reflects documented intent, because they are the same artifact.
Meeting Your APIs Where They Are
A common (and reasonable) objection at this point: "I am not rewriting hundreds of integrations as YAML capabilities." You don't have to. Naftiko introduces a four-level progressive abstraction model so you can climb the ladder one capability at a time:
- Forwarding HTTP client — forward any HTTP call with shared endpoint behavior like authentication.
- Templatized HTTP client — reuse predefined request collections imported from HAR, Postman, or similar formats.
- Structured API client — abstract HTTP calls into clean web API paths and operations, enabling reuse across teams.
- Functional MCP client — abstract structured APIs into MCP tools, resources, and prompts for context engineering and agent orchestration.
Start by forwarding. Move to structured. Reach the top when it makes sense to. Nothing forces a wholesale re-architecture, and your existing OpenAPI investment carries forward instead of getting thrown out.
Governance As Guidance, not Gatekeeping
The other thing that has to change for any of this to work at enterprise scale is the operating model around governance. Late-stage gates create shadow infrastructure. Teams route around governance because it is treated as a checkpoint rather than a golden path. The result is what every platform leader I talk to is dealing with right now: shadow gateways, shadow MCP servers, unknown integrations expanding the attack surface, and no audit trail when procurement eventually asks "what did your agents do with our data on a Tuesday in March?"
SDI moves governance left by making the spec lintable from the moment it exists. The Naftiko Framework ships with a Spectral-based ruleset enforcing 15 consistency rules at lint time, a VS Code extension that surfaces violations as you type, and a Super Linter–based GitHub Action template that runs the same rules in CI. The point is to catch what matters — naming, schema, identity propagation, exposed contract shape — before a capability ships, not to slow anyone down with a review board.
This is the practical meaning of "governance as a golden path." Standards and controls are enforced consistently across distributed teams without a human gate in the middle. Compliance gets an auditable trail. Developers get immediate feedback. The two stop being adversaries.
What Ships in Alpha 1
The first alpha of the Naftiko Framework, released April 2026, covers three areas:
- Right-sized AI context — declarative applied capabilities that expose Agent Skills, plus MCP support for Resources and Prompts alongside existing Tools support. The
outputParametersstory above is the key here. - API reusability — lookups within API call steps, consumer authentication and permissions for API and MCP servers, reusable source HTTP adapter declarations across capabilities, and applied capabilities that compose multiple sources.
- Core developer experience — published artifacts on Maven Central and Docker Hub, Javadocs on javadoc.io, a CLI-based Naftiko Skill, the Spectral ruleset, JSON structure validation, the GitHub Action template, and a comprehensive wiki with FAQ, getting started guide, and roadmap.
Alongside the framework, the Naftiko Fleet Community Edition is also free. It includes the framework itself (Apache 2.0), the VS Code extension for live structure and rules validation, Backstage templates that scaffold new capabilities and bootstrap their Git repositories, and a Kubernetes operator coming soon. The Community Edition will always be free. Standard and Enterprise editions will add what large organizations need — SLAs, federation, continuous compliance, domain-level governance — but the framework itself stays open source.
Where This Is Going
The roadmap is on the wiki. The short version:
- Alpha 2 (May 2026) — A2A server adapter, MCP authentication and gateway integration, webhook server adapter, conditional / for-each / parallel orchestration steps, OpenAPI-to-Naftiko import tooling, a Control API accessible via CLI, and starter capability templates.
- Beta (June 2026) — stable spec, resilience patterns (retry, circuit breaker, rate limiter, time limiter, bulkhead), MCP server-side code mode, expanded governance with tags and labels.
- GA (September 2026) — production-ready v1.0 with full test coverage, stable spec, and JSON Schema published to JSON Schema Store.
The Bigger Argument
Your existing data and APIs are not technical debt. They are strategic inventory. They just need to be made discoverable, governed, and reusable as capabilities — instead of scattered projects nobody can find. Capabilities are the right unit because they package consumption, transformation, exposure, and policy into a single inspectable contract that humans and agents can both reason about.
Spec-Driven Integration is the methodology. The capability is the unit. The engine is the runtime. Governance is the golden path. None of these pieces are useful in isolation, but together they describe a different way of operating an integration estate — one that does not collapse the moment agents start calling everything in sight.
If you have been thinking about MCP, AI integration, or how to give your security and compliance teams something better than a SOC 2 PDF, this is worth a serious look. Pull the Docker image, walk through the Shipyard tutorial, and tell us where it breaks.
- GitHub: github.com/naftiko/framework
- Wiki & docs: github.com/naftiko/framework/wiki
- Fleet Community Edition: github.com/naftiko/fleet
Specs age like bananas. Capabilities don't have to.
Published at DZone with permission of Kin Lane. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments