spn-mcp
Dynamic REST-to-MCP wrapper for the SuperNovae ecosystem.
Overview
spn-mcp exposes REST APIs as MCP (Model Context Protocol) tools based on YAML configuration files. This allows Claude Code and Nika to interact with any REST API without writing custom MCP servers.
YAML Config -> MCP Tools
~/.spn/apis/dataforseo.yaml MCP Tools:
├── name: dataforseo ├── dataforseo_keyword_ideas
├── tools: ├── dataforseo_domain_rank
│ ├── keyword_ideas -> ├── dataforseo_backlinks
│ ├── domain_rank └── dataforseo_referring_domains
│ └── backlinks
Usage
Via spn CLI (recommended)
# Start MCP server (loads all configs from ~/.spn/apis/)
# Start server for specific API only
# List configured APIs
# Validate configuration
# Show API details
Standalone Binary
# Start MCP server
# List APIs
# Validate config
Configuration
API configurations are YAML files in ~/.spn/apis/:
# ~/.spn/apis/dataforseo.yaml
name: dataforseo
version: "1.0"
base_url: https://api.dataforseo.com/v3
description: "DataForSEO API v3"
auth:
type: basic
credential: dataforseo # resolved via spn daemon
rate_limit:
requests_per_minute: 12
burst: 2
headers:
Content-Type: application/json
tools:
- name: keyword_ideas
description: "Get keyword ideas"
method: POST
path: /dataforseo_labs/google/keyword_ideas/live
body_template: |
[{"keywords": {{ keywords | json }}}]
params:
- name: keywords
type: array
items: string
required: true
description: "Seed keywords"
response:
extract: "tasks[0].result"
Authentication Types
Basic Auth
auth:
type: basic
credential: myservice # format: username:password
Bearer Token
auth:
type: bearer
credential: myservice # The token value
API Key
auth:
type: api_key
credential: myservice
location: header # or: query
key_name: X-API-Key
Parameter Types
string- Text valuesinteger- Whole numbersnumber- Floating-point numbersboolean- true/falsearray- Lists (specifyitemstype)object- Nested objects
Credential Resolution
Credentials are resolved in this order:
- spn daemon (recommended) - Stored in OS keychain
- Environment variable -
{CREDENTIAL}_API_KEY
# Store credential in keychain
# Or use environment variable
Integration
Claude Code
Add to your MCP settings (~/.config/claude/settings.json):
To load only specific APIs:
For environment-based credentials (no spn daemon):
Verifying Integration
After adding the MCP server to Claude Code, the tools will appear with names like:
dataforseo_keyword_ideasstripe_list_customersahrefs_domain_rating
Nika Workflows
steps:
- invoke: dataforseo_keyword_ideas
params:
keywords:
use.ctx: keyword_data
Sample Configurations
Pre-configured APIs (after spn setup):
| API | Tools | Description |
|---|---|---|
| dataforseo | 7 | SEO data and keyword research |
| ahrefs | 5 | Backlinks and site analysis |
| semrush | 5 | SEO and competitive research |
| stripe | 9 | Payment processing |
Troubleshooting
"No secret found for provider"
Ensure the credential is stored:
# Check if credential exists
# Store credential if missing
Or set environment variable: export DATAFORSEO_API_KEY="user:pass"
"Could not connect to spn daemon"
The daemon auto-starts on credential access. If issues persist:
# Check daemon status
# Manual start
Tools not appearing in Claude Code
- Check config syntax:
spn mcp apis validate <name> - Verify configs exist:
spn mcp apis list - Check logs:
RUST_LOG=debug spn mcp serve 2>&1 | head -50
Development
# Build
# Test
# Run with tracing
RUST_LOG=debug
Security
spn-mcp includes multiple security hardening measures:
- Path traversal protection: API names are validated to prevent
../attacks - URL injection prevention: Tool paths are validated to prevent protocol-relative URLs
- Credential isolation: Secrets resolved via spn daemon (single keychain accessor)
- Memory protection: Credentials use
Zeroizing<T>for auto-clear on drop
License
AGPL-3.0-or-later