@hanna84/mcp-writing 2.6.0 → 2.7.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 (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/index.js +144 -0
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,11 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v2.7.0](https://github.com/hannasdev/mcp-writing.git
8
+ /compare/v2.6.0...v2.7.0)
9
+
10
+ - feat(workflows): add describe_workflows entry-point tool [`#90`](https://github.com/hannasdev/mcp-writing.git
11
+ /pull/90)
12
+
7
13
  #### [v2.6.0](https://github.com/hannasdev/mcp-writing.git
8
14
  /compare/v2.5.1...v2.6.0)
9
15
 
16
+ > 26 April 2026
17
+
10
18
  - feat(styleguide): improve AI navigation with next_step hints and identifier validation [`#89`](https://github.com/hannasdev/mcp-writing.git
11
19
  /pull/89)
20
+ - Release 2.6.0 [`1083d55`](https://github.com/hannasdev/mcp-writing.git
21
+ /commit/1083d556f1d7b23a1c1290b84735014878187b47)
12
22
 
13
23
  #### [v2.5.1](https://github.com/hannasdev/mcp-writing.git
14
24
  /compare/v2.5.0...v2.5.1)
package/index.js CHANGED
@@ -849,12 +849,156 @@ function maxScenesNextStep(matchedCount) {
849
849
  return `Re-run with max_scenes set to at least ${matchedCount}.`;
850
850
  }
851
851
 
852
+ const WORKFLOW_CATALOGUE = [
853
+ {
854
+ id: "first_time_setup",
855
+ label: "First-time setup",
856
+ use_when: "Connecting to a project for the first time or verifying the runtime is correctly configured.",
857
+ steps: [
858
+ { tool: "get_runtime_config", note: "Verify sync dir, writability, and git availability." },
859
+ { tool: "sync", note: "Index scenes from disk." },
860
+ ],
861
+ },
862
+ {
863
+ id: "styleguide_setup_new",
864
+ label: "Styleguide setup (new project)",
865
+ use_when: "No prose styleguide config exists and you want to create one based on the manuscript's existing conventions.",
866
+ steps: [
867
+ { tool: "describe_workflows", note: "Check context.scene_count; use that value as max_scenes in the next call." },
868
+ { tool: "bootstrap_prose_styleguide_config", note: "Detect dominant conventions. Confirm suggestions with the user before applying." },
869
+ { tool: "setup_prose_styleguide_config", note: "Create config at project_root scope if context.styleguide_exists.project_root is false. Requires language (e.g. 'english_us')." },
870
+ { tool: "update_prose_styleguide_config", note: "Apply the fields accepted from bootstrap suggestions." },
871
+ ],
872
+ },
873
+ {
874
+ id: "styleguide_drift_check",
875
+ label: "Styleguide drift check",
876
+ use_when: "A styleguide config exists and you want to check whether recent scenes conform to it.",
877
+ steps: [
878
+ { tool: "get_prose_styleguide_config", note: "Confirm the currently resolved config." },
879
+ { tool: "check_prose_styleguide_drift", note: "Detect non-conforming scenes. Pass project_id from context.project_id and set max_scenes from context.scene_count." },
880
+ { tool: "update_prose_styleguide_config", note: "If drift found and user approves, update config or note the outliers." },
881
+ ],
882
+ },
883
+ {
884
+ id: "manuscript_exploration",
885
+ label: "Manuscript exploration",
886
+ use_when: "Answering questions about the manuscript, finding scenes, or getting an overview.",
887
+ steps: [
888
+ { tool: "find_scenes", note: "Filter by character, beat, tag, part, chapter, or POV. No filters returns all scenes." },
889
+ { tool: "get_scene_prose", note: "Load prose for specific scenes identified by find_scenes." },
890
+ { tool: "get_chapter_prose", note: "Load all prose for a chapter. Use sparingly — large chapters can overflow context." },
891
+ { tool: "search_metadata", note: "Full-text search across scene metadata fields." },
892
+ ],
893
+ },
894
+ {
895
+ id: "prose_editing",
896
+ label: "Prose editing",
897
+ use_when: "Revising scene prose. All edits require explicit user confirmation before writing.",
898
+ steps: [
899
+ { tool: "find_scenes", note: "Identify the target scene." },
900
+ { tool: "get_scene_prose", note: "Load the current prose." },
901
+ { tool: "propose_edit", note: "Stage a revision; returns a diff preview and a proposal_id." },
902
+ { tool: "commit_edit", note: "Write the revision after the user confirms. Runs preflight checks before writing." },
903
+ { tool: "discard_edit", note: "Reject the revision if the user does not approve." },
904
+ ],
905
+ },
906
+ {
907
+ id: "character_management",
908
+ label: "Character management",
909
+ use_when: "Finding characters, reading their sheets, or updating character details.",
910
+ steps: [
911
+ { tool: "list_characters", note: "Find character_id values." },
912
+ { tool: "get_character_sheet", note: "Read full character details." },
913
+ { tool: "create_character_sheet", note: "Create a new character. Requires exactly one of project_id or universe_id." },
914
+ { tool: "update_character_sheet", note: "Edit character metadata." },
915
+ ],
916
+ },
917
+ {
918
+ id: "place_management",
919
+ label: "Place management",
920
+ use_when: "Finding locations, reading place sheets, or updating place details.",
921
+ steps: [
922
+ { tool: "list_places", note: "Find place_id values." },
923
+ { tool: "get_place_sheet", note: "Read full place details." },
924
+ { tool: "create_place_sheet", note: "Create a new place. Requires exactly one of project_id or universe_id." },
925
+ { tool: "update_place_sheet", note: "Edit place metadata." },
926
+ ],
927
+ },
928
+ {
929
+ id: "review_bundle",
930
+ label: "Review bundle",
931
+ use_when: "Preparing a formatted bundle for human review (outline, editorial, or beta read profile).",
932
+ steps: [
933
+ { tool: "preview_review_bundle", note: "Check which scenes would be included and the estimated size. Requires project_id and profile." },
934
+ { tool: "create_review_bundle", note: "Generate the bundle. Requires project_id." },
935
+ ],
936
+ },
937
+ {
938
+ id: "async_job_tracking",
939
+ label: "Async job tracking",
940
+ use_when: "A tool returned a job_id instead of an immediate result (e.g. import_scrivener_sync_async).",
941
+ steps: [
942
+ { tool: "get_async_job_status", note: "Poll with the job_id until status is 'completed' or 'failed'." },
943
+ { tool: "sync", note: "Call after a completed job that modified files on disk." },
944
+ ],
945
+ },
946
+ ];
947
+
852
948
  // ---------------------------------------------------------------------------
