You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an auth-less Model Context Protocol (MCP) server designed to run on Cloudflare Workers. It provides MCP tools that allow AI assistants or other clients to discover and retrieve AI coding rules defined within the server. The rules are loaded from a `preparedRules.json` file.
6
7
7
8
This server acts as a backend component, enabling integrations that require dynamic access to specific coding guidelines or standards.
8
9
9
-
## 2. Tech Stack
10
-
11
-
-**Runtime**: Cloudflare Workers
12
-
-**Language**: TypeScript
13
-
-**Core Dependencies**:
14
-
-`@modelcontextprotocol/sdk`: For implementing MCP server logic.
15
-
-`zod`: For data validation (tool inputs/outputs).
16
-
-`agents`: (Usage details depend on implementation in `src/index.ts`)
17
-
-**Development & Deployment**:
18
-
-`wrangler`: Cloudflare's CLI for developing and deploying Workers.
19
-
-**Linting & Formatting**:
20
-
-`biome`: Used for code formatting and linting.
21
-
22
-
## 3. Getting Started Locally
23
-
24
-
### Prerequisites
25
-
26
-
- Node.js (Check `.nvmrc` or project specifics for version)
27
-
- npm (or yarn, pnpm)
28
-
- Wrangler CLI: `npm install -g wrangler`
29
-
30
-
### Setup & Running
31
-
32
-
1.**Clone the repository** (if you haven't already).
33
-
2.**Generate the rules json summary**:
34
-
```bash
35
-
npm run generate-rules
36
-
```
37
-
3. **Navigate to the server directory**:
38
-
```bash
39
-
cd mcp-server
40
-
```
41
-
3. **Install dependencies**:
42
-
```bash
43
-
npm install
44
-
```
45
-
4. **Run the development server**:
46
-
```bash
47
-
npm run dev
48
-
```
49
-
or
50
-
```bash
51
-
npm start
52
-
```
53
-
The server will typically be available at `http://localhost:8787`. The MCP endpoint is usually `/sse` (e.g., `http://localhost:8787/sse`).
54
-
55
-
## 4. Available Scripts
56
-
57
-
The following scripts are available via `npm run <script_name>`:
58
-
59
-
- `dev`: Starts the server locally using Wrangler for development, with live reloading.
60
-
- `start`: An aliasfor`dev`.
61
-
- `deploy`: Deploys the server to your configured Cloudflare Workers environment using Wrangler.
62
-
- `format`: Formats the codebase using Biome.
63
-
- `lint:fix`: Lints the code using Biome and attempts to automatically fix issues.
64
-
- `cf-typegen`: Generates TypeScript types for Cloudflare environment bindings (like KV namespaces, Durable Objects, etc., if configured).
65
-
66
-
## 5. Project Scope & Functionality
10
+
## 2. Project Scope & Functionality
67
11
68
12
-**MCP Implementation**: Adheres to the Model Context Protocol standard.
69
13
-**Cloudflare Worker**: Designed to be deployed and run efficiently on the Cloudflare edge network.
-**Auth-less**: Does not implement user authentication for accessing tools.
71
16
-**Rule Management Tools**: Provides the following MCP tools (defined in `src/tools/rulesTools.ts`):
72
17
-`listAvailableRules`: Returns a list of available rule libraries/sets, including their identifiers, names, and hierarchical stack (category). Reads data from `preparedRules.json` via `src/data/rulesProvider.ts`.
73
18
-`getRuleContent`: Takes a library identifier and returns the specific set of rules associated with it. Reads data from `preparedRules.json` via `src/data/rulesProvider.ts`.
74
19
-**(Potential) Tool Customization**: The original template README mentioned customizing tools in `src/index.ts`. Refer to that file for details on adding or modifying tools.
75
20
76
-
## 6. Using the MCP Server
21
+
## 3. Using the MCP Server
77
22
78
23
### Production Usage (Recommended)
79
24
@@ -121,7 +66,7 @@ After configuring, restart your editor. The `listAvailableRules` and `getRuleCon
121
66
122
67
This setup is useful for developing or modifying the MCP server itself.
123
68
124
-
**Endpoint:** `http://localhost:8787/sse` (available after running `npm run dev` in the `mcp-server` directory, see Section 3).
69
+
**Endpoint:** `http://localhost:8787/sse` (available after running `npm run dev` in the `mcp-server` directory, see Section 5).
125
70
126
71
**Connecting Clients:**
127
72
@@ -131,19 +76,81 @@ This setup is useful for developing or modifying the MCP server itself.
131
76
132
77
Use the **MCP Inspector** pointed at the local URL (`http://localhost:8787/sse`) to debug tool calls during development.
133
78
79
+
## 4. Tech Stack
80
+
81
+
- **Runtime**: Cloudflare Workers
82
+
- **Language**: TypeScript
83
+
- **Core Dependencies**:
84
+
- `@modelcontextprotocol/sdk`: For implementing MCP server logic.
85
+
- `zod`: For data validation (tool inputs/outputs).
86
+
- `agents`: (Usage details depend on implementation in `src/index.ts`)
87
+
- **Development & Deployment**:
88
+
- `wrangler`: Cloudflare's CLI for developing and deploying Workers.
89
+
- **Linting & Formatting**:
90
+
- `biome`: Used for code formatting and linting.
91
+
92
+
## 5. Getting Started Locally
93
+
94
+
### Prerequisites
95
+
96
+
- Node.js (Check `.nvmrc` or project specifics for version)
97
+
- npm (or yarn, pnpm)
98
+
- Wrangler CLI: `npm install -g wrangler`
99
+
100
+
### Setup & Running
101
+
102
+
1. **Clone the repository** (if you haven't already).
103
+
2. **Generate the rules json summary**:
104
+
```bash
105
+
npm run generate-rules
106
+
```
107
+
3. **Navigate to the server directory**:
108
+
```bash
109
+
cd mcp-server
110
+
```
111
+
4. **Install dependencies**:
112
+
```bash
113
+
npm install
114
+
```
115
+
5. **Run the development server**:
116
+
```bash
117
+
npm run dev
118
+
```
119
+
or
120
+
```bash
121
+
npm start
122
+
```
123
+
The server will typically be available at `http://localhost:8787`. The MCP endpoint is usually `/sse` (e.g., `http://localhost:8787/sse`).
124
+
125
+
## 6. Available Scripts
126
+
127
+
The following scripts are available via `npm run <script_name>`:
128
+
129
+
- `dev`: Starts the server locally using Wrangler for development, with live reloading.
130
+
- `start`: An alias for `dev`.
131
+
- `deploy`: Deploys the server to your configured Cloudflare Workers environment using Wrangler.
132
+
- `format`: Formats the codebase using Biome.
133
+
- `lint:fix`: Lints the code using Biome and attempts to automatically fix issues.
134
+
- `cf-typegen`: Generates TypeScript types for Cloudflare environment bindings (like KV namespaces, Durable Objects, etc., if configured).
135
+
134
136
## 7. Deployment
135
137
136
-
This project uses GitHub Actions for CI/CD, defined in `.github/workflows/test-deploy.yml`. The workflow handles:
138
+
This project uses GitHub Actions for Continuous Integration and Continuous Deployment (CI/CD).
139
+
140
+
The production deployment of the MCP server is handled by the workflow defined in `.github/workflows/deploy-mcp-on-merge.yml`. This workflow is triggered automatically on pushes to the `master` branch.
141
+
142
+
The key steps in the deployment process are:
137
143
138
-
1. **Linting:** Checks the code style of the main application (`npm run lint:check`).
139
-
2. **Unit Testing:** Runs unit tests for the main application (`npm run test`).
140
-
3. **Building Astro:** Builds the frontend Astro application (`npm run build`).
141
-
4. **Deploying Astro App:** Deploys the built Astro frontend to Cloudflare Pages (`cloudflare/wrangler-action`).
142
-
5. **Generating Rules:** Creates the `preparedRules.json` file needed by the MCP server (`npm run generate-rules`).
143
-
6. **Installing Worker Dependencies:** Installs dependencies specifically for the MCP server (`cd mcp-server && npm ci`).
144
-
7. **Deploying Worker:** Deploys the `mcp-server` as a Cloudflare Worker using Wrangler (`cd mcp-server && npx wrangler deploy`).
144
+
1. **Checkout Repository:** Fetches the latest code from the `master` branch.
145
+
2. **Set up Node.js:** Configures the correct Node.js version using `.nvmrc`.
146
+
3. **Install Root Dependencies:** Installs necessary dependencies defined in the root `package-lock.json`.
147
+
4. **Generate Rules:** Runs `npm run generate-rules` to create the `preparedRules.json` file required by the server.
148
+
5. **Install Worker Dependencies:** Installs dependencies specific to the MCP server located in the `mcp-server` directory.
149
+
6. **Deploy Worker:** Uses the `cloudflare/wrangler-action` to deploy the `mcp-server` to the production Cloudflare Workers environment.
145
150
146
-
Deployment is triggered automatically on pushes to the `mcp-server` branch. Necessary Cloudflare secrets (`CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID`) must be configured in the GitHub repository settings.
151
+
For the deployment to succeed, the following secrets must be configured in the GitHub repository settings for the `production` environment:
152
+
- `CLOUDFLARE_WORKER_TOKEN`: An API token with permissions to deploy Cloudflare Workers.
153
+
- `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare account ID.
147
154
148
155
## 8. Planned Features
149
156
@@ -154,9 +161,9 @@ The following features are planned for future development:
154
161
155
162
## 9. Project Status
156
163
157
-
- **Version**: `0.0.0` (as per `package.json`)
158
-
- **Status**: Assumed to be under active development.
164
+
- **Version**: `0.0.1` (as per `package.json`)
165
+
- **Status**: Initial development.
159
166
160
167
## 10. License
161
168
162
-
The license forthis project is not specifiedin the `
0 commit comments