What is the qs package?
mainqs package is a vendored version of neoqs, which is a TypeScript rewrite of the qs query string library. It is used within the Mux Node SDK to handle query string parsing and serialization.repository·main·Indexed 41 days ago
https://github.com/muxinc/mux-node-sdkThe official TypeScript library (@mux/ts v15.2.0) for interacting with the Mux REST API from server-side TypeScript or JavaScript environments. Includes a Model Context Protocol (MCP) server for AI agents, JWT helpers for signing playback IDs, and utilities for parsing and verifying webhook payloads.
qs package is a vendored version of neoqs, which is a TypeScript rewrite of the qs query string library. It is used within the Mux Node SDK to handle query string parsing and serialization.The Mux MCP server supports two execution modes for the code tool:
DENO_PATH environment variable to a Deno 2.9 or newer executable.--code-execution-mode=remote or the MCP_SERVER_CODE_EXECUTION_MODE environment variable.When using Remote Mode, you must provide:
CODE_SANDBOX_URL (or --code-sandbox-url): The URL of the sandbox service.CODE_SANDBOX_API_KEY (or --code-sandbox-api-key): The API key for the service, sent as a Bearer token.Path parameters are now automatically encoded by default. If you were manually calling encodeURIComponent() on parameters before passing them to the SDK, you must stop doing so to avoid double-encoding.
- client.example.retrieve(encodeURIComponent('string/with/slash'))
+ client.example.retrieve('string/with/slash') // retrieves /example/string%2Fwith%2FslashThe Mux MCP server uses a "Code Mode" tool scheme designed for agents to interact with the Mux TypeScript SDK. The server exposes two primary tools:
This allows agents to perform complex, deterministic tasks by writing and running SDK code in a controlled environment.
Mux API list methods are paginated. You can use the for await ... of syntax to automatically fetch all pages of results.
Alternatively, you can manually paginate using page.hasNextPage() and page.getNextPage().
// Option 1: Auto-pagination with for await ... of
async function fetchAllDeliveryReports(params) {
const allDeliveryReports = [];
for await (const deliveryReport of client.video.deliveryUsage.list()) {
allDeliveryReports.push(deliveryReport);
}
return allDeliveryReports;
}
// Option 2: Manual pagination
let page = await client.video.deliveryUsage.list();
for (const deliveryReport of page.data) {
console.log(deliveryReport);
}
while (page.hasNextPage()) {
page = await page.getNextPage();
}If you need to access undocumented endpoints or parameters, the library provides low-level HTTP verb methods (client.get, client.post, etc.).
client.post('/path', { body: ... }).// @ts-expect-error to bypass type checking. Extra parameters in GET requests are sent as query params; in other requests, they are sent in the body.// @ts-expect-error or type casting to access extra fields returned by the API.// Undocumented endpoint
await client.post('/some/path', {
body: { some_prop: 'foo' },
query: { some_query_arg: 'bar' },
});
// Undocumented parameter
client.video.assets.create({
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
});To run the server on your local machine for development:
npm installnpm run devThe server should be accessible at http://localhost:8787/.
npm install
npm run devclient.robotsPreview accessor to client.robots and update any associated imported types. Job endpoints are now located under client.robots.jobs.*.To integrate the Mux MCP server into Cursor, add the configuration to your local MCP settings file.
~/.cursor/mcp.json.mux server configuration using mcp-remote.{
"mcpServers": {
"mux": {
"command": "npx",
"args": ["-y", "mcp-remote@latest", "{{cloudflareWorkerUrl}}"]
}
}
}To integrate the Mux MCP server into Windsurf, add the configuration to your local MCP settings file.
~/.codeium/windsurf/mcp_config.json.mux server configuration using mcp-remote.{
"mcpServers": {
"mux": {
"command": "npx",
"args": ["-y", "mcp-remote@latest", "{{cloudflareWorkerUrl}}"]
}
}
}Use the MCP Inspector to explore your API and test tools. This server implements a local version of OAuth redirects that accepts an API token and client configuration.
npx @modelcontextprotocol/inspector.http://localhost:5173), set the Transport Type to SSE.http://localhost:8787/sse (or your Cloudflare workers.dev/sse URL for remote servers).npx @modelcontextprotocol/inspectorTo use your local MCP server with Claude Desktop, you must configure Claude to use a local proxy (mcp-remote) that communicates with your server over HTTP/SSE.
{
"mcpServers": {
"mux": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:8787/sse"]
}
}
}