MCP server starter: give AI agents secure access to internal systems
We use this starter when an agent needs access to internal systems such as a CRM, an ERP or a document store. It gives you a Model Context Protocol server with sign-in, scoped permissions and a record of every call from the first commit.
What's inside.
OAuth sign-in
The server acts as an OAuth resource server, so agents connect on behalf of a signed-in user with tokens from your existing identity provider.
Per-user scopes
Each tool declares the scope it needs, and every call runs with the permissions of the person behind the agent.
Typed tools
Arguments and results are Pydantic models, so clients get a clear schema and bad input is rejected before it reaches your systems.
Audit logging
Every tool call is recorded with the user, tool, arguments, outcome and timing, ready to send to your logging stack.
Rate limits
Limits per user and per tool, backed by Redis, protect the systems behind the server from runaway agent loops.
Tests
Unit tests for tools and permission checks, plus an integration test that connects a real MCP client to the server.
How it fits together.
- 01
Connect
An MCP client, such as an agent or a desktop assistant, connects over streamable HTTP and completes the OAuth flow with your identity provider.
- 02
Authorise
On each tool call the server validates the token, resolves the user and checks the scope the tool requires.
- 03
Execute
The tool calls the internal system through a small client that carries the user's context, with rate limits and timeouts applied.
- 04
Record
The call is written to the audit log, and a typed result goes back to the agent.
A look at the code.
A read-only tool with a typed result, a scope check and an audit entry.
Built with.
All technologiesHear when it is public.
We are preparing the mcp server starter for release. One email when it is out, and our occasional notes.