AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Mcp Api Key Auth

skill-yourdaylight-stock-datasource-mcp-api-key-auth · by Yourdaylight

This skill should be used when the user needs to set up, manage, or troubleshoot MCP API Key authentication and tool usage tracking for this stock data service. Use it when configuring external MCP clients (Claude Code, Cursor) to connect to the data service.

No reviews yet
0 installs
34 views
0.0% view→install

Install

$ agentstack add skill-yourdaylight-stock-datasource-mcp-api-key-auth

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-yourdaylight-stock-datasource-mcp-api-key-auth)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Mcp Api Key Auth? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Purpose

Enable external MCP clients (Claude Code, Cursor, etc.) to authenticate with the stock data service using independent API keys, and track per-tool usage (table name, record count) for monitoring.

When to Use

  • User wants to create or manage MCP API keys
  • User wants to configure an external MCP client to connect to this service
  • User wants to view MCP tool usage statistics (which tools called, which tables queried, how many records)
  • User needs to troubleshoot MCP authentication errors (401, invalid key, expired key)

Architecture

  • API Key management is on the HTTP server (port 8000), protected by JWT login
  • MCP protocol is on the MCP server (port 8001), protected by API key in request headers
  • Usage tracking records are stored in ClickHouse mcp_tool_usage_log table

Workflow

1) Create an API Key

First login to get a JWT token, then create an API key:

# Login
JWT=$(curl -s -X POST http://:8000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"your@email.com","password":"yourpassword"}' \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")

# Create API key
curl -s -X POST http://:8000/api/mcp-keys/create \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{"key_name": "my-cursor-key", "expires_days": 90}'

The response contains the full API key (e.g., sk-a1b2c3d4...). Save it immediately — it is only shown once.

2) Configure MCP Client

Claude Code / Claude Desktop

Add to your MCP configuration (claude_desktop_config.json or project .mcp.json):

{
  "mcpServers": {
    "stock-data": {
      "url": "http://:8001/messages",
      "transport": "streamable-http",
      "headers": {
        "Authorization": "Bearer sk-your-api-key-here"
      }
    }
  }
}
Cursor

In Cursor settings, add an MCP server with:

  • URL: http://:8001/messages
  • Header: Authorization: Bearer sk-your-api-key-here

3) Verify Connectivity

# Should return tool list (not 401)
curl -s -X POST http://:8001/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-your-api-key-here" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

4) View Usage Statistics

# Usage history (paginated)
curl -s "http://:8000/api/mcp-usage/history?page=1&page_size=20" \
  -H "Authorization: Bearer $JWT"

# Aggregated stats (last 30 days)
curl -s "http://:8000/api/mcp-usage/stats?days=30" \
  -H "Authorization: Bearer $JWT"

5) Manage API Keys

# List all keys
curl -s http://:8000/api/mcp-keys/list \
  -H "Authorization: Bearer $JWT"

# Revoke a key
curl -s -X POST http://:8000/api/mcp-keys/revoke \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{"key_id": ""}'

Key Endpoints

| Endpoint | Method | Auth | Description | |----------|--------|------|-------------| | /api/mcp-keys/create | POST | JWT | Create new API key | | /api/mcp-keys/list | GET | JWT | List user's API keys | | /api/mcp-keys/revoke | POST | JWT | Revoke an API key | | /api/mcp-usage/history | GET | JWT | Paginated usage history | | /api/mcp-usage/stats | GET | JWT | Aggregated usage stats | | /messages (MCP) | POST | API Key | MCP protocol endpoint |

Troubleshooting

  • 401 "API key required": Missing Authorization header on MCP calls
  • 401 "Invalid or expired API key": Key was revoked or expired — create a new one
  • initialize works but tools/list fails: initialize does not require auth; tools/list and tools/call do
  • Usage not showing up: Usage logging is fire-and-forget; check ClickHouse mcp_tool_usage_log table directly

Verification Checklist

  • [ ] API key created and full key returned (shown only once)
  • [ ] tools/list returns 401 without API key
  • [ ] tools/list returns tool list with valid API key
  • [ ] tools/call records usage in mcp_tool_usage_log table
  • [ ] Revoked key returns 401 on subsequent calls
  • [ ] Usage history API returns correct data
  • [ ] Usage stats show daily call counts and top tools

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.