Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .changeset/agent-mcp-subpath.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
"@openrouter/agent": minor
"@openrouter/mcp": minor
---
Comment on lines +1 to +4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Release notes declare a compatible update even though public entry points are removed

The release note marks both packages as a backward-compatible feature release ("@openrouter/agent": minor at .changeset/agent-mcp-subpath.md:1-4) while the change deletes published entry points and exported error types.

Impact: Consumers get a breaking change delivered as a routine minor upgrade, with no migration guidance in the changelog.

Repository bump-type rule

.agents/skills/changeset-versioning/SKILL.md states: "major — Breaking API changes (e.g. changing callModel signature, removing exports)". This PR removes six subpath exports from packages/agent/package.json (see the ./tool-concurrency, ./tool-task, ./agent-tool, … entries) and removes MCPCacheWriteError, MCPStaleSnapshotError, MCPOAuthClientProvider, MCPProtocolNegotiation, and MCPProtocolRevision from the @openrouter/mcp surface, so a major bump (or restoration of those exports — see the other findings) is required.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


Add the full MCP integration under the canonical `@openrouter/agent/mcp` subpath. `@modelcontextprotocol/sdk` is an optional peer, so base agent installations and imports do not install or load MCP support. The existing `@openrouter/mcp` package remains as a compatibility facade and now re-exports the canonical agent subpaths.

```ts
import { callModel, OpenRouter } from '@openrouter/agent';
import { createMCPTools } from '@openrouter/agent/mcp';

const mcp = await createMCPTools({ url: 'https://mcp.example.com/mcp' });
const result = callModel(new OpenRouter(), {
model: 'openai/gpt-4o-mini',
input: 'Use the remote tools.',
tools: mcp.tools,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocker — changeset directs users to the wrong package.

This line tells users to install @modelcontextprotocol/sdk, but the actual peer dependency and import is @modelcontextprotocol/client (see packages/agent/package.json peerDependencies and mcp-sdk.ts). Same mismatch as errors.ts. Users who follow this install the wrong package.

Update both references in this changeset (line 7 and line 16) to @modelcontextprotocol/client.

▶ Prompt for agents: In .changeset/agent-mcp-subpath.md, replace @modelcontextprotocol/sdk with @modelcontextprotocol/client in the prose and the install instruction.

});
```

Install `@modelcontextprotocol/sdk` alongside `@openrouter/agent` when using `/mcp`. The SDK is loaded lazily, so importing the base agent or the MCP entry point does not require the peer; the first MCP connection attempt without it throws an actionable `MCPMissingPeerDependencyError`.

Existing `@openrouter/mcp` imports continue to work as tooling-visible deprecated migration facades, but new code should prefer `@openrouter/agent/mcp`. The facade would only be removed in a future breaking release after migration notice.
5 changes: 2 additions & 3 deletions .changeset/agent-tool-set.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
"@openrouter/agent-tool-set": minor
"@openrouter/agent": minor
---

Add `@openrouter/agent-tool-set` (port of ai-tool-set v1.0.0, MIT © Chris Cook): declarative activate / deactivate / activateWhen / deactivateWhen for tools with state- and context-aware predicates. Integrates with a new `activeTools?: readonly string[]` option on `callModel` that filters which tools are sent to the model for a given call.
Add `@openrouter/agent/tool-set` (port of ai-tool-set v1.0.0, MIT © Chris Cook): declarative activate / deactivate / activateWhen / deactivateWhen for tools with state- and context-aware predicates. Integrates with a new `activeTools?: readonly string[]` option on `callModel` that filters which tools are sent to the model for a given call.

```ts
import { callModel, OpenRouter, serverTool, tool } from '@openrouter/agent';
import { createToolSet } from '@openrouter/agent-tool-set';
import { createToolSet } from '@openrouter/agent/tool-set';
import { z } from 'zod/v4';

const listOrders = tool({
Expand Down
2 changes: 1 addition & 1 deletion .changeset/mcp-loop-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Doom-loop `loopKey` support for MCP-wrapped tools (pairs with `@openrouter/agent
Two ways to declare a wrapped tool's call identity: a client-side `loopKeys` map on `createMCPTools`/`rehydrateMCPTools` (keyed by unprefixed MCP tool name; any `ToolLoopKey` form — function, field-name array, or `false` to exempt), and a server-advertised `_meta['openrouter/loopKey']` on the tool definition (data-only: field-name array or `false`). Client config takes precedence. Server-advertised declarations ride the cache snapshot (`SerializedMCPToolDef.loopKey`), so rehydrated tool sets keep their identities without a `listTools()` round-trip; function forms are client-side only and cannot be cached.

```ts
import { createMCPTools } from '@openrouter/mcp';
import { createMCPTools } from '@openrouter/agent/mcp';

const mcp = await createMCPTools({
url: 'https://mcp.example.com/mcp',
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ jobs:
- name: Tests
run: pnpm run test

package-boundaries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2

- uses: pnpm/action-setup@v6

- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm

- run: pnpm install --frozen-lockfile

- name: Verify packed package boundaries
run: pnpm verify:packages

e2e-tests:
runs-on: ubuntu-latest
steps:
Expand Down
20 changes: 20 additions & 0 deletions .sentrux/rules.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,23 @@ reason = "api-shape-helpers is a leaf layer; it must not depend on anything abov
from = "packages/agent/src/lib/*"
to = "packages/agent/src/inner-loop/*"
reason = "lib is a utility layer; it must not depend on the inner-loop entry point."

[[boundaries]]
from = "packages/agent/src/inner-loop/*"
to = "packages/agent/src/mcp/*"
reason = "The core agent loop must not load the optional MCP integration."

[[boundaries]]
from = "packages/agent/src/lib/*"
to = "packages/agent/src/mcp/*"
reason = "Core agent utilities must not load the optional MCP integration."

[[boundaries]]
from = "packages/agent/src/api-shape-helpers/*"
to = "packages/agent/src/mcp/*"
reason = "Leaf API-shape definitions must remain independent of optional MCP support."

[[boundaries]]
from = "packages/agent/src/mcp/*"
to = "packages/agent/src/inner-loop/*"
reason = "MCP wraps public tool primitives and must not depend on the model loop."
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Monorepo for the OpenRouter TypeScript agent ecosystem.

| Package | Path | Description |
| --- | --- | --- |
| [`@openrouter/agent`](./packages/agent) | `packages/agent` | Agent toolkit for building AI applications with OpenRouter — tool orchestration, streaming, multi-turn conversations, and format compatibility. |
| [`@openrouter/agent`](./packages/agent) | `packages/agent` | Agent toolkit with optional `@openrouter/agent/tool-set` and `@openrouter/agent/mcp` subpaths. |
| [`@openrouter/mcp`](./packages/mcp) | `packages/mcp` | Compatibility facade for the canonical `@openrouter/agent/mcp` integration. |

## Development

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"lint": "turbo run lint",
"lint:fix": "biome check --write packages/*/src packages/*/tests",
"typecheck": "turbo run typecheck",
"verify:packages": "node scripts/verify-package-boundaries.mjs",
"changeset": "changeset",
"version": "changeset version && turbo run gen:version",
"prepare": "husky"
Expand Down
213 changes: 0 additions & 213 deletions packages/agent-tool-set/README.md

This file was deleted.

55 changes: 0 additions & 55 deletions packages/agent-tool-set/package.json

This file was deleted.

Loading
Loading