Skip to content

Commit c02b90a

Browse files
committed
Merge OAuth 2.1 implementation with http-stream transport
- Resolved conflicts in .gitignore, package-lock.json, and sse/server.ts - Kept OAuth provider and methods (handleProtectedResourceMetadata, handleOAuthCallback) - Integrated PING_SSE_MESSAGE from remote - Merged both OAuth and http-stream features
2 parents 9456e0e + 0827bec commit c02b90a

Some content is hidden

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

48 files changed

+7263
-1115
lines changed

.cursor/rules/mcp-framework.mdc

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
We are in the mcp-framework , a typescript framework that allows construction of model context protocol (mcp) servers.
7+
We are implementing the new specification:
8+
<specification>Overview
9+
MCP provides a standardized way for applications to:
10+
11+
Share contextual information with language models
12+
Expose tools and capabilities to AI systems
13+
Build composable integrations and workflows
14+
The protocol uses JSON-RPC 2.0 messages to establish communication between:
15+
16+
Hosts: LLM applications that initiate connections
17+
Clients: Connectors within the host application
18+
Servers: Services that provide context and capabilities
19+
MCP takes some inspiration from the Language Server Protocol, which standardizes how to add support for programming languages across a whole ecosystem of development tools. In a similar way, MCP standardizes how to integrate additional context and tools into the ecosystem of AI applications.
20+
21+
Key Details
22+
Base Protocol
23+
JSON-RPC message format
24+
Stateful connections
25+
Server and client capability negotiation
26+
Features
27+
Servers offer any of the following features to clients:
28+
29+
Resources: Context and data, for the user or the AI model to use
30+
Prompts: Templated messages and workflows for users
31+
Tools: Functions for the AI model to execute</specification>
32+
33+
Here is an example of how a user creats an mcp server using mcp-framework as the library: <example>## src/tools/ExampleTool.ts
34+
35+
```ts
36+
import { MCPTool } from "mcp-framework";
37+
import { z } from "zod";
38+
39+
interface ExampleInput {
40+
message: string;
41+
}
42+
43+
class ExampleTool extends MCPTool<ExampleInput> {
44+
name = "example_tool";
45+
description = "An example tool that processes messages";
46+
47+
schema = {
48+
message: {
49+
type: z.string(),
50+
description: "Message to process",
51+
},
52+
};
53+
54+
async execute(input: ExampleInput) {
55+
return `Processed: ${input.message}`;
56+
}
57+
}
58+
59+
export default ExampleTool;
60+
```
61+
62+
## src/index.ts
63+
64+
```ts
65+
import { MCPServer } from "mcp-framework";
66+
67+
const server = new MCPServer({transport:{
68+
type:"http-stream",
69+
options:{
70+
port:1337,
71+
cors: {
72+
allowOrigin:"*"
73+
}
74+
}
75+
}});
76+
77+
server.start();
78+
79+
```
80+
81+
## package.json
82+
83+
```json
84+
{
85+
"name": "http2-hi",
86+
"version": "0.0.1",
87+
"description": "http2-hi MCP server",
88+
"type": "module",
89+
"bin": {
90+
"http2-hi": "./dist/index.js"
91+
},
92+
"files": [
93+
"dist"
94+
],
95+
"scripts": {
96+
"build": "tsc && mcp-build",
97+
"watch": "tsc --watch",
98+
"start": "node dist/index.js"
99+
},
100+
"dependencies": {
101+
"mcp-framework": "^0.2.12-beta.4",
102+
"zod": "^3.24.4"
103+
},
104+
"devDependencies": {
105+
"@types/node": "^20.11.24",
106+
"typescript": "^5.3.3"
107+
},
108+
"engines": {
109+
"node": ">=18.19.0"
110+
}
111+
}
112+
113+
```
114+
</example>
115+
116+
It's important to keep in mind that mcp-framework is used exclusively as a dependency in other repositories - just like express js would be.
117+
This means that we are running it from node_modules within the repo - this impacts how relative directories work

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
insert_final_newline = true

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
release-please:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: googleapis/release-please-action@v4
18+
with:
19+
config-file: '.release-please-config.json'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ coverage/
1313
*.swp
1414
*.swo
1515
*~
16+
.yalc
17+
yalc.lock

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"endOfLine": "auto"
8+
}

.release-please-config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"packages": {
3+
".": {
4+
"release-type": "node",
5+
"bump-minor-pre-major": true,
6+
"bump-patch-for-minor-pre-major": true,
7+
"changelog-path": "CHANGELOG.md",
8+
"pull-request-title-pattern": "chore: release ${version}"
9+
}
10+
}
11+
}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.2.15"
3+
}

CHANGELOG.md

Lines changed: 212 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2025] [Alexandr "Andru" Andrushevich]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)