Skip to content

Commit bcf8c4a

Browse files
committed
Add documentation on using beta features to the TypeScript SDK README.
1 parent f2d4103 commit bcf8c4a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,41 @@ const client = new Anthropic({
610610
});
611611
```
612612

613+
### Beta Features
614+
615+
Beta API features are generally available inside the beta property of the client. To enable a particular beta feature, you need to add the appropriate beta header to the betas field when creating a message.
616+
617+
For example, to add an MCP server:
618+
```ts
619+
import Anthropic from 'npm:@anthropic-ai/sdk';
620+
621+
const client = new Anthropic();
622+
const response = await this.client.beta.messages.create({
623+
max_tokens: 1024,
624+
model: "claude-sonnet-4-20250514",
625+
messages: [
626+
{
627+
role: "user",
628+
content: [
629+
{
630+
type: "text",
631+
text: "Explain the latest PR in the anthropics/anthropic-sdk-typescript repo.",
632+
}
633+
]
634+
}
635+
],
636+
mcp_servers: [
637+
{
638+
name: "github",
639+
type: "url",
640+
url: "https://api.githubcopilot.com/mcp/",
641+
authorization_token: process.env.GITHUB_PERSONAL_ACCESS_TOKEN!,
642+
},
643+
],
644+
betas: ["mcp-client-2025-04-04"]
645+
})
646+
```
647+
613648
## Frequently Asked Questions
614649

615650
## Semantic versioning

0 commit comments

Comments
 (0)