---
title: "onemodelcontext cookbook"
url: https://recursiveai.org/onemodelcontext/cookbook/
description: "Short recipes for common OneModelContext tasks, each with complete code you can copy."
version: "1.0.1"
---

# onemodelcontext cookbook

Short recipes for common OneModelContext tasks, each with complete code you can copy.

## Servers and clients

- [Build a server in C#](https://recursiveai.org/onemodelcontext/cookbook/build-a-server-in-csharp/index.md): Expose C# methods as tools that a client can discover and call. This example adds two integers over standard input and output (stdio).
- [Connect to a server in C#](https://recursiveai.org/onemodelcontext/cookbook/connect-to-a-server/index.md): A client discovers a server’s tools and calls them. You don’t need a language model or an API key to make a tool call.
- [Host a server on ASP.NET Core](https://recursiveai.org/onemodelcontext/cookbook/host-on-aspnet-core/index.md): Add a protocol endpoint to an ASP.NET Core app alongside your existing routes.
- [Serve tools over HTTP in C#](https://recursiveai.org/onemodelcontext/cookbook/serve-over-http-without-aspnet/index.md): Streamable HTTP exposes tools at a URL. OneModelContext includes a loopback HTTP listener, so a local server doesn’t need ASP.NET Core.

## Authorization

- [Require OAuth sign-in on a server](https://recursiveai.org/onemodelcontext/cookbook/require-sign-in-on-a-server/index.md): Protect tool calls with OAuth access tokens. This local example uses OneModelContext’s embedded authorization server and a simulated signed-in user.
- [Sign in with OAuth to a protected server in C#](https://recursiveai.org/onemodelcontext/cookbook/sign-in-to-a-protected-server/index.md): An OAuth client signs in, obtains a token and sends it with tool calls. This example runs against an embedded local authorization server, with no external identity provider.
