{"_id":"@aiconnect/mcpo-client","_rev":"7-58d999248b8d3b2e4634e38fe57c949f","name":"@aiconnect/mcpo-client","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@aiconnect/mcpo-client","version":"0.1.0","keywords":["mcpo","mcp","openapi","cli","client","typescript","tools","proxy"],"author":{"name":"AI Connect"},"license":"MIT","_id":"@aiconnect/mcpo-client@0.1.0","maintainers":[{"name":"ericsantos","email":"ericsantos.net@gmail.com"}],"homepage":"https://github.com/aiconnect-cloud/mcpo-client#readme","bugs":{"url":"https://github.com/aiconnect-cloud/mcpo-client/issues"},"bin":{"mcpo-client":"dist/cli.js"},"dist":{"shasum":"325e1156edf8dcd3b829fb79ad4a3eef076cfdac","tarball":"https://registry.npmjs.org/@aiconnect/mcpo-client/-/mcpo-client-0.1.0.tgz","fileCount":30,"integrity":"sha512-xaWEPGrYEYa5vRIAJ8YP7tIeEnMs1Y2eQb6bhDh7a6FKiB+9kMX01t1wSZ0B/ocxRQakjFqFbXUJSTXkelF6UA==","signatures":[{"sig":"MEUCIFqVAK9lov/lsSNrQ4wFBAzt4Bpwtee2VxZ7uUuHXyYyAiEA6qHn6BgkKW5oJfWmDf2aoVwanB02r2X5dY5QUHOzWEY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76979},"main":"dist/index.js","type":"commonjs","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"c47eb70f4e47fe7655f4c99087c53ddf028322c4","scripts":{"dev":"ts-node src/cli.ts","build":"tsc -p .","clean":"rimraf dist","start":"node dist/cli.js --help","docs:api":"typedoc --options typedoc.json","publish:dry":"npm publish --dry-run","publish:beta":"npm publish --tag beta","examples:time":"npm run build && node examples/time-assistant.js","version:major":"npm version major","version:minor":"npm version minor","version:patch":"npm version patch","prepublishOnly":"npm run clean && npm run build","examples:openai-time":"ts-node examples/openai-time-agent.ts"},"_npmUser":{"name":"ericsantos","email":"ericsantos.net@gmail.com"},"repository":{"url":"git+https://github.com/aiconnect-cloud/mcpo-client.git","type":"git"},"_npmVersion":"11.5.1","description":"TypeScript/Node client for interacting with MCPO servers and CLI tool","directories":{},"_nodeVersion":"24.7.0","dependencies":{"kleur":"^4.1.5","commander":"^12.1.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.5","ts-node":"^10.9.2","typedoc":"^0.25.10","typescript":"^5.4.0","@types/node":"^20.11.30"},"_npmOperationalInternal":{"tmp":"tmp/mcpo-client_0.1.0_1756658969904_0.4531662191203327","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@aiconnect/mcpo-client","version":"0.2.0","keywords":["mcpo","mcp","openapi","cli","client","typescript","tools","proxy"],"author":{"name":"AI Connect"},"license":"MIT","_id":"@aiconnect/mcpo-client@0.2.0","maintainers":[{"name":"ericsantos","email":"ericsantos.net@gmail.com"}],"homepage":"https://github.com/aiconnect-cloud/mcpo-client#readme","bugs":{"url":"https://github.com/aiconnect-cloud/mcpo-client/issues"},"bin":{"mcpo-client":"dist/cli.js"},"dist":{"shasum":"e012e15b9590057566c21ca6bef2d0ff907d8cb7","tarball":"https://registry.npmjs.org/@aiconnect/mcpo-client/-/mcpo-client-0.2.0.tgz","fileCount":30,"integrity":"sha512-iu4uBg983DpgXDCKw8TW37rFRIuQAhrOHPvq9eqPAbH8/kIiGpr63I08A101XhZr1uQhnGy51cz509kAs9XIyA==","signatures":[{"sig":"MEUCIC3bUlEd9iSozEoXznsOePnRd4MQlx5WcAhY/dr9zz+IAiEAh4bkXx1mTFenUkxDAgiOELYIkqdh1X914UcoVnIbNCg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78380},"main":"dist/index.js","type":"commonjs","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"f6790e4ee6b70c6748678ae646c63b4c08d85078","scripts":{"dev":"ts-node src/cli.ts","build":"tsc -p .","clean":"rimraf dist","start":"node dist/cli.js --help","docs:api":"typedoc --options typedoc.json","publish:dry":"npm publish --dry-run","publish:beta":"npm publish --tag beta","examples:time":"npm run build && node examples/time-assistant.js","version:major":"npm version major","version:minor":"npm version minor","version:patch":"npm version patch","prepublishOnly":"npm run clean && npm run build","examples:openai-time":"ts-node examples/openai-time-agent.ts"},"_npmUser":{"name":"ericsantos","email":"ericsantos.net@gmail.com"},"repository":{"url":"git+https://github.com/aiconnect-cloud/mcpo-client.git","type":"git"},"_npmVersion":"11.9.0","description":"TypeScript/Node client for interacting with MCPO servers and CLI tool","directories":{},"_nodeVersion":"25.6.1","dependencies":{"kleur":"^4.1.5","commander":"^12.1.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.5","ts-node":"^10.9.2","typedoc":"^0.25.10","typescript":"^5.4.0","@types/node":"^20.11.30"},"_npmOperationalInternal":{"tmp":"tmp/mcpo-client_0.2.0_1783717852904_0.07623336096517885","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@aiconnect/mcpo-client","version":"0.3.0","keywords":["mcpo","mcp","openapi","cli","client","typescript","tools","proxy"],"author":{"name":"AI Connect"},"license":"MIT","_id":"@aiconnect/mcpo-client@0.3.0","maintainers":[{"name":"ericsantos","email":"ericsantos.net@gmail.com"}],"homepage":"https://github.com/aiconnect-cloud/mcpo-client#readme","bugs":{"url":"https://github.com/aiconnect-cloud/mcpo-client/issues"},"bin":{"mcpo-client":"dist/cli.js"},"dist":{"shasum":"7489b5f5cdbff9dc74ab1ed55f1d14ed3ec2a39b","tarball":"https://registry.npmjs.org/@aiconnect/mcpo-client/-/mcpo-client-0.3.0.tgz","fileCount":30,"integrity":"sha512-qk4xmHALaBT3/CebnTSlMzDaOIywU+tt6GjK4scOQ6QfnmF0EKhal9buqj6MUNBnCfuJmScSRuukcFOJepB0qg==","signatures":[{"sig":"MEUCIQDGikzuNTwaPnt9v0y3Jq3852v/1REDLZx+rgea2sYLuQIgRvntM73URmLoWHPp2ZlwZjPkWEC6i9Zg7c43v08hvEM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":83552},"main":"dist/index.js","type":"commonjs","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"39f855428692b5f20869c2440cc2d62228ef5e44","scripts":{"dev":"ts-node src/cli.ts","build":"tsc -p .","clean":"rimraf dist","start":"node dist/cli.js --help","docs:api":"typedoc --options typedoc.json","publish:dry":"npm publish --dry-run","publish:beta":"npm publish --tag beta","examples:time":"npm run build && node examples/time-assistant.js","version:major":"npm version major","version:minor":"npm version minor","version:patch":"npm version patch","prepublishOnly":"npm run clean && npm run build","examples:openai-time":"ts-node examples/openai-time-agent.ts"},"_npmUser":{"name":"ericsantos","email":"ericsantos.net@gmail.com"},"repository":{"url":"git+https://github.com/aiconnect-cloud/mcpo-client.git","type":"git"},"_npmVersion":"11.9.0","description":"TypeScript/Node client for interacting with MCPO servers and CLI tool","directories":{},"_nodeVersion":"25.6.1","dependencies":{"kleur":"^4.1.5","commander":"^12.1.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.5","ts-node":"^10.9.2","typedoc":"^0.25.10","typescript":"^5.4.0","@types/node":"^20.11.30"},"_npmOperationalInternal":{"tmp":"tmp/mcpo-client_0.3.0_1783731242832_0.5024567514598026","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@aiconnect/mcpo-client","version":"0.4.0","keywords":["mcpo","mcp","openapi","cli","client","typescript","tools","proxy"],"author":{"name":"AI Connect"},"license":"MIT","_id":"@aiconnect/mcpo-client@0.4.0","maintainers":[{"name":"ericsantos","email":"ericsantos.net@gmail.com"}],"homepage":"https://github.com/aiconnect-cloud/mcpo-client#readme","bugs":{"url":"https://github.com/aiconnect-cloud/mcpo-client/issues"},"bin":{"mcpo-client":"dist/cli.js"},"dist":{"shasum":"977f16675c90f385cda855536fdfa56d90d7a9d6","tarball":"https://registry.npmjs.org/@aiconnect/mcpo-client/-/mcpo-client-0.4.0.tgz","fileCount":33,"integrity":"sha512-+7vAiSFAJqGQJpOOIEISsLhHid9J1krLOtbflFEq9GPIzsMHBmMNk6xY/0ti4oW0/Hzc5B7E4bvi64LKTA+CMQ==","signatures":[{"sig":"MEYCIQCS5i6/ceqp3MAO0QYrLSVHRi1Z2CAg2NXySAVBhO8zEAIhAO7s2fxnrMSL03l6GLEPIUvJbDMmnOkAsuJHS37zuVij","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":93665},"main":"dist/index.js","type":"commonjs","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"5e22778e62148ac09b3d497ae9e0b008b193903d","scripts":{"dev":"ts-node src/cli.ts","build":"tsc -p .","clean":"rimraf dist","start":"node dist/cli.js --help","docs:api":"typedoc --options typedoc.json","publish:dry":"npm publish --dry-run","publish:beta":"npm publish --tag beta","examples:time":"npm run build && node examples/time-assistant.js","version:major":"npm version major","version:minor":"npm version minor","version:patch":"npm version patch","prepublishOnly":"npm run clean && npm run build","examples:openai-time":"ts-node examples/openai-time-agent.ts"},"_npmUser":{"name":"ericsantos","email":"ericsantos.net@gmail.com"},"repository":{"url":"git+https://github.com/aiconnect-cloud/mcpo-client.git","type":"git"},"_npmVersion":"11.9.0","description":"TypeScript/Node client for interacting with MCPO servers and CLI tool","directories":{},"_nodeVersion":"25.6.1","dependencies":{"kleur":"^4.1.5","commander":"^12.1.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.5","ts-node":"^10.9.2","typedoc":"^0.25.10","typescript":"^5.4.0","@types/node":"^20.11.30"},"_npmOperationalInternal":{"tmp":"tmp/mcpo-client_0.4.0_1783734753384_0.9884794302384792","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@aiconnect/mcpo-client","version":"0.5.0","description":"TypeScript/Node client for interacting with MCPO servers and CLI tool","type":"commonjs","main":"dist/index.js","types":"dist/index.d.ts","bin":{"mcpo-client":"dist/cli.js"},"keywords":["mcpo","mcp","openapi","cli","client","typescript","tools","proxy"],"author":{"name":"AI Connect"},"license":"MIT","homepage":"https://github.com/aiconnect-cloud/mcpo-client#readme","bugs":{"url":"https://github.com/aiconnect-cloud/mcpo-client/issues"},"repository":{"type":"git","url":"git+https://github.com/aiconnect-cloud/mcpo-client.git"},"scripts":{"build":"tsc -p .","dev":"ts-node src/cli.ts","clean":"rimraf dist","start":"node dist/cli.js --help","examples:time":"npm run build && node examples/time-assistant.js","examples:openai-time":"ts-node examples/openai-time-agent.ts","docs:api":"typedoc --options typedoc.json","prepublishOnly":"npm run clean && npm run build","publish:dry":"npm publish --dry-run","publish:beta":"npm publish --tag beta","version:patch":"npm version patch","version:minor":"npm version minor","version:major":"npm version major"},"dependencies":{"commander":"^12.1.0","kleur":"^4.1.5"},"devDependencies":{"@types/node":"^20.11.30","typedoc":"^0.25.10","ts-node":"^10.9.2","typescript":"^5.4.0","rimraf":"^5.0.5"},"engines":{"node":">=18.0.0"},"gitHead":"f341f88088a4c52af721d7dd660d32442404e213","_id":"@aiconnect/mcpo-client@0.5.0","_nodeVersion":"25.6.1","_npmVersion":"11.9.0","dist":{"integrity":"sha512-BOH8yxSoY7+AHvd97XBxoKNiROViQn3RAGOs5fwrhsvM+wuvIlopPT9BTqjiy6kDb0l0hafOTFZ01g+GEHOKqA==","shasum":"1b996cfc932be608cbb4af1e89e32ea5c46a002d","tarball":"https://registry.npmjs.org/@aiconnect/mcpo-client/-/mcpo-client-0.5.0.tgz","fileCount":33,"unpackedSize":98412,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDp1TeJv6AZTJBgBri5j7A+lzB77W6/1DTfqDDdJA3kNAiAXYwhuSMP5P2lLVQ1CvGzh+OoYIfrek24FR0PvnGBmhw=="}]},"_npmUser":{"name":"ericsantos","email":"ericsantos.net@gmail.com"},"directories":{},"maintainers":[{"name":"ericsantos","email":"ericsantos.net@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcpo-client_0.5.0_1783887027561_0.4135270519788288"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-31T16:49:29.838Z","modified":"2026-07-12T20:10:27.812Z","0.1.0":"2025-08-31T16:49:30.085Z","0.1.1":"2025-08-31T16:52:08.191Z","0.2.0":"2026-07-10T21:10:53.041Z","0.3.0":"2026-07-11T00:54:02.992Z","0.4.0":"2026-07-11T01:52:33.546Z","0.5.0":"2026-07-12T20:10:27.696Z"},"bugs":{"url":"https://github.com/aiconnect-cloud/mcpo-client/issues"},"author":{"name":"AI Connect"},"license":"MIT","homepage":"https://github.com/aiconnect-cloud/mcpo-client#readme","keywords":["mcpo","mcp","openapi","cli","client","typescript","tools","proxy"],"repository":{"type":"git","url":"git+https://github.com/aiconnect-cloud/mcpo-client.git"},"description":"TypeScript/Node client for interacting with MCPO servers and CLI tool","maintainers":[{"name":"ericsantos","email":"ericsantos.net@gmail.com"}],"readme":"# @aiconnect/mcpo-client\n\nTypeScript/Node client for interacting with MCPO servers (MCP OpenAPI Proxy) and a small helper CLI.\n\n- Repository: aiconnect-cloud/mcpo-client\n- NPM: @aiconnect/mcpo-client\n- MCPO: https://github.com/open-webui/mcpo\n\n## Installation\n\nLibrary (for Node projects):\n\n```bash\nnpm i @aiconnect/mcpo-client\n```\n\nCLI (global):\n\n```bash\nnpm i -g @aiconnect/mcpo-client\nmcpo-client --help\n```\n\nOr via npx:\n\n```bash\nnpx @aiconnect/mcpo-client --help\n```\n\n## Library Overview\n\nMain surface:\n\n- createClient(opts): creates an HTTP-only client for MCPO\n  - client.describe(tool, { mount }): returns a ToolSpec (OpenAPI → parameters/body/response)\n  - client.call(tool, args, { mount, skipSpec? }): executes the tool via HTTP\n  - client.buildOpenAITool(tool, { mount }): generates an OpenAI-compatible tool (function) definition\n- discover(baseUrl, opts): mount-wide discovery — lists every tool exposed by the server (single or multi-mount), returning ServerTools\n- discoverMountTools(baseUrl, mount, opts): single-download mount expansion — exactly one request to /\\<mount\\>/openapi.json, returning full OpenAI-compatible tool definitions for every uniquely-named tool the mount exposes (duplicate final path segments: first occurrence wins — later collisions are unreachable by name-based calling and are skipped, never mis-emitted)\n- buildOpenAIToolFromDocument(oas, tool, ctx) / buildOpenAIToolsFromDocument(oas, ctx): pure transforms over an already-fetched OpenAPI document (no network) — same conversion client.buildOpenAITool applies after fetching\n- HttpError: error thrown for non-2xx responses or timeouts (includes status and body when available)\n- ResponseTooLargeError: error thrown when a response body exceeds maxResponseBytes — the transfer is aborted before parsing (includes bytesRead, limit, and contentLength when available)\n- InvalidJsonError: error thrown by call() when requireJson is set and a 2xx tool body is not valid JSON (includes the 2xx status and rawBody); subclass of HttpError — check it before the generic HttpError since it carries a 2xx status\n\nBoth createClient and discover accept maxResponseBytes to cap response body size in bytes; unset means unlimited. A Content-Length above the limit rejects the response without reading the body; otherwise the body is streamed and aborted as soon as the limit is crossed, before any JSON parsing.\n\ncreateClient and call accept requireJson (default false). When true, call() throws InvalidJsonError on a 2xx tool response whose non-empty body is not valid JSON — letting callers distinguish a legitimate JSON-string result (e.g. `\"ok\"`) from a non-JSON body (e.g. an HTML error page served with 200). It applies to tool calls only; OpenAPI discovery/describe stay lenient. A per-call requireJson overrides the client-level default.\n\nRequirements:\n\n- Node 18+\n- MCPO started with --api-key (if protected)\n\n### Quick Example (Call)\n\n```ts\nimport { createClient } from '@aiconnect/mcpo-client';\n\nconst client = createClient({\n  baseUrl: 'https://mcpo.example.com',\n  apiKey: process.env.MCPO_API_KEY,\n});\n\n// Call time/get_current_time\nconst data = await client.call(\n  'get_current_time',\n  { timezone: 'Europe/Lisbon' },\n  { mount: 'time', skipSpec: true }\n);\nconsole.log(data);\n```\n\n### Example (Describe → OpenAI Tool)\n\n```ts\nimport { createClient } from '@aiconnect/mcpo-client';\n\nconst client = createClient({ baseUrl: 'https://mcpo.example.com', apiKey: process.env.MCPO_API_KEY });\nconst toolDef = await client.buildOpenAITool('get_current_time', { mount: 'time' });\n// toolDef -> { type: 'function', function: { name, description, parameters } }\n```\n\n### Errors and Timeouts\n\n- Throws HttpError for non-2xx responses or timeouts (includes status and body when available)\n- Throws ResponseTooLargeError (subclass of HttpError) when maxResponseBytes is set and the response body exceeds it — aborted before parsing, with bytesRead/limit/contentLength for diagnostics\n- Throws InvalidJsonError (subclass of HttpError) when requireJson is set and a 2xx tool body is not valid JSON — carries the 2xx status and rawBody\n- skipSpec: true avoids downloading the OpenAPI spec and calls POST /\\<mount\\>/\\<tool\\> directly\n\n## Examples\n\n- OpenAI agent via HTTP-only: examples/openai-time-agent.ts\n- Examples environment: examples/.env.example\n\nRun:\n\n```bash\ncp examples/.env.example examples/.env\nsource examples/.env\nnpm run examples:openai-time\n```\n\n## CLI (optional)\n\nThe package also ships a handy CLI for discovery and execution.\n\nList tools:\n\n```bash\nmcpo-client tools list --url https://mcpo.example.com --api-key <KEY> --format table\n```\n\nDescribe a tool (parameters/response):\n\n```bash\nmcpo-client tools describe time/get_current_time --url https://mcpo.example.com --api-key <KEY> --format table\n```\n\nCall a tool:\n\n```bash\n# Direct JSON\nmcpo-client tools call time/get_current_time --url https://mcpo.example.com --api-key <KEY> -d '{\"timezone\":\"Europe/Lisbon\"}'\n\n# Interactive (prompts required fields)\nmcpo-client tools call time/get_current_time --url https://mcpo.example.com --api-key <KEY>\n\n# Without OpenAPI (for slow environments)\nmcpo-client tools call time/get_current_time --url https://mcpo.example.com --api-key <KEY> --no-spec -d '{\"timezone\":\"Europe/Lisbon\"}'\n```\n\nCommon options:\n\n- --url: MCPO base URL (accepts prefix)\n- --api-key or --basic user:pass\n- --timeout, --insecure, --verbose\n- --format: table|json|plain (for list/describe)\n\n## Notes\n\n- Works with MCPO in stdio, sse and streamable-http modes (client is always HTTP/OpenAPI based)\n- API documentation (TypeDoc): docs/api\n","readmeFilename":"README.md"}