Make MCP work your way.
Build an MCP gateway. Shape tools and results. See what happens on every call. A TypeScript proxy library you run and extend.
npm install mcpose @modelcontextprotocol/sdkA small function in the middle can change the whole interaction.
What will you build?
Start with a developer problem. Solve it in the space between client and server.
Build a gateway
Connect local and remote MCP servers through one endpoint, with distinct tool names and shared middleware.
Adapt your tools
Filter the tool catalog, transform results, and add local tools without forking upstream servers.
Debug calls
Inspect call timing, outcomes, and backend failures. Send events to your existing telemetry stack.
Your gateway. Your middleware.
Many servers. One MCP endpoint. Behavior you control in TypeScript.
Combine docs, CRM, and file tools behind one proxy. Add shared behavior once. Deploy the library in your own application.
Make existing tools fit your app.
Transform results, filter discovery, or add audit. The same composable middleware.
Transform a response
search({ query: "deployment" })Before middleware
After middleware
The response carries the extra context your middleware added.
import { hasToolContent } from 'mcpose';
import type { ToolMiddleware } from 'mcpose';
const withSource: ToolMiddleware = async (req, next) => {
const result = await next(req);
if (!hasToolContent(result)) return result;
return {
...result,
content: [...result.content, {
type: 'text',
text: 'Source: internal docs',
}],
};
};
// In ProxyOptions:
toolMiddleware: [withSource]Add capabilities as you need them.
Telemetry and persistence for operations. Optional policy, consent, redaction, and audit for sensitive workflows.
| Package | Description |
|---|---|
| mcpose | Proxy, transport, middleware. |
| @mcpose/otel | Connect telemetry to OpenTelemetry. |
| @mcpose/store-redis | Persistent SSE events. |
| @mcpose/store-postgres | Persistent SSE events. |
| @mcpose/policy | Role rules and per-session call budgets. |
| @mcpose/consent | Consent resolved by the application. |
| @mcpose/audit | Chained events and signed session manifests. |
| @mcpose/testing | Audit consistency assertions. |
Proxy, transport, middleware.
Connect telemetry to OpenTelemetry.
Persistent SSE events.
Persistent SSE events.
Role rules and per-session call budgets.
Consent resolved by the application.
Chained events and signed session manifests.
Audit consistency assertions.
The next layer is yours.
Your first gateway, tool adapter, or debugging layer starts with one proxy.