KeyRing Setup Guide
From install to sovereign secrets in seven steps. Each section has a manual path you can follow yourself and an AI-assisted path your agent can automate.
What KeyRing Does
KeyRing is your AI agent's credential manager. When your agent needs to call an API on your behalf, the API key has to come from somewhere. Without KeyRing, that key ends up in your conversation — visible in logs, context windows, and tool results.
KeyRing keeps secrets encrypted on your machine. When your agent needs to make an API call, KeyRing decrypts the key, makes the call, and returns only the response. The key never appears in the conversation.
1.Install the Gateway
KeyRing ships as part of the CoreforgedMCP gateway. Install it from PyPI.
Open your terminal (PowerShell on Windows, Terminal on Mac/Linux) and install:
pip install "coreforged-mcp>=1.4.0"
If you use a virtual environment or conda, activate it first. The package installs globally by default.
Verify the install:
coreforged-mcp --version
You should see a version number (e.g., coreforged-mcp 1.4.0). If you get "command not found," check that your Python Scripts directory is on your PATH.
Troubleshooting
- Windows: Scripts folder is typically at
C:\Users\YourName\AppData\Local\Programs\Python\Python3XX\Scripts\ - Mac/Linux: Try
python3 -m pip install "coreforged-mcp>=1.4.0"ifpippoints to the wrong Python - Permission errors: Add
--userto the pip command
2.Wire to Your AI Tool
The gateway needs to be registered in your AI tool's MCP configuration file. This tells Claude Code or Claude Desktop to start the gateway when it launches.
For Claude Code
Navigate to your project directory and run:
coreforged-mcp init
This creates or updates .mcp.json in the current directory:
{
"mcpServers": {
"coreforged": {
"command": "coreforged-mcp",
"args": ["run"]
}
}
}Restart Claude Code. The gateway starts automatically.
For Claude Desktop
Open the configuration file at:
| Platform | Path |
|---|---|
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Mac | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
Add the same "coreforged" server entry inside the "mcpServers" block. Save and restart Claude Desktop.
Verify it worked:
coreforged-mcp status
You should see "Discovered plugins: 1" with KeyRing listed.
3.Find Your API Keys
Before you can put keys on the ring, you need to know where they are. API keys tend to scatter across your filesystem — .env files, JSON credential files, plain text files in config directories.
| Platform | Where to Look |
|---|---|
| Windows | C:\Users\YourName\.env, project directories, %APPDATA% subfolders |
| Mac | ~/.env, ~/.config/, project directories |
| Linux | ~/.env, ~/.config/, /etc/, project directories |
What you're looking for:
.envfiles withKEY=valuepairs- JSON files named
client_secret_*.jsonorcredentials.json(Google OAuth) - Firebase service account JSON files
- Plain text files containing a single API key
Common services and their key formats:
| Service | Key Dashboard | Key Format |
|---|---|---|
| OpenAI | platform.openai.com | Starts with sk- |
| Anthropic | console.anthropic.com | Starts with sk-ant- |
| GitHub | Settings → Developer settings | ghp_ or github_pat_ prefix |
| Stripe | dashboard.stripe.com → Developers | Starts with sk_test_ or sk_live_ |
| Supabase | Project Settings → API | Long alphanumeric string |
4.Add Keys to the Ring
Now that you know where your keys are, add them to KeyRing's encrypted store.
Create the KeyRing directory:
mkdir %USERPROFILE%\.coreforged\keyring
mkdir -p ~/.coreforged/keyring
Create the secrets file at ~/.coreforged/keyring/.secrets.json:
{
"openai-api-key": {
"value": "sk-your-actual-key-here",
"service": "openai",
"description": "OpenAI API key for GPT calls"
},
"github-pat": {
"value": "ghp_your-actual-token-here",
"service": "github",
"description": "GitHub personal access token"
}
}Save the file, then trigger auto-encryption:
coreforged-mcp status
The first read auto-migrates to encrypted format using a machine-local master key at ~/.coreforged/keyring/.master_key. The plaintext is gone after migration.
Important
- The master key has no recovery mechanism. If it's deleted, all encrypted secrets are unrecoverable. Back it up.
- Don't put the keyring directory in a synced folder (OneDrive, Dropbox, Google Drive).
- An agent that can read files in
~/.coreforged/can read the store and the master key, and decrypt every secret without any KeyRing tool. An agent that can write there can also change where a key may be sent. Keep your agent and its file tools out of that folder.
5.Bind Keys to Hosts
KeyRing checks where a request goes before it sends the key.
A service KeyRing knows always goes to its own API host. If your agent passes another URL for one of these services, KeyRing ignores it.
| Service | Host |
|---|---|
| GitHub | api.github.com |
| Stripe | api.stripe.com |
| OpenAI | api.openai.com |
| Anthropic | api.anthropic.com |
| Linear | api.linear.app |
| Polar | api.polar.sh |
| AgentMail | api.agentmail.to |
| Google Analytics 4 | analyticsdata.googleapis.com |
| Search Console | searchconsole.googleapis.com |
| PageSpeed Insights | pagespeedonline.googleapis.com |
For any other service, mark the key custom and bind it to exact hosts. KeyRing refuses the request otherwise. Add the key to the ring first (Section 4), then bind it:
coreforged-mcp keyring bind my-service-key api.your-service.com --custom
Your agent then passes the URL as base_url in the request's params. KeyRing sends the key only if the URL uses https and its host is one you bound. Each bind call adds to the hosts already bound. unbind takes hosts off again: it removes the hosts you name, or clears the binding if you name none.
coreforged-mcp keyring unbind my-service-key api.your-service.com
A key you marked custom stays custom, so with no binding KeyRing refuses it until you bind a host again. If you name every host, the binding becomes an empty list (the command prints -> []), and KeyRing refuses the key for every host. To clear a binding, name no host.
You can bind a key for a known service too. KeyRing then refuses the call unless that service's host is in the binding.
Security notes
- A custom key takes exact hosts only. KeyRing refuses a wildcard such as
*.example.com. - KeyRing refuses a host that resolves to a private, loopback, link-local or cloud-metadata address, which blocks SSRF attacks. That includes localhost.
- KeyRing does not follow redirects. Your agent gets the 3xx response, and the key is not forwarded.
The commands coreforged-mcp allow-domain, remove-domain and list-domains edit and show a list in allowed_domains.json. No request reads that list, so they do not change where a key can go.
6.Use KeyRing with Your Agent
Once configured, your AI agent accesses secrets through two MCP tools.
keyring_list_available
Shows what secrets are on the ring — names and descriptions only, never values. Ask your agent: "What API keys do I have access to?"
keyring_authenticated_request
Makes an API call using a managed secret. The key is decrypted, used for the call, and discarded. The agent sees the response data — never the credential.
Test it:
- Start a Claude Code session in a project with the gateway configured
- Ask: "What secrets are available on my KeyRing?"
- Ask: "Use my OpenAI key to list available models."
If it's not working
- Is the gateway running?
coreforged-mcp status - Is the secret name correct? Names are case-sensitive, lowercase-with-hyphens.
- Was the request refused for its host? The refusal message says why (Section 5).
7.Manage Over Time
Adding a new key:
- Use the setup wizard:
coreforged-mcp setup - Or re-consolidate from new directories:
coreforged-mcp consolidate --dir ~/new-project
Rotating a key:
- Update the key at the service (e.g., regenerate your OpenAI key)
- Update the key in your .env file
- Run
coreforged-mcp consolidate— it detects the changed value and updates the ring
Back up these files:
| File | Why |
|---|---|
| ~/.coreforged/keyring/.master_key | Without this, encrypted secrets are unrecoverable |
| ~/.coreforged/keyring/.secrets.json | The encrypted secret store |
Store backups in a secure location (password manager, encrypted drive). Never commit these to git.
Supported Services
KeyRing's scanner and classifier recognize credentials for these services out of the box. For services not listed, the generic adapter handles any REST API with bearer, header, basic, or query auth.
AI/ML
OpenAI, Anthropic, Google AI, HuggingFace, Cohere, Groq, DeepSeek, Mistral, Replicate, ElevenLabs, Deepgram
Cloud
AWS, Azure, Google Cloud, Cloudflare, Vercel, Netlify, Heroku, Fly.io, Railway, Render
Communication
Slack, Discord, Telegram, Twilio, SendGrid, Resend, AgentMail
Data
Supabase, Firebase, PostgreSQL, MongoDB, Redis, Pinecone, Typesense, Airtable
Dev Tools
GitHub, Linear, Sentry, Datadog, Docker, npm, PyPI
Payment
Stripe, Polar
Productivity
Notion
Your keys stay on the ring. Your agent stays sovereign.