{"id":35396900,"url":"https://github.com/andreibesleaga/ocm-sdk","last_synced_at":"2026-04-07T08:05:47.846Z","repository":{"id":304150524,"uuid":"1017902357","full_name":"andreibesleaga/ocm-sdk","owner":"andreibesleaga","description":"OCM SDK \u0026 AI MCP Server Implementation for EV Charging Open Charge Map API","archived":false,"fork":false,"pushed_at":"2026-04-01T03:58:57.000Z","size":969,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-01T05:51:36.369Z","etag":null,"topics":["ai","api","ev","ev-charging","map","mcp","ocm","open","protocol","sdk"],"latest_commit_sha":null,"homepage":"https://github.com/andreibesleaga/ocm-demo","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreibesleaga.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-11T09:24:55.000Z","updated_at":"2026-03-28T05:44:25.000Z","dependencies_parsed_at":"2025-07-11T13:06:13.700Z","dependency_job_id":"94ec12b8-abcf-4494-8c07-935d191c8a8c","html_url":"https://github.com/andreibesleaga/ocm-sdk","commit_stats":null,"previous_names":["andreibesleaga/ocm-sdk"],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/andreibesleaga/ocm-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreibesleaga%2Focm-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreibesleaga%2Focm-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreibesleaga%2Focm-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreibesleaga%2Focm-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreibesleaga","download_url":"https://codeload.github.com/andreibesleaga/ocm-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreibesleaga%2Focm-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31504899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api","ev","ev-charging","map","mcp","ocm","open","protocol","sdk"],"created_at":"2026-01-02T10:13:24.468Z","updated_at":"2026-04-07T08:05:47.824Z","avatar_url":"https://github.com/andreibesleaga.png","language":"TypeScript","funding_links":[],"categories":["Tools and Resources"],"sub_categories":["OCM - Open Charge Map"],"readme":"# OCM TypeScript API Library\n\n[![NPM version](\u003chttps://img.shields.io/npm/v/ocm-sdk.svg?label=npm%20(stable)\u003e)](https://npmjs.org/package/ocm-sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/ocm-sdk)\n\nThis library provides convenient access to the OCM REST API from server-side TypeScript or JavaScript.\n\n(OCM SDK \u0026 AI MCP Server Implementation for EV Charging - Open Charge Map API)\n\nThe library contains a packages/mcp-server for OCM MCP AI communication server.\n\nThe REST API documentation can be found on [openchargemap.org](https://openchargemap.org/site/about). The full API of this library can be found in [api.md](api.md).\n\nDemo project: https://github.com/andreibesleaga/ocm-demo\nLive Demo URL: https://ocm-demo.up.railway.app/\n\n## MCP Server\n\nUse the Ocm MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=ocm-sdk-mcp\u0026config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIm9jbS1zZGstbWNwIl0sImVudiI6eyJPQ01fQVBJX0tFWSI6Ik15IEFQSSBLZXkgSGVhZGVyIiwiT0NNX1VTRVJOQU1FIjoiTXkgQmVhcmVyIn19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge\u0026logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22ocm-sdk-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22ocm-sdk-mcp%22%5D%2C%22env%22%3A%7B%22OCM_API_KEY%22%3A%22My%20API%20Key%20Header%22%2C%22OCM_USERNAME%22%3A%22My%20Bearer%22%7D%7D)\n\n\u003e Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install ocm-sdk\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n\u003c!-- prettier-ignore --\u003e\n```js\nimport Ocm from 'ocm-sdk';\n\nconst client = new Ocm({\n  apiKey: process.env['OCM_API_KEY'], // This is the default and can be omitted\n});\n\nconst pois = await client.poi.list();\n```\n\n### Request \u0026 Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nimport Ocm from 'ocm-sdk';\n\nconst client = new Ocm({\n  apiKey: process.env['OCM_API_KEY'], // This is the default and can be omitted\n});\n\nconst pois: Ocm.PoiListResponse = await client.poi.list();\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nconst pois = await client.poi.list().catch(async (err) =\u003e {\n  if (err instanceof Ocm.APIError) {\n    console.log(err.status); // 400\n    console.log(err.name); // BadRequestError\n    console.log(err.headers); // {server: 'nginx', ...}\n  } else {\n    throw err;\n  }\n});\n```\n\nError codes are as follows:\n\n| Status Code | Error Type                 |\n| ----------- | -------------------------- |\n| 400         | `BadRequestError`          |\n| 401         | `AuthenticationError`      |\n| 403         | `PermissionDeniedError`    |\n| 404         | `NotFoundError`            |\n| 422         | `UnprocessableEntityError` |\n| 429         | `RateLimitError`           |\n| \u003e=500       | `InternalServerError`      |\n| N/A         | `APIConnectionError`       |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and \u003e=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n\u003c!-- prettier-ignore --\u003e\n```js\n// Configure the default for all requests:\nconst client = new Ocm({\n  maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.poi.list({\n  maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n\u003c!-- prettier-ignore --\u003e\n```ts\n// Configure the default for all requests:\nconst client = new Ocm({\n  timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.poi.list({\n  timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nconst client = new Ocm();\n\nconst response = await client.poi.list().asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: pois, response: raw } = await client.poi.list().withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(pois);\n```\n\n### Logging\n\n\u003e [!IMPORTANT]\n\u003e All log messages are intended for debugging only. The format and content of log messages\n\u003e may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `OCM_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport Ocm from 'ocm-sdk';\n\nconst client = new Ocm({\n  logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport Ocm from 'ocm-sdk';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new Ocm({\n  logger: logger.child({ name: 'Ocm' }),\n  logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n  body: { some_prop: 'foo' },\n  query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.poi.list({\n  // ...\n  // @ts-expect-error baz is not yet public\n  baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport Ocm from 'ocm-sdk';\nimport fetch from 'my-fetch';\n\nconst client = new Ocm({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport Ocm from 'ocm-sdk';\n\nconst client = new Ocm({\n  fetchOptions: {\n    // `RequestInit` options\n  },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n\u003cimg src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg\" align=\"top\" width=\"18\" height=\"21\"\u003e **Node** \u003csup\u003e[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]\u003c/sup\u003e\n\n```ts\nimport Ocm from 'ocm-sdk';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new Ocm({\n  fetchOptions: {\n    dispatcher: proxyAgent,\n  },\n});\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg\" align=\"top\" width=\"18\" height=\"21\"\u003e **Bun** \u003csup\u003e[[docs](https://bun.sh/guides/http/proxy)]\u003c/sup\u003e\n\n```ts\nimport Ocm from 'ocm-sdk';\n\nconst client = new Ocm({\n  fetchOptions: {\n    proxy: 'http://localhost:8888',\n  },\n});\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg\" align=\"top\" width=\"18\" height=\"21\"\u003e **Deno** \u003csup\u003e[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]\u003c/sup\u003e\n\n```ts\nimport Ocm from 'npm:ocm-sdk';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new Ocm({\n  fetchOptions: {\n    client: httpClient,\n  },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/andreibesleaga/ocm-sdk/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript \u003e= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreibesleaga%2Focm-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreibesleaga%2Focm-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreibesleaga%2Focm-sdk/lists"}