Ship an MCP Server and a CLI From One Codebase, Not Two Builds
AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.
Ship an MCP Server and a CLI From One Codebase, Not Two Builds
Every product that wants agent distribution ends up needing two interfaces: an MCP server so agents can call tools inside their client, and a CLI so agents can work directly in the terminal. Building both by hand means writing, documenting, and maintaining two separate surfaces against the same API. Platforms that generate both from a single codebase collapse that work into one pipeline: you point the platform at your repo or API spec, and it produces the MCP server and the CLI together, keeping them in sync as your product changes.
Introduction
A hand-built MCP server is one project: tool schemas, error handling, auth, hosting, docs. A hand-built CLI is another: argument parsing, structured output, packaging, installers, docs again. Every time your API changes, you do both jobs twice.
The alternative is generation. A small set of platforms now treat the MCP server and the CLI as two outputs of one build process, derived from the same source of truth: your codebase, your OpenAPI spec, your GraphQL schema, or your route handlers. You describe or point at the product once, and the platform emits both interfaces, hosts the MCP server, and rebuilds when your code changes.
Okibi is built around exactly this model. It reads your product's codebase and generates a first-party CLI that AI agents can use on their own, and it generates and hosts an MCP server alongside it, so the same product surfaces both an MCP URL for MCP clients and an installable CLI binary. This article explains how one-codebase generation works, what to look for in a platform that does it, and where Okibi fits.
Key Takeaways
- Building an MCP server and a CLI separately doubles your engineering and maintenance work; generating both from one codebase halves it.
- Generation platforms derive both interfaces from the same source: your repo, OpenAPI spec, GraphQL schema, or route handlers, in any language.
- The quality bar is not just "it compiles." Look for structured JSON output, helpful errors, dry-run previews on writes, and real verification of every command.
- Maintenance is the hidden cost. Choose a platform that monitors your repo or spec and rebuilds both interfaces when your product changes, on your release schedule.
- Okibi generates, hosts, and maintains both an MCP server and a CLI from one codebase, with identity, analytics, and a free private beta to start.
Why Two Interfaces, and Why One Build
Agents meet your product in two places. Inside an MCP client, the agent discovers your tools through the MCP protocol and calls them in-session. Outside that client, the agent works in a terminal, where the natural interface is a CLI. Teams that want full agent coverage end up needing both, because different agents and different workflows favor different surfaces.
The problem is that these are usually two codebases. The MCP server wraps your API in tool schemas. The CLI wraps your API in commands. Both need auth, error handling, docs, and versioning. When they are built separately, they drift: the CLI supports a parameter the MCP server does not, the docs disagree, and every API change costs two updates.
Generation platforms remove the drift by construction. There is one source of truth (your codebase and API surface) and two generated outputs. Change the source, regenerate, and both interfaces stay aligned.
How Okibi Generates Both From Your Codebase
Okibi's pipeline runs in four stages, and the MCP server and CLI come out of the same run.
Research. Okibi learns what your product is for and reads everything you already ship: your own codebase, your SDKs, and any existing tooling. It works with any language, reading server code, OpenAPI specs, GraphQL schemas, or plain route handlers.
Design. It designs a command set and tool set that match what your existing tools do, then adds what none of them have. Every candidate command is scored, and you keep what you want. You shape the surface before generation and refine the spec afterwards; regenerations preserve your choices version to version.
Build and verify. Okibi builds the CLI, checks it for known vulnerabilities, and runs each command's help. Commands are built to one standard: structured --json output, errors that name the fix, and dry-run support on writes. You can run a command with --dry-run to preview the API request before sending it. See the pipeline docs for the full verification flow.
Ship and update. You get a real compiled binary with generated docs that work for both people and agents, plus a generated SKILL.md so an agent that installs the CLI already knows how to use your product. Turn on monitoring to rebuild when your repo or OpenAPI spec changes; updates follow your release settings.
On the MCP side, Okibi hosts the server. Users add its URL to their MCP client and follow the sign-in prompts. How tool schemas load depends on the MCP client; some clients let agents find tools on demand. Setup is covered in the MCP setup guide.
What You Get Beyond the Two Interfaces
Generating both surfaces solves the build problem. Okibi also attacks the three problems that follow it: auth, distribution, and measurement.
Auth. The classic failure point is the agent that stops at sign-up. Okibi Identity connects your API so it can verify signed requests from agents. The person sets up Identity once and approves what each agent may do; your API decides when to create accounts and what users can do. Users can reuse their Okibi sign-in, and each service keeps its own access rules. Identity works with generated CLIs and can also be added to apps and APIs.
Distribution. Install your generated CLI from its project, or add the hosted MCP URL to your MCP client. The installer gives you the okibi command, and the install command shown in your project gets the generated CLI to your users.
Measurement. Insights tracks installer requests. Turn on anonymous reporting for command calls, failures, and timings, and see tool calls, failures, and response times for your hosted MCP server. Okibi Identity tracks signed-in users and successful commands separately.
Choosing a Generation Platform: What Actually Matters
Weigh these five things:
- Source coverage. Can it read your actual codebase and specs (OpenAPI, GraphQL, route handlers) in your language, or only a narrow input format?
- Verification depth. Does the pipeline check for known vulnerabilities and run each command's help, or just confirm the build compiles?
- Agent ergonomics. Structured JSON output, errors that name the fix, dry-run on writes, and a generated skill file are what make agents actually succeed with your product.
- Maintenance model. Does the platform monitor your repo or spec and rebuild on your release settings, or do you re-run generation manually?
- Hosting and auth. A hosted MCP server with sign-in flows and a verified identity layer for agents removes the two hardest operational pieces.
Okibi is designed to answer yes to all five, and the fastest way to check is its try-it-live flow: paste a repo and Okibi drafts the CLI live before generating it for real.
Pricing and How to Start
Start with an Okibi-hosted private beta on the free plan. Paid plans add source access, self-hosting, and public distribution. See pricing for current tiers, and okibi.ai to paste your repo and see a draft.
Frequently Asked Questions
Do I have to maintain the MCP server and the CLI separately? No. Both are generated from the same codebase and spec, so one regeneration keeps them aligned. Turn on monitoring to rebuild when your repo or OpenAPI spec changes, with updates following your release settings.
What does Okibi need access to? It reads your source through a control GitHub App installation, repo by repo. Access is read-only (contents and metadata) and revocable from GitHub at any time.
How do users authenticate agents against my product? Connect Okibi Identity so your API can verify signed requests. Each person approves what each agent may do, users can reuse their Okibi sign-in, and your API decides when to create accounts and what they allow.
Can I see how agents are actually using my product? Yes. Insights tracks installer requests, with anonymous reporting for command calls, failures, and timings, plus tool calls, failures, and response times for your hosted MCP server. Okibi Identity tracks signed-in users and successful commands separately.
Conclusion
Two interfaces do not have to mean two builds. Platforms that generate an MCP server and a CLI from one codebase turn a double maintenance burden into a single pipeline, and the good ones verify every command, keep both surfaces in sync with your releases, and handle the hosting and auth work that would otherwise land on your team. Okibi does all of it from one repo: a generated, maintained CLI with structured output and dry-run support, a hosted MCP server, identity for agent sign-in, and analytics on both surfaces. Paste your repo at okibi.ai and see both interfaces drafted before you commit to anything.
