@authsec/sdk
v4.2.0
Published
AuthSec SDK for MCP Auth, Services, CIBA, and SPIFFE integration (TypeScript/JavaScript)
Readme
AuthSec TypeScript SDK (@authsec/sdk)
TypeScript runtime for exposing MCP tools behind AuthSec OAuth and RBAC.
Local Memory Wrapper Smoke Test
This package includes a real MCP wrapper example at examples/memory-authsec-wrapper.mjs. It runs against the local SDK build in dist/ and proxies the upstream memory server over stdio.
1. Install and build the local SDK
cd packages/typescript-sdk
npm install
npm run build2. Create the example env file
cd packages/typescript-sdk
cp examples/memory-authsec-wrapper.env.example examples/memory-authsec-wrapper.envUpdate examples/memory-authsec-wrapper.env with a real AUTHSEC_CLIENT_ID. The defaults in the example file already target the local AuthSec stack:
http://localhost:7468/authsec/sdkmgr/mcp-authhttp://localhost:7468/authsec/sdkmgr/services
Override them only if you need a different backend.
3. Run the local wrapper
cd packages/typescript-sdk
set -a
source examples/memory-authsec-wrapper.env
set +a
npm run example:memory:localexample:memory:local rebuilds the SDK and then starts the wrapper from the local repo build in dist/. The raw runtime entrypoint remains available as npm run example:memory if you already exported the environment yourself.
Expected startup output includes:
- effective
appName - effective
hostandport - auth and services URLs, marked as
sdk defaultorenv override - upstream memory server command
4. Basic server check
With the server running:
curl http://127.0.0.1:3005/Expect JSON with:
status: "running"protocol: "mcp-with-oauth"- the effective auth and services URLs
5. MCP Inspector flow
Open MCP Inspector against the local HTTP endpoint:
npx @modelcontextprotocol/inspector http://127.0.0.1:3005Manual smoke-test sequence:
- Call
initialize. - Call
tools/listbefore login and confirm the OAuth tools are present. - Run
oauth_startand finish the browser authentication flow. - Finish the browser login flow through the local AuthSec UI.
- Continue with
oauth_status. - Call
tools/listagain and confirm wrapped memory tools are now available. - Execute at least one wrapped memory tool successfully.
6. Failure-path check
The wrapper should fail fast if AUTHSEC_CLIENT_ID is missing:
cd packages/typescript-sdk
npm run example:memory:localExpected error:
Set AUTHSEC_CLIENT_ID before runningEnvironment Variables
Required:
AUTHSEC_CLIENT_ID
Common local settings:
AUTHSEC_APP_NAMEdefault:authsec-memory-wrapper-localHOSTdefault:127.0.0.1PORTdefault:3005
Optional backend overrides:
AUTHSEC_AUTH_SERVICE_URLAUTHSEC_SERVICES_URL
Optional wrapper settings:
AUTHSEC_TOOL_ROLES_JSONMEMORY_FILE_PATHMEMORY_SERVER_COMMANDMEMORY_SERVER_ARGS_JSON
Package Scripts
npm run buildbuilds the local SDK intodist/npm run example:memoryruns the wrapper directlynpm run example:memory:localrebuilds and then runs the wrapper for local smoke testing
