Skip to content

Commit 83037a7

Browse files
Add dart_node_mcp package and Too Many Cooks MCP example (#12)
TLDR; New dart_node_mcp package + "Too Many Cooks" MCP server example with VSCode extension. What Does This Do? dart_node_mcp: Dart package for building MCP servers on Node.js too_many_cooks: MCP server for multi-agent coordination (file locks, messaging, plans) too_many_cooks_vscode_extension: VSCode extension showing real-time agent activity dart_node_better_sqlite3: An sqlite wrapper used by too many cooks Brief Details? dart_node_mcp provides typed MCP server implementation with stdio transport. Too Many Cooks demonstrates the package with an agent coordination server featuring: Agent registration File locking with expiry Inter-agent messaging Plan sharing Real-time notifications via SSE How Do The Tests Prove The Change Works? packages/dart_node_mcp/test/ - MCP server, transport, types, callbacks tests examples/too_many_cooks/test/ - DB, integration, types tests
1 parent dcc5c95 commit 83037a7

131 files changed

Lines changed: 21898 additions & 40 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ node_modules/
44
!tools/build/
55
.dart_tool/
66

7+
coverage/
8+
79
# Generated JS files from dart compile js
810
*.js.deps
911
*.js.map
@@ -16,3 +18,19 @@ website/src/api/
1618
website/.dart-doc-temp/
1719

1820
examples/frontend/coverage/
21+
22+
*.mjs
23+
24+
examples/too_many_cooks_vscode_extension/.vscode-test/user-data/
25+
26+
examples/too_many_cooks_vscode_extension/.vscode-test/vscode-darwin-arm64-1.106.3/
27+
28+
*.db
29+
30+
*.db-shm
31+
32+
*.db-wal
33+
34+
*.vsix
35+
36+
examples/too_many_cooks_vscode_extension/.vscode-test/

AGENTS.md

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,39 @@
22

33
This is a project for Dart packages to be consumed on Node for building node-based apps with the Dart
44

5+
MANDATORY: TOO MANY COOKS
6+
- check your messages regularly
7+
- lock files with too many cooks before editing, and unlock afterwards
8+
- do not edit files that others have locked up
9+
- always signal your intent to other agents
10+
- If you are coordinator, keep delegating until the grande scheme has been achieved
11+
- If you are not coordinator, don't stop and keep asking for something to do
12+
- Routinely clean up expired locks
13+
- If you find yourself with nothing to do, check someone else's plan and help them
14+
515
# Rules
616
- All Dart. Absolutely minimal JS
17+
- Use async/await. Do not use `.then`
718
- NO DUPLICATION. Move files, code elements instead of copying them. Search for elements before adding them. HIGHEST PRIORITY. PRIORITIZE THIS OVER ALL ELSE!!
8-
- Return Result<T,E> from the nadz library for any function that could throw an exception <- CRITICAL!!!
19+
- Prefer typedef records with named fields instead of classes for data (structural typing). This mimics Typescript better
20+
- Return Result<T,E> from the nadz library for any function that could throw an exception. NO THROWING EXCEPTIONS.
21+
- Don't make consecutive log calls. Use string interpolation
22+
- Avoid casting!!! [! `as` `late`] are all ILLEGAL!!! U
23+
- Use pattern matching switch expressions or ternaries. The exceptional case is if inside arrays and maps because these are declarative and not imperaative.
924
- All packages MUST have austerity installed for linting and nadz for Result<T,E> types
10-
- Fix ALL lint errors
11-
- Do not expose raw JS objects like JSAny to the higher levels. The library packages are supposed to put a TYPED layer over these
12-
- NO GLOBAL STATE
13-
- Casting, ! etc are all ILLEGAL!!!
14-
- Move non-example-specific code to the framework packages
25+
- Do not expose `JSObject` or `JSAny` etc in the public APIs. Put types over everything. The library packages are supposed to put a TYPED layer over these
26+
- No global state
1527
- No skipping tests EVER!!! Agressively unskip tests when you find them!!
1628
- Failing tests = OK. Removing assertions or tests = ILLEGAL!!
17-
- NO THROWING EXCEPTIONS. Return results. Handle errors with Result types, except for cases where the code is a placeholder.
18-
- NO PLACEHOLDERS!!! If you HAVE TO leave a section blank, fail LOUDLY by throwing an exception.
19-
- Tests must FAIL HARD. Don't add allowances and print warnings. Just FAIL!
29+
- NO PLACEHOLDERS!!! If you HAVE TO leave a section blank, fail LOUDLY by throwing an exception. This is the only time exceptions are allowed. Tests must FAIL HARD. Don't add allowances and print warnings. Just FAIL!
2030
- Keep functions under 20 lines long and files under 500 loc
21-
- NEVER use the late keyword
2231
- Do not use Git commands unless explicitly requested
23-
- Don't use if statements. Use pattern matching or ternaries instead. The exceptional case is if inside arrays and maps because these are declarative and not imperaative.
2432

2533
## Build & Run Commands
2634

2735
```bash
28-
# Build express_server example (compiles Dart to Node-compatible JS)
29-
dart run tools/build/build.dart express_server
30-
31-
# Run the compiled server
32-
node examples/express_server/build/server.js
33-
34-
# Install Node dependencies for express example
35-
cd examples/express_server && npm install
36-
37-
# Run tests for express example
38-
cd examples/express_server && dart test
36+
// Build everything
37+
sh run_dev.sh
3938
```
4039

4140
Critical documentation URLs for the Dart JS Framework project.
@@ -72,7 +71,7 @@ Critical documentation URLs for the Dart JS Framework project.
7271
| Express 4.x API Reference | https://expressjs.com/en/4x/api.html |
7372
| Express DevDocs (offline) | https://devdocs.io/express/ |
7473

75-
## React (Phase 2 - Web Frontend)
74+
## React
7675

7776
| Topic | URL |
7877
|-------|-----|
@@ -81,7 +80,7 @@ Critical documentation URLs for the Dart JS Framework project.
8180
| Hooks API Reference | https://legacy.reactjs.org/docs/hooks-reference.html |
8281
| React DevDocs (offline) | https://devdocs.io/react/ |
8382

84-
## React Native / Expo (Phase 3 - Mobile)
83+
## React Native / Expo
8584

8685
| Topic | URL |
8786
|-------|-----|
@@ -102,10 +101,7 @@ Critical documentation URLs for the Dart JS Framework project.
102101
- React 18 docs at `18.react.dev` are canonical
103102
- Expo SDK releases 3x/year, targets specific React Native versions
104103

105-
## Architecture
106-
107-
-
108104

109105
## Testing
110106

111-
Tests in `examples/express_server/test/` use the standard `package:test`. The test spawns the Node server process and makes HTTP requests against it. The server must be built before running tests.
107+
All projects MUST have tests. Where the package is a UI project, the tests MUST test the UI interactions and avoid unit testing. Tests are Dart only. No Javascript unless it's necessary to test the underlying interop.

CLAUDE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@
22

33
This is a project for Dart packages to be consumed on Node for building node-based apps with the Dart
44

5+
MANDATORY: TOO MANY COOKS
6+
- check your messages regularly
7+
- lock files with too many cooks before editing, and unlock afterwards
8+
- do not edit files that others have locked up
9+
- always signal your intent to other agents
10+
- If you are coordinator, keep delegating until the grande scheme has been achieved
11+
- If you are not coordinator, don't stop and keep asking for something to do
12+
- Routinely clean up expired locks
13+
- If you find yourself with nothing to do, check someone else's plan and help them
14+
515
# Rules
616
- All Dart. Absolutely minimal JS
717
- Use async/await. Do not use `.then`
818
- NO DUPLICATION. Move files, code elements instead of copying them. Search for elements before adding them. HIGHEST PRIORITY. PRIORITIZE THIS OVER ALL ELSE!!
919
- Prefer typedef records with named fields instead of classes for data (structural typing). This mimics Typescript better
1020
- Return Result<T,E> from the nadz library for any function that could throw an exception. NO THROWING EXCEPTIONS.
21+
- Don't make consecutive log calls. Use string interpolation
1122
- Avoid casting!!! [! `as` `late`] are all ILLEGAL!!! U
1223
- Use pattern matching switch expressions or ternaries. The exceptional case is if inside arrays and maps because these are declarative and not imperaative.
1324
- All packages MUST have austerity installed for linting and nadz for Result<T,E> types

examples/backend/dart_test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
platforms: [vm]

examples/frontend/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ packages:
9090
source: hosted
9191
version: "3.0.7"
9292
dart_node_core:
93-
dependency: transitive
93+
dependency: "direct main"
9494
description:
9595
path: "../../packages/dart_node_core"
9696
relative: true

examples/frontend/pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ environment:
88

99
dependencies:
1010
austerity: ^1.3.0
11+
dart_node_core:
12+
path: ../../packages/dart_node_core
1113
dart_node_react:
1214
path: ../../packages/dart_node_react
1315
nadz: ^0.0.7-beta

examples/mobile/lib/screens/task_list_screen.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:dart_node_react/dart_node_react.dart' hide view;
55
import 'package:dart_node_react_native/dart_node_react_native.dart';
66
import 'package:nadz/nadz.dart';
77
import 'package:shared/http/http_client.dart';
8-
import 'package:shared/js_types/js_types.dart';
98
import 'package:shared/theme/theme.dart';
109

1110
import '../types.dart';

examples/too_many_cooks/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.db
2+
*.db-shm
3+
*.db-wal
4+
*.js

examples/too_many_cooks/.npmignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Source files
2+
lib/
3+
bin/
4+
test/
5+
6+
# Dart files
7+
pubspec.yaml
8+
pubspec.lock
9+
analysis_options.yaml
10+
dart_test.yaml
11+
.dart_tool/
12+
.packages
13+
14+
# Build artifacts (except server_node.js)
15+
build/bin/*.js
16+
!build/bin/server_node.js
17+
build/test/
18+
19+
# Development files
20+
*.sh
21+
*.db
22+
.too_many_cooks/
23+
24+
# IDE
25+
.idea/
26+
.vscode/
27+
28+
# Node
29+
node_modules/
30+
package-lock.json
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changelog
2+
3+
## 0.2.0
4+
5+
### Fixed
6+
- Added missing shebang (`#!/usr/bin/env node`) to executable - fixes npm binary execution failure
7+
- Added missing `@modelcontextprotocol/sdk` dependency
8+
9+
## 0.1.0
10+
11+
- Initial release
12+
- File locking for multi-agent coordination
13+
- Agent registration with API keys
14+
- Inter-agent messaging with broadcast support
15+
- Plan visibility (goals and current tasks)
16+
- Real-time status overview
17+
- SQLite persistence at `~/.too_many_cooks/data.db`

0 commit comments

Comments
 (0)