A Model Context Protocol (MCP) server that provides cognitive tools for thought processes, goal tracking, and dynamic skill creation with user registration and email verification.
Try it out here: https://www.val.town/x/c15r/Chat
- Email Registration: Register with email verification
- Access Tokens: Secure token-based authentication
- User-Scoped Resources: All resources are isolated per user
- Admin Access: Admin users can access legacy global resources
- AI-Enhanced Thought Forking: Automatically generate parallel explorations using OpenAI
- Goal Tracking: Create, update, and monitor goals with hierarchical structure
- Task Management: Break down goals into actionable tasks with state tracking
- State Management: Track and persist cognitive states across sessions
- Blob Storage: Secure key-value storage with automatic user namespacing
- SQLite Database: General-purpose database operations with user-scoped table isolation
- Resource Deletion: Full deletion support with foreign key dependency handling
- Skill Creation: Write and store reusable scripts as "skills"
- Skill Execution: Dynamically invoke created skills as tools
- Skill Management: List, update, and delete skills with execution history
- Automatic AI Generation: Create thought forks with 2-8 parallel AI-generated explorations
- Perspective Analysis: AI generates diverse analytical perspectives automatically
- AI Synthesis: Merge explorations using AI to create comprehensive insights
- Insight Extraction: Automatically extract key insights from each exploration
├── backend/
│ ├── database/
│ │ ├── migrations.ts # Database schema (user-scoped + legacy)
│ │ ├── queries.ts # Database operations with user scoping
│ │ └── user-queries.ts # User management operations
│ ├── mcp/
│ │ ├── server.ts # MCP server implementation
│ │ ├── auth.ts # Authentication (admin + user tokens)
│ │ └── tools/ # Cognitive tools
│ │ ├── blob.ts # Blob storage management
│ │ ├── fork-thought.ts # AI-enhanced thought forking
│ │ ├── goals.ts # Goal management with deletion
│ │ ├── tasks.ts # Task management with deletion
│ │ ├── states.ts # Cognitive state management
│ │ ├── skills.ts # Dynamic skills with deletion
│ │ └── user-registration.ts # User registration & verification
│ └── index.ts # Main entry point with verification endpoint
├── shared/
│ └── types.ts # Shared TypeScript types (user-scoped)
└── README.md
MCP_AUTH_TOKEN
: Admin authentication token (optional)BASE_URL
: Base URL for email verification links (optional)
GET /
- API documentation and statusGET /health
- Health check endpointPOST /register
- User registration (no auth required)GET /verify?token=...
- Email verification (no auth required)POST /mcp
- Main MCP protocol endpoint (conditional auth)GET /tools
- List available tools (conditional auth)
# Register via HTTP endpoint curl -X POST https://your-server.com/register \ -H "Content-Type: application/json" \ -d '{"email": "user@example.com"}' # Or via MCP (no auth required) { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "register_user", "arguments": { "email": "user@example.com" } } }
Check your email and click the verification link, or visit:
https://your-server.com/verify?token=YOUR_VERIFICATION_TOKEN
Use the access token from the verification page in the Authorization
header:
curl -X POST https://your-server.com/mcp \ -H "Authorization: YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'
Create AI-enhanced thought forks that automatically generate multiple perspectives:
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "create_thought_fork", "arguments": { "title": "AI Ethics in Healthcare", "description": "Explore the ethical implications of AI in medical diagnosis and treatment", "branches": 4 } } }
This will:
- Create a thought fork
- Generate 4 different analytical perspectives using AI
- Create parallel explorations for each perspective
- Extract key insights from each exploration
- Return the complete thought fork with all explorations
Merge the explorations with AI synthesis:
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "merge_thought_fork", "arguments": { "id": "thought-fork-id" } } }
The blob storage system provides secure, user-namespaced key-value storage for arbitrary data:
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "blob_set", "arguments": { "key": "user-preferences", "value": { "theme": "dark", "language": "en", "notifications": true } } } }
Retrieve stored data:
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "blob_get", "arguments": { "key": "user-preferences" } } }
List all your stored blobs:
{ "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "blob_list", "arguments": { "prefix": "config-" } } }
- Automatic Namespacing: All blob keys are automatically prefixed with your user ID
- JSON Support: Automatic JSON serialization/deserialization (can be disabled)
- Prefix Filtering: List blobs with specific prefixes
- Existence Checking: Check if a blob exists without retrieving its value
- Admin Access: Admin users can access global blob storage
- Secure Isolation: Users can only access their own blobs
The SQLite database system provides secure, user-scoped database operations for structured data storage:
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "sqlite_create_table", "arguments": { "tableName": "user_notes", "schema": "id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, content TEXT, created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP" } } }
Insert data into your table:
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "sqlite_execute", "arguments": { "query": "INSERT INTO user_notes (title, content) VALUES (?, ?)", "params": ["My First Note", "This is the content of my note"] } } }
Query your data:
{ "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "sqlite_execute", "arguments": { "query": "SELECT * FROM user_notes WHERE title LIKE ?", "params": ["%First%"] } } }
List all your tables:
{ "jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": { "name": "sqlite_list_tables", "arguments": {} } }
Get table schema information:
{ "jsonrpc": "2.0", "id": 5, "method": "tools/call", "params": { "name": "sqlite_describe_table", "arguments": { "tableName": "user_notes" } } }
- Automatic Table Namespacing: All table names are automatically prefixed with your user ID
- Query Validation: Dangerous operations (DROP DATABASE, PRAGMA, etc.) are blocked
- User Isolation: Users can only access their own tables
- Admin Access: Admin users can access global tables with admin prefix
- SQL Injection Protection: Parameterized queries and input validation
- Secure Table Names: Table names are validated to prevent injection attacks
All resources support full deletion with dependency handling:
- Goals: Deleting a goal removes all subgoals and associated tasks
- Tasks: Deleting a task removes it from goals and other task dependencies
- Thought Forks: Deleting removes all associated explorations
- Skills: Deleting removes all execution history
- States: Direct deletion of cognitive states
- Obtained through email verification
- Scoped to user's own resources
- Required for all cognitive tools
- Set via
MCP_AUTH_TOKEN
environment variable - Access to legacy global resources
- Full system access
- User registration tools only
- No authentication required
register_user
- Register with emailverify_email
- Verify email with tokenresend_verification
- Resend verification email
- Blob Storage:
blob_list
,blob_get
,blob_set
,blob_delete
,blob_exists
- SQLite Database:
sqlite_execute
,sqlite_create_table
,sqlite_list_tables
,sqlite_describe_table
,sqlite_drop_table
- Thought Forking:
create_thought_fork
,merge_thought_fork
,delete_thought_fork
- Goals:
create_goal
,update_goal
,delete_goal
,list_goals
- Tasks:
create_task
,update_task
,delete_task
,list_tasks
- States:
save_cognitive_state
,load_cognitive_state
,delete_cognitive_state
- Skills:
create_skill
,execute_skill
,delete_skill
,list_skills
skill_[name]
- Execute user-created skills dynamically
- Register:
register_user
with email - Verify: Click email link to get access token
- Store Data: Use
blob_set
to store configuration or data - Create Database: Use
sqlite_create_table
to set up structured data storage - Create Goal: Use
create_goal
to set objectives - Fork Thoughts: Use
create_thought_fork
for AI-assisted analysis - Merge Insights: Use
merge_thought_fork
for AI synthesis - Create Tasks: Break down goals with
create_task
- Store Structured Data: Use
sqlite_execute
to insert and query data - Build Skills: Create reusable tools with
create_skill
- Save State: Capture progress with
save_cognitive_state
- Email verification required for access
- User-scoped resource isolation
- Automatic blob storage namespacing
- Secure skill execution sandboxing
- Token-based authentication
- Foreign key constraint handling
Server Version: 2.0.0 - Now with user registration and AI-enhanced cognitive tools