@ebowwa/state-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +141 -0
  2. package/package.json +51 -0
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # @ebowwa/state-mcp
2
+
3
+ MCP server for state management using `@ebowwa/state` core library.
4
+
5
+ ## Overview
6
+
7
+ @ebowwa/state-mcp is a Model Context Protocol (MCP) server that provides persistent state management for AI coding assistants like Claude. Built on the `@ebowwa/state` core library with SQLite persistence.
8
+
9
+ ### Key Features
10
+
11
+ - **Core Library**: Uses `@ebowwa/state` for all state management logic
12
+ - **Repository Pattern**: Clean data access layer with SQLite backend
13
+ - **Token-Aware Responses**: Automatic response sizing to stay within MCP protocol limits
14
+ - **Privacy Controls**: Private state items that don't leak across sessions
15
+ - **TypeScript**: Full type safety throughout
16
+
17
+ ## Architecture
18
+
19
+ This MCP server is a thin wrapper around `@ebowwa/state`:
20
+
21
+ ```
22
+ @ebowwa/state-mcp/
23
+ ├── src/
24
+ │ ├── tools/ # MCP tool definitions & handlers
25
+ │ │ ├── definitions.ts # Tool schemas
26
+ │ │ └── handlers.ts # Tool implementations
27
+ │ ├── transports/ # MCP transport implementations
28
+ │ │ └── stdio.ts # Stdio transport (Claude Desktop)
29
+ │ ├── index.ts # Main entry point
30
+ │ └── cli.ts # CLI entry point
31
+ └── package.json # Depends on @ebowwa/state
32
+ ```
33
+
34
+ Core logic is in `@ebowwa/state`:
35
+ - `@ebowwa/state/core` - Types, interfaces, errors
36
+ - `@ebowwa/state/repositories` - SQLite repositories
37
+ - `@ebowwa/state/services` - StateService business logic
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ # Install globally
43
+ npm install -g @ebowwa/state-mcp
44
+
45
+ # Or use with npx
46
+ npx @ebowwa/state-mcp
47
+ ```
48
+
49
+ ## Usage with Claude Desktop
50
+
51
+ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json`):
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "state": {
57
+ "command": "npx",
58
+ "args": ["-y", "@ebowwa/state-mcp"],
59
+ "env": {
60
+ "MCP_DB_PATH": "/path/to/state.db"
61
+ }
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ ### Available Tools
68
+
69
+ | Tool | Description |
70
+ |------|-------------|
71
+ | `state_save` | Save or update a state item |
72
+ | `state_get` | Get a state item by key |
73
+ | `state_query` | Query state items with filters |
74
+ | `state_search` | Search state items by text |
75
+ | `state_delete` | Delete a state item |
76
+ | `state_list_keys` | List all state keys |
77
+ | `session_info` | Get current session info |
78
+ | `session_set` | Switch to a different session |
79
+ | `session_list` | List all sessions |
80
+
81
+ ### Tool Examples
82
+
83
+ ```typescript
84
+ // Save a state item
85
+ await mcp.call('state_save', {
86
+ key: 'project:context',
87
+ value: 'This is a React project with TypeScript',
88
+ category: 'project',
89
+ priority: 'high'
90
+ });
91
+
92
+ // Get a state item
93
+ await mcp.call('state_get', { key: 'project:context' });
94
+
95
+ // Query with filters
96
+ await mcp.call('state_query', {
97
+ category: 'project',
98
+ limit: 50
99
+ });
100
+
101
+ // Search
102
+ await mcp.call('state_search', {
103
+ query: 'React',
104
+ searchIn: ['key', 'value']
105
+ });
106
+ ```
107
+
108
+ ## Configuration
109
+
110
+ Environment variables:
111
+
112
+ | Variable | Description | Default |
113
+ |----------|-------------|---------|
114
+ | `MCP_DB_PATH` | Path to SQLite database | `./state-mcp.db` |
115
+ | `MCP_MAX_TOKENS` | Maximum response tokens | `25000` |
116
+ | `MCP_TOKEN_SAFETY_BUFFER` | Safety buffer (0-1) | `0.8` |
117
+ | `MCP_MIN_ITEMS` | Minimum items to return | `1` |
118
+ | `MCP_MAX_ITEMS` | Maximum items to return | `100` |
119
+ | `MCP_CHARS_PER_TOKEN` | Char-to-token ratio | `3.5` |
120
+ | `LOG_LEVEL` | Logging level | `INFO` |
121
+
122
+ ## Development
123
+
124
+ ```bash
125
+ # Install dependencies
126
+ bun install
127
+
128
+ # Build
129
+ bun run build
130
+
131
+ # Run
132
+ bun run start
133
+ ```
134
+
135
+ ## Related Packages
136
+
137
+ - [`@ebowwa/state`](https://www.npmjs.com/package/@ebowwa/state) - Core state management library
138
+
139
+ ## License
140
+
141
+ MIT
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@ebowwa/state-mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for state management using @ebowwa/state core library",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "state-mcp": "./dist/cli.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "dev": "tsc --watch",
13
+ "start": "node dist/cli.js",
14
+ "type-check": "tsc --noEmit",
15
+ "clean": "rm -rf dist",
16
+ "prebuild": "npm run clean",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "keywords": [
20
+ "mcp",
21
+ "state-management",
22
+ "context",
23
+ "claude",
24
+ "ai"
25
+ ],
26
+ "author": "Ebowwa Labs <labs@ebowwa.com>",
27
+ "license": "MIT",
28
+ "dependencies": {
29
+ "@ebowwa/state": "^0.1.1",
30
+ "@modelcontextprotocol/sdk": "^1.12.3"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^22.10.5",
34
+ "typescript": "^5.8.3"
35
+ },
36
+ "engines": {
37
+ "node": ">=20.0.0"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/ebowwa/codespaces.git",
42
+ "directory": "packages/mcp/state-mcp"
43
+ },
44
+ "homepage": "https://github.com/ebowwa/codespaces/tree/main/packages/mcp/state-mcp#readme",
45
+ "bugs": {
46
+ "url": "https://github.com/ebowwa/codespaces/issues"
47
+ },
48
+ "files": [
49
+ "dist"
50
+ ]
51
+ }