diff --git a/.cursor/mcp.json b/.cursor/mcp.json new file mode 100644 index 0000000..6404d7c --- /dev/null +++ b/.cursor/mcp.json @@ -0,0 +1,17 @@ +{ + "mcpServers": { + "promptforge": { + "command": "cargo", + "args": [ + "run", + "--quiet", + "-p", + "promptforge-mcp-server", + "--", + "serve", + "--stdio", + "prompts.toml" + ] + } + } +} diff --git a/README.md b/README.md index 6148152..8e61844 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,16 @@ Interactive prompt work against an already-running gateway: cargo run -p promptforge-dev -- prompts/greet.md "world" --watch ``` +### Cursor + +This repo ships `.cursor/mcp.json`, which spawns `promptforge-mcp-server` over stdio using `prompts.toml`. For a local Ollama model, start the matching gateway (loopback password `whatever`, already set in both files): + +```bash +cargo run -p promptforge-gateway -- serve gateway.ollama.toml +``` + +Enable the **promptforge** MCP server in Cursor Settings → MCP. The harness then has four tools: `list_prompts`, `run_prompt`, `check_run`, and `need_prompt`. Ask the agent to list prompts or to run `hello`. + ![Gloves and sparks](images/banner-04.png) ## How it works diff --git a/gateway.ollama.toml b/gateway.ollama.toml new file mode 100644 index 0000000..510e928 --- /dev/null +++ b/gateway.ollama.toml @@ -0,0 +1,23 @@ +# Local Ollama backend. No vendor keys. Serve from the repo root: +# cargo run -p promptforge-gateway -- serve gateway.ollama.toml +# +# The loopback password is the literal `whatever`. The MCP server in +# prompts.toml uses the same string. Point `upstream` at `ollama list`. + +[server] +bind = "127.0.0.1:8081" +api_key = "whatever" + +[[endpoint]] +id = "ollama" +protocol = "openai" +base_url = "http://127.0.0.1:11434/v1" +api_key = "" + +[[model]] +name = "writer" +description = "A model suited for careful analysis, coding, and general assistance" +context = 8192 +thinking = "never" +upstream = "openhermes:latest" +endpoints = ["ollama"] diff --git a/prompts.toml b/prompts.toml index 2117c88..da8a5e0 100644 --- a/prompts.toml +++ b/prompts.toml @@ -16,16 +16,18 @@ api_key = "${PROMPTFORGE_MCP_SERVER_API_KEY}" [paths] prompts = "prompts" -# The prompts run against the same gateway the CLI uses; it holds the vendor key. +# The prompts run against the same gateway the CLI uses. The password is a +# local loopback bearer, not a vendor key; it must match [server].api_key in +# gateway.ollama.toml. [gateway] url = "http://127.0.0.1:8081/v1" -api_key = "${PROMPTFORGE_GATEWAY_API_KEY}" +api_key = "whatever" -# Live tools: both enabled here to preserve the development profile's behavior. -# A configuration with no [tools] section runs in a true sandbox. +# Fetch is local. Search needs a gateway [tools.web_search] provider; the +# Ollama profile does not ship one, so it stays off here. [tools] web_fetch = true -web_search = true +web_search = false # Everything written under prompts/ is available. `*` stops at a separator and # `**` crosses one, so `**/*.md` reaches a prompt in a subdirectory too. The