853
949
  // MCP server factory
854
950
  // ---------------------------------------------------------------------------
855
951
  function createMcpServer() {
856
952
  const s = new McpServer({ name: "mcp-writing", version: MCP_SERVER_VERSION });
857
953
 
954
+ // ---- describe_workflows --------------------------------------------------
955
+ s.tool(
956
+ "describe_workflows",
957
+ "Return a map of available task workflows and the current project context. Call this at the start of a session or whenever you are unsure what to do next. Never write scripts to invoke tools — call them directly.",
958
+ {},
959
+ async () => {
960
+ const projectRow = db.prepare(
961
+ `SELECT project_id FROM scenes GROUP BY project_id ORDER BY COUNT(*) DESC, project_id ASC LIMIT 1`
962
+ ).get();
963
+ const project_id = projectRow?.project_id ?? null;
964
+
965
+ const sceneCountRow = db.prepare(`SELECT COUNT(*) as count FROM scenes`).get();
966
+ const scene_count = sceneCountRow?.count ?? 0;
967
+
968
+ const syncRootConfigPath = path.join(SYNC_DIR, STYLEGUIDE_CONFIG_BASENAME);
969
+ const projectRootConfigPath = project_id
970
+ ? path.join(resolveProjectRoot(project_id), STYLEGUIDE_CONFIG_BASENAME)
971
+ : null;
972
+ const universeSegment = project_id?.includes("/") ? project_id.split("/")[0] : null;
973
+ const universeRootConfigPath = universeSegment
974
+ ? path.join(SYNC_DIR, "universes", universeSegment, STYLEGUIDE_CONFIG_BASENAME)
975
+ : null;
976
+
977
+ return jsonResponse({
978
+ ok: true,
979
+ context: {
980
+ project_id,
981
+ scene_count,
982
+ sync_dir: SYNC_DIR_ABS,
983
+ styleguide_exists: {
984
+ sync_root: fs.existsSync(syncRootConfigPath),
985
+ universe_root: universeRootConfigPath !== null && fs.existsSync(universeRootConfigPath),
986
+ project_root: projectRootConfigPath !== null && fs.existsSync(projectRootConfigPath),
987
+ },
988
+ git_available: GIT_AVAILABLE,
989
+ pending_proposals: pendingProposals.size,
990
+ },
991
+ workflows: WORKFLOW_CATALOGUE,
992
+ notes: [
993
+ "Never write JavaScript or shell scripts to invoke tools. Call them directly.",
994
+ "If a tool returns a next_step field (in a success or error response), follow it before trying anything else.",
995
+ "Use find_scenes without filters to discover what project_ids are indexed.",
996
+ "When calling bootstrap_prose_styleguide_config or check_prose_styleguide_drift, set max_scenes to context.scene_count to avoid the default limit.",
997
+ ],
998
+ });
999
+ }
1000
+ );
1001
+
858
1002
  // ---- sync ----------------------------------------------------------------
859
1003
  s.tool("sync", "Re-scan the sync folder and update the scene/character/place index from disk. Call this after making edits in Scrivener or updating sidecar files outside the MCP.", {}, async () => {
860
1004
  const result = syncAll(db, SYNC_DIR, { writable: SYNC_DIR_WRITABLE });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanna84/mcp-writing",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "MCP service for AI-assisted reasoning and editing on long-form fiction projects",
5
5
  "type": "module",
6
6
  "main": "index.js",