{"id":26127729,"url":"https://github.com/dylibso/mcpx-anthropic-node","last_synced_at":"2025-04-13T17:22:55.041Z","repository":{"id":273951814,"uuid":"920857560","full_name":"dylibso/mcpx-anthropic-node","owner":"dylibso","description":" Anthropic node support for MCPX ","archived":false,"fork":false,"pushed_at":"2025-04-08T17:09:51.000Z","size":93,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-08T18:25:10.255Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dylibso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-22T22:20:46.000Z","updated_at":"2025-03-07T18:13:48.000Z","dependencies_parsed_at":"2025-03-01T01:19:42.473Z","dependency_job_id":"bdbedf38-c19f-4b67-8941-fad0732b537e","html_url":"https://github.com/dylibso/mcpx-anthropic-node","commit_stats":null,"previous_names":["dylibso/mcpx-anthropic-node"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fmcpx-anthropic-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fmcpx-anthropic-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fmcpx-anthropic-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fmcpx-anthropic-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dylibso","download_url":"https://codeload.github.com/dylibso/mcpx-anthropic-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750872,"owners_count":21155797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-03-10T18:36:16.886Z","updated_at":"2025-04-13T17:22:55.020Z","avatar_url":"https://github.com/dylibso.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCPX Anthropic Client\n\nThis library allows you connect your [Anthropic](https://www.anthropic.com/) models to\n[mcp.run](https://mcp.run) and expose your installed servlets as tools which can be \ninvoked in process (without spinning up many server processes).\n\n## Usage\n\n### Install\n\nYou just need the mcpx-anthropic library and the anthropic library (if you don't already have it).\n\n```\nnpm install @dylibso/mcpx-anthropic @anthropic-ai/sdk\n```\n\nTo get an mcp.run session id, run this command and follow the instructions:\n\n```\nnpx --yes -p @dylibso/mcpx@latest gen-session\n```\n\n### Code\n\nThis package exports a message driver designed to wrap the Anthropic `createMessage` API:\n\n```typescript\nimport Anthropic from \"@anthropic-ai/sdk\";\nimport createDriver from \"@dylibso/mcpx-anthropic\"\n\nconst anthropic = new Anthropic({\n  apiKey: process.env.ANTHROPIC_API_KEY\n})\n\nconst mcpx = await createDriver({\n  anthropic,\n  sessionId: process.env.MCP_RUN_SESSION_ID,\n})\n\nconst messages = [];\n\n// call any tool compatible api, e.g chat completion:\n// let's ask it to evalute some javascript. If you have\n// this tool installed: https://www.mcp.run/bhelx/eval-js it should\n// determine and use this to evaluate it in a sandbox\nmessages.push({\n  role: 'user',\n  content: `\n    Write a djb2hash function in javascript and evalute it on the string \"Hello, World!\"\n  `\n});\n\n// this will automatically process all tool calls\n// until there are none left\nconst response = await mcpx.createMessage({\n  max_tokens: 1024,\n  messages,\n  model: 'claude-3-5-sonnet-latest',\n});\n\nconsole.log(response.content)\n//=\u003e The DJB2 hash of the string \"Hello, World!\" is `-1763540338`.\n```\n\n### Examples\n\n* [Example chat application](examples/chat)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylibso%2Fmcpx-anthropic-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylibso%2Fmcpx-anthropic-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylibso%2Fmcpx-anthropic-node/lists"}