CAPA: One Command to Manage Your Agent's Tools and Context
← All posts

CAPA: One Command to Manage Your Agent's Tools and Context


As developers managing MCP tools across several projects, we kept running into the same issues. Every MCP server exposed dozens of tools that were not needed, skills were copy-pasted between repositories, and onboarding a teammate (or a new machine) meant walking through server installs, client configuration, and environment variables by hand. CAPA changed that with one file and one command.

The Problem

Common agent setups suffer from the following problems.

  • Tool overload. MCP servers ship with many tools, while the agent often requires only a few. However, the schema of every tool is sent to the model regardless, which wastes context and muddies its decisions.
  • Skill duplication. Reusing a skill usually means copying it into each project. Thus, when a skill is improved, it has to be updated everywhere.
  • Team setup friction. A new developer (or a new laptop) must install servers, configure the MCP client, set environment variables, and register endpoints. All of this is done by hand and is error-prone.
  • Secrets and environment. API keys and configuration are often hardcoded or scattered across different config files.

The Solution: CAPA

CAPA is a “package” manager for AI agents. All capabilities are defined in a single declarative file, capabilities.yaml, and installed with one command (capa install). CAPA does not implement each tool itself. Rather, it sits between the MCP client (e.g. Cursor) and the tool sources, and it proxies tool calls to downstream MCP servers and to shell commands. That is, one CAPA server and one config serve many tools, without reimplementing any of them.

In the default “expose-all” mode, CAPA exposes only the tools that the skills need. The on-demand mode reduces the context further. The agent initially sees only two meta-tools (setup_tools and call_tool), and it loads the real tool schemas only when it activates a skill. In both modes, the context stays under control.

Creating the server

Reducing Context Size

In on-demand mode, tools are omitted from the system prompt and are loaded only when needed. The process is as follows.

  1. Activate a skill. The agent calls setup_tools({"skills": ["web-researcher"]}).
  2. Receive schemas. CAPA returns the full tool schemas (name, description, parameters) for that skill.
  3. Invoke tools. The agent calls call_tool({"name": "brave_search", "data": {"query": "..."}}), and CAPA proxies the call to the appropriate MCP server or command.

Therefore, the context of the agent starts with only two meta-tools, and it receives the full set of tool definitions only after it determines which capability it requires. There is no need to ship the schema of every tool in advance.

setup_tools({"skills": ["web-researcher"]})
// CAPA returns: tool schemas for brave_search, etc.

call_tool({"name": "brave_search", "data": {"query": "latest AI developments"}})

Reusability

Skills do not have to live in the repository. They can be referenced as inline content, from GitHub (owner/repo@skill-name), from GitLab, or from a remote URL. The capabilities file is placed in version control, so all developers share one definition. When capa install runs, CAPA fetches the remote skills and wires up the full setup. Thus, one update to a shared skill benefits every project that references it, with no copy-paste.

One Command for Teams: capa install

The entire setup requires only one command.

capa install

It performs the following steps.

  1. Installs skills to the configured agents (e.g. .cursor/skills/)
  2. Configures the CAPA server with the defined tools and servers
  3. Prompts for any required credentials via a web UI (alternatively, capa install -e loads them from a .env file)
  4. Registers the MCP endpoint of the project in the client config (e.g. Cursor)
  5. Starts the CAPA server

A new teammate clones the repository, runs capa install, provides the secrets once (or points to a .env file), and then has the same agent setup as the other developers.

# Interactive: web UI for credentials
capa install

# Non-interactive: use .env (e.g. CI or team .env.example workflow)
capa install -e
capa install -e .prod.env

Proxying Tool Calls

In capabilities.yaml we define servers (e.g. Brave Search, filesystem, GitHub) and tools that reference them. MCP tools use server: "@brave" and tool: brave_web_search, and CAPA proxies each call_tool to the correct MCP server. It is also possible to define command tools (shell commands with arguments and an optional init step), which CAPA runs locally before returning the output. So CAPA proxies to both downstream MCP servers and commands.

The example below defines one MCP tool and one command tool.

servers:
  - id: brave
    type: mcp
    def:
      cmd: npx -y @modelcontextprotocol/server-brave-search
      env:
        BRAVE_API_KEY: ${BraveApiKey}

tools:
  - id: brave_search
    type: mcp
    def:
      server: "@brave"
      tool: brave_web_search

  - id: greet_user
    type: command
    def:
      run:
        cmd: echo Hello, {name}!
        args:
          - name: name
            type: string
            description: The name to greet
            required: true

Environment Variables and Secrets

CAPA also handles secrets and environment variables. The capabilities file uses placeholders such as ${BraveApiKey} or ${GitHubToken}, so keys are not hardcoded. When capa install runs, CAPA opens a web UI to collect these values. Alternatively, capa install -e loads them from a .env file. Values from the web UI are stored encrypted in ~/.capa/capa.db. For teams and CI, we maintain a .env.example that lists the required variables and add .env to .gitignore. Then each developer runs capa install -e with an individual .env.

The Result

Before CAPA, the setup included multiple MCP servers, a large tool list in context, duplicated skills, manual client configuration, and scattered secrets. After CAPA, it consists of one capabilities file, one capa install, and either a small curated tool set or two meta-tools with on-demand loading. For example, when the agent is asked to research a topic, it activates the web-researcher skill and uses brave_search without seeing fifty other tools.

Why CAPA Made the Difference

  • Context. Only the needed tools are exposed (or, in on-demand mode, only two meta-tools before the agent activates a skill).
  • Reusability. Skills are referenced from GitHub, GitLab, or a URL, and one update benefits all projects.
  • Team alignment. capabilities.yaml is committed, and every developer runs capa install to receive the same agent setup.
  • Proxying. One CAPA server sits in front of many MCP servers and commands, with no tools reimplemented.
  • Secrets. Credentials live in one place (web UI or .env), and no keys are stored in YAML.

Overall, CAPA replaces a potential mess of per-project MCP configuration, duplicated skills, and manual onboarding with a single declarative file and one command.

Conclusion

Therefore, we recommend CAPA for teams that need less context bloat, reusable skills, and a single command to manage the agentic setup. The capabilities are defined once, capa install runs, and CAPA proxies the rest.

What came after this post

CAPA continued to develop, and each of the following posts picks up where this one ends.


To install CAPA, use one of the commands below, or learn more at capa.infragate.ai.

# macOS and Linux
curl -LsSf https://capa.infragate.ai/install.sh | sh
# Windows (PowerShell) 
powershell -ExecutionPolicy ByPass -c "irm https://capa.infragate.ai/install.ps1 | iex"