Commit Graph

727 Commits

Author SHA1 Message Date
cliffhall
0aeb8a794d [WIP] Refactor everything server to be more modular and use recommended APIs.
* Updated architecture.md

* Refactor/renamed resources/dynamic.ts to resources/template.ts
  - refactor/renamed registerDynamicResources to registerResourceTemplates
    - this highlights the more salient fact that we are demonstrating registration of resource templates in this example.
  - exposed the ability to dynamically create the text resources from elsewhere (namely the resource-prompt example

* Added prompts/resource.ts
  - in registerEmbeddedResourcePrompt()
    - register a prompt that takes a resourceId and returns the prompt with the corresponding dynamically created resource embedded
2025-12-06 12:50:09 -05:00
cliffhall
743529180e [WIP] Refactor everything server to be more modular and use recommended APIs.
* Updated architecture.md

* Refactor / renamed uris from test://X/resource/Y to demo://resource/X/Y
2025-12-05 18:54:30 -05:00
cliffhall
eee9866ebb [WIP] Refactor everything server to be more modular and use recommended APIs.
* Updated architecture.md

* Refactor / renamed all addXPrompt, addXTool, and addXResource functions to registerX...

* Added the add tool
2025-12-05 18:43:36 -05:00
cliffhall
d868b1c8ac [WIP] Refactor everything server to be more modular and use recommended APIs.
* Updated architecture.md
2025-12-05 16:22:59 -05:00
cliffhall
daec74fbc1 [WIP] Refactor everything server to be more modular and use recommended APIs.
* Adding prompts (simple, complex, with completions)

* Add prompts/simple.ts
  - in addSimplePrompt()
    - register a simple prompt with no arguments

* Add prompts/complex.ts
  - in addComplexPrompt()
    - define promptArgsSchema containing a required city arg of type string and an optional state arg of type state
    - register the complex prompt with a prompt callback that combines the city and state into a prompt asking for the weather in that location

* Add prompts/completions.ts
  - in addPromptWithCompletions()
    - define promptArgsSchema containing department and name string fields with completion handlers
    - register the completable prompt with a prompt callback that combines the inputs into a prompt asking to promote the selected name to head of the selected department

* Add prompts/index.ts
  - import addSimplePrompt, addComplexPrompt, and addPromptWithCompletions
  - export registerPrompts function
  - in registerPrompts()
    - call addSimplePrompt
    - call addComplexPrompt
    - call addPromptWithCompletions

* In package.json
  - add prettier devDependency
  - add prettier:check script
  - add prettier:fix script
  - in build script, copy docs folder to dist

* All other changes were prettier formatting
2025-12-05 16:09:35 -05:00
cliffhall
1c64b36c78 [WIP] Refactor everything server to be more modular and use recommended APIs.
* Adding static resources, move server instructions to
the new docs folder, and add code formatting

* Add docs folder

* Add docs/architecture.md which describes the architecture of the project thus far.

* Refactor moved instructions.md to docs/server-instructions.md

* Add resources/static.ts
  - in addStaticResources()
    - read the file entries from the docs folder
    - register each file as a resource (no template), with a readResource function that reads the file and returns it in a contents block with the appropriate mime type and contents
  - getMimeType helper function gets the mime type for a filename
  - readSafe helper function reads the file synchronously as utf-8 or returns an error string

* Add resources/index.ts
  - import addStaticResources
  - export registerResources function
  - in registerResources()
    - call addStaticResources

* In package.json
  - add prettier devDependency
  - add prettier:check script
  - add prettier:fix script
  - in build script, copy docs folder to dist

* All other changes were prettier formatting
2025-12-05 13:26:08 -05:00
cliffhall
8845118d61 [WIP] Refactor everything server to be more modular and use recommended APIs.
* Adding dynamic resources

* Add server/index.js
  - import registerResources from resources/index.js
  - in createServer()
    - call registerResources, passing server

* Add resources/dynamic.ts
  - in addDynamicResources()
    - define formatGmtTimestamp to create a time stamp to include in the resource text or encoded blob
    - define parseIndex to ensure the index variable of the URI is a number

* Add resources/index.ts
  - import addDynamicResources
  - export registerResources function
  - in registerResources()
    - call addDynamicResources

* In package.json
  - update the start commands to launch each of the transports properly
2025-12-04 19:01:18 -05:00
cliffhall
5de886ca63 [WIP] Refactor everything server to be more modular and use recommended APIs
In src/everything:

* Refactor / move streamableHttp.ts, sse.ts, and stdio.ts to transports/

* Move everything.ts to server/ for reference

* Add server/index.js
  - exports the createServer function
  - import registerTools from tools/index.js
  - in createServer()
    - read instructions.md and include in ServerOptions for McpServer constructor
    - construct McpServer instead of Server
    - call registerTools, passing server

* Add tools/echo.ts
  - define EchoSchema
  - define tool config
  - export addToolEcho function
  - in addToolEcho()
    - register handler for Echo tool

* Add tools/index.ts
  - import addToolEcho
  - export registerTools function
  - in registerTools()
    - call addToolEcho
2025-12-03 17:36:47 -05:00
dependabot[bot]
1c654a4e7d chore(deps): bump @modelcontextprotocol/sdk
Bumps the npm_and_yarn group with 1 update in the / directory: [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk).


Updates `@modelcontextprotocol/sdk` from 1.23.0 to 1.24.0
- [Release notes](https://github.com/modelcontextprotocol/typescript-sdk/releases)
- [Commits](https://github.com/modelcontextprotocol/typescript-sdk/compare/1.23.0...1.24.0)

---
updated-dependencies:
- dependency-name: "@modelcontextprotocol/sdk"
  dependency-version: 1.24.0
  dependency-type: direct:production
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-02 17:40:23 +00:00
dependabot[bot]
8dbea85ccf chore(deps): bump express in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 1 update in the / directory: [express](https://github.com/expressjs/express).


Updates `express` from 4.21.2 to 4.22.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.22.0/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.21.2...4.22.0)

---
updated-dependencies:
- dependency-name: express
  dependency-version: 4.22.0
  dependency-type: direct:production
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-01 22:17:03 +00:00
adam jones
d9929014d5 Add mcpName and repository fields for MCP registry (#3068)
Adds metadata required for registering servers in the MCP registry:

- NPM servers (everything, filesystem, memory, sequentialthinking):
  Added mcpName and repository fields to package.json

- PyPI servers (fetch, git, time):
  Added mcp-name comment to README.md

Part of #3047
2025-11-26 14:29:36 +00:00
dependabot[bot]
c017f44ee2 chore(deps): bump glob in the npm_and_yarn group across 1 directory (#3076)
Bumps the npm_and_yarn group with 1 update in the / directory: [glob](https://github.com/isaacs/node-glob).


Updates `glob` from 10.4.5 to 10.5.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v10.4.5...v10.5.0)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 10.5.0
  dependency-type: direct:production
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-26 13:18:16 +00:00
adam jones
3154518344 Update @modelcontextprotocol/sdk to 1.23.0 in TypeScript servers (#3065)
Update the SDK from ^1.19.1 to ^1.23.0 in all TypeScript reference servers:
- everything
- filesystem
- memory
- sequentialthinking

Also update everything server for SDK breaking changes:
- Update zod to ^3.25.0 (zod v4 compatibility)
- Fix ToolInput/ToolOutput types to use Tool["inputSchema"] instead of
  inferring from zod schemas
- Fix result.content handling to support array format

Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
2025-11-26 12:32:37 +00:00
Adam Jones
350ffeec01 Fix VS Code MCP documentation URLs
Update links to point to the new location at /docs/copilot/customization/mcp-servers
2025-11-25 22:11:56 +00:00
Adam Jones
78e0088ebd fix(fetch): update uv.lock to sync with pyproject.toml
The lockfile was out of sync because pyproject.toml was updated
(version bump to 0.6.3, httpx<0.28 constraint) but uv.lock wasn't
regenerated. This became a CI failure after switching from --frozen
to --locked in #1852.
2025-11-25 21:52:09 +00:00
Nick Pape
76dcff0617 Fix a lifecycle bug with server everything in stdio mode (#2848) 2025-11-25 21:50:31 +00:00
UmakanthKaspa
2f93d3c717 Add comprehensive tests for git server functions (#2970)
- Add tests for git_diff_unstaged, git_diff_staged, and git_diff
- Add tests for git_commit and git_reset operations
- Add tests for git_log with different parameters
- Add tests for git_create_branch with base branch support
- Add tests for git_show including initial commit edge case
- Achieve 100% test coverage of git server functions (12/12)
- All 23 tests pass with 0 errors
2025-11-25 21:43:09 +00:00
Eugene Mwangi
9758f34d36 chore(uv): Prefer --locked for dependency sync (#1852)
Adopt uv best practice for dependency synchronization.

[Note]
- (uv sync --frozen) proceeds with an out-dated lockfile.
  This could lead to inconsistencies.

[Docs]
See: https://docs.astral.sh/uv/concepts/projects/sync/#locking-and-syncing
2025-11-25 21:36:35 +00:00
Koichi ITO
902eed6fbf fix(sequential-thinking): Fix a typo for nextThoughtNeeded (#3010)
This PR fixes the `nextThoughtNeeded` parameter that was missed in #3004.
2025-11-25 21:04:30 +00:00
Alessio Pelliccione
fcb451ad62 docs: add CODEX CLI installation for sequential-thinking (#2956)
* docs: add CODEX CLI installation

* fix: command syntax in README for npx usage
2025-11-25 20:37:55 +00:00
Christoph Blecker
99813ce5c9 Update gitpython library for git mcp server (#2948)
* bump: gitpython dependency from 3.1.43 to 3.1.45

* test: use default branch name instead of hardcoding 'master'

* fix: handle d.diff as string in GitPython 3.1.45+
2025-11-25 20:35:33 +00:00
Valeriy Pavlovich
84c2824f03 # feat(filesystem): add ToolAnnotations hints to filesystem tools (#3045)
**Files touched**

- [src/filesystem/index.ts](../blob/HEAD/src/filesystem/index.ts) — add `annotations` metadata to each tool definition
- [src/filesystem/README.md](../blob/HEAD/src/filesystem/README.md) — document ToolAnnotations mapping for all filesystem tools

## Description

This change adds MCP `ToolAnnotations` (`readOnlyHint`, `idempotentHint`, `destructiveHint`) to all filesystem tools and documents the mapping in the filesystem README. MCP clients can now accurately distinguish read‑only vs. write tools, understand which operations are safe to retry, and highlight potentially destructive actions.

## Server Details

- **Server**: filesystem
- **Area**: tools (metadata returned via `listTools` / `ListToolsRequest`) and server docs

## Motivation and Context

Previously, the filesystem server did not expose ToolAnnotations, so many clients (e.g. ChatGPT Apps) conservatively treated filesystem tools as generic write operations. This led to:

- READ operations being surfaced with WRITE badges and confirmation prompts.
- No way for clients to know which write tools are idempotent or potentially destructive.

This PR aligns the implementation with `servers#2988` and updates the README to clearly document the semantics of each tool. Read‑only operations no longer need to be treated as writes, and destructive/idempotent behavior is explicit for UI and retry logic.

## How Has This Been Tested?

- `npm run build --workspace @modelcontextprotocol/server-filesystem`
- `npm test --workspaces --if-present`

## Breaking Changes

None.

## Types of changes

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [x] Documentation update

## Checklist

- [x] I have read the [MCP Protocol Documentation](https://modelcontextprotocol.io)
- [x] My changes follows MCP security best practices
- [x] I have updated the server's README accordingly
- [x] I have tested this with an LLM client
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [ ] I have documented all environment variables and configuration options

## Additional context

None.

Co-authored-by: Valeriy_Pavlovich <vp@strato.space>
2025-11-24 15:58:15 +00:00
Adam Jones
3f2ddb0479 fix: simplify output schemas for text-only tools and add structuredContent
For text-only tool responses, simplify outputSchemas from complex nested
arrays to simple { content: z.string() } format. All tool responses now
include structuredContent matching their outputSchema, fixing MCP protocol
violations when tools had output schemas but no structured content.

This applies to both filesystem and everything servers.
2025-11-20 21:44:36 +00:00
adam jones
55c3a31690 fix(filesystem): address review feedback from #3016 (#3031)
Address two items from Camila's review:

1. Use blob type for non-image/non-audio media files, restoring the
   original behavior. This matches the previous implementation which
   used blob as the fallback for unknown binary types. Use type
   assertion to satisfy the SDK's type constraints.

2. Reuse ReadTextFileArgsSchema.shape in the deprecated read_file tool
   instead of redefining the schema inline.
2025-11-20 20:29:22 +00:00
adam jones
b84637314f fix(memory): convert to modern TypeScript SDK APIs (#3015)
* fix(memory): convert to modern TypeScript SDK APIs

Convert the memory server to use the modern McpServer API instead of
the low-level Server API.

Key changes:
- Replace Server with McpServer from @modelcontextprotocol/sdk/server/mcp.js
- Convert all 9 tools to use registerTool() instead of manual request handlers
- Create reusable Zod schemas for Entity and Relation types
- Use Zod schemas directly in inputSchema/outputSchema
- Add structuredContent to all tool responses
- Fix type literals to use 'as const' assertions

The modern API provides:
- Less boilerplate code (removed ~200 lines of schema definitions)
- Better type safety with Zod
- More declarative tool registration
- Cleaner, more maintainable code

* fix: exclude test files from TypeScript build

Add exclude for test files and vitest.config.ts to tsconfig
2025-11-20 19:09:44 +00:00
adam jones
88a2ac4360 fix(sequential-thinking): convert to modern TypeScript SDK APIs (#3014)
* fix(sequential-thinking): convert to modern TypeScript SDK APIs

Convert the sequential-thinking server to use the modern McpServer API
instead of the low-level Server API.

Key changes:
- Replace Server with McpServer from @modelcontextprotocol/sdk/server/mcp.js
- Use registerTool() method instead of manual request handlers
- Use Zod schemas directly in inputSchema/outputSchema
- Add structuredContent to tool responses
- Fix type literals to use 'as const' assertions

The modern API provides:
- Less boilerplate code
- Better type safety with Zod
- More declarative tool registration
- Cleaner, more maintainable code

* fix: exclude test files from TypeScript build

Add exclude for test files and vitest.config.ts to tsconfig

* refactor: remove redundant validation now handled by Zod

Zod schema already validates all required fields and types. Removed
validateThoughtData() method and kept only business logic validation
(adjusting totalThoughts if needed).

* fix(sequentialthinking): add Zod validation to processThought method

The modern API migration removed manual validation from processThought(),
but tests call this method directly, bypassing the Zod validation in the
tool registration layer. This commit adds Zod validation directly in the
processThought() method to ensure validation works both when called via
MCP and when called directly (e.g., in tests).

Also improves error message formatting to match the expected error
messages in the tests.

* refactor: simplify by removing redundant validation

Since processThought() is only called through the tool registration in
production, validation always happens via Zod schemas at that layer.
Removed redundant validation logic from processThought() and updated
tests to reflect this architectural decision.

Changes:
- Remove Zod validation from processThought() method
- Accept ThoughtData type instead of unknown
- Remove 10 validation tests that are now handled at tool registration
- Add comment explaining validation approach
2025-11-20 19:05:30 +00:00
adam jones
4dc24cf349 fix(filesystem): convert to modern TypeScript SDK APIs (#3016)
* fix(filesystem): convert to modern TypeScript SDK APIs

Convert the filesystem server to use the modern McpServer API instead
of the low-level Server API.

Key changes:
- Replace Server with McpServer from @modelcontextprotocol/sdk/server/mcp.js
- Convert all 13 tools to use registerTool() instead of manual request handlers
- Use Zod schemas directly in inputSchema/outputSchema
- Add structuredContent to all tool responses
- Fix type literals to use 'as const' assertions
- Update roots protocol handling to use server.server.* pattern
- Fix tsconfig to exclude vitest.config.ts

Tools converted:
- read_file (deprecated)
- read_text_file
- read_media_file
- read_multiple_files
- write_file
- edit_file
- create_directory
- list_directory
- list_directory_with_sizes
- directory_tree
- move_file
- search_files
- get_file_info
- list_allowed_directories

The modern API provides:
- Less boilerplate code
- Better type safety with Zod
- More declarative tool registration
- Cleaner, more maintainable code

* fix: use default import for minimatch

minimatch v10+ uses default export instead of named export

* fix(filesystem): use named import for minimatch

The minimatch module doesn't have a default export, so we need to use
the named import syntax instead.

Fixes TypeScript compilation error:
error TS2613: Module has no default export. Did you mean to use
'import { minimatch } from "minimatch"' instead?
2025-11-20 17:00:04 +00:00
jnick26
6dda92b77b fix(sequential-thinking): Keep case of json params and description same
Models are confused about the case of the variables, which results into random validation errors. Keeping them the same helps to remove back and forth.
2025-11-15 12:58:40 +02:00
UmakanthKaspa
5556c3a0f4 Fix git_create_branch parameter documentation
Changed incorrect 'start_point' to correct 'base_branch' parameter.
The documented parameter didn't match the actual code implementation.
2025-11-09 17:16:53 +09:00
UmakanthKaspa
2c8bb9d8f7 Merge branch 'main' into add-git-status-test 2025-11-08 20:34:26 +05:30
UmakanthKaspa
4225ab46e1 Add test for git_status function
Adds test coverage for the previously untested git_status function.
  The test verifies that the function returns valid git status output
  containing branch information.
2025-11-06 16:58:07 +00:00
Sanghee Son
bd39b09e4c fix: exclude test files from filesystem build
test files were being compiled into dist during build,
causing issues in docker environments. added exclude
pattern to tsconfig to skip __tests__ directory.

fixes #2928
2025-10-31 16:33:22 +09:00
olaservo
c3b26fad30 Fix platform-dependent relative path test in filesystem
The test was expecting forward slashes to always be converted to backslashes, but normalizePath() only does this on Windows (process.platform === 'win32'). On Linux/Unix, forward slashes are preserved.

Improved the fix by:
1. Removing relative path assertion from the "as is" test since it doesn't match intent
2. Adding a dedicated test that validates platform-specific behavior naturally without mocking
3. Using the actual platform instead of unreliable Object.defineProperty mocking

This approach is more reliable and clearly documents expected behavior per platform.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 21:27:13 -07:00
olaservo
bbbc0c6381 Fix TypeScript error in filesystem tests by adding missing afterEach import
The afterEach function was used in the test file but not imported from vitest, causing a build failure. This was introduced in PR #2851.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 21:06:25 -07:00
olaservo
f6fff0374e Merge branch 'main' of https://github.com/modelcontextprotocol/servers into update-tests-and-markdown-files 2025-10-28 21:05:20 -07:00
olaservo
e68a555943 Add Vitest testing framework and implement tests for memory management features 2025-10-28 20:06:34 -07:00
Ola Hungerford
d2eb945c4d Merge pull request #2851 from olaservo/fix-wsl-path-conversion
Resolve filesystem issue where WSL paths are incorrectly converted to Windows format
2025-10-28 18:56:58 -07:00
Ola Hungerford
7fc3d2debd Merge pull request #2565 from modelcontextprotocol/claude/issue-65-20250817-1645
docs(fetch): Add Windows PYTHONIOENCODING configuration
2025-10-28 18:53:24 -07:00
Cliff Hall
07eaef78ed Merge branch 'main' into update-test-framework-to-vitest 2025-10-21 17:31:33 -04:00
Ola Hungerford
ed4b36b6d5 Merge branch 'main' into fix-wsl-path-conversion 2025-10-19 11:45:07 -07:00
olaservo
b666e7f246 Migrate sequentialthinking and filesystem servers from Jest to Vitest
- Replace Jest dependencies with Vitest and @vitest/coverage-v8
- Update test scripts to use 'vitest run --coverage'
- Create vitest.config.ts for both servers with node environment and coverage settings
- Update all test files:
  - Change imports from '@jest/globals' to 'vitest'
  - Replace jest.mock() with vi.mock()
  - Replace jest.fn() with vi.fn()
  - Update mock clearing/restoring to use vi methods
- Remove jest.config.cjs files
- All 151 tests passing (24 in sequentialthinking, 127 in filesystem)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 11:21:58 -07:00
Ola Hungerford
78af9ddffb Merge branch 'main' into claude/issue-2361-20250817-1626 2025-10-19 07:45:22 -07:00
Ola Hungerford
a317804199 Merge pull request #2850 from olaservo/add-sequentialthinking-tests-update-sdk
Add Sequential Thinking tests and update TypeScript SDK versions
2025-10-19 07:30:55 -07:00
Olivier Chafik
61fe1104ee Port PR #17 elicitation improvements to everything server
This commit ports the comprehensive elicitation field type demonstration
from modelcontextprotocol/example-remote-server PR #17 to the everything
server, while maintaining the better UX of the existing implementation.

Changes:
- Expanded elicitation schema to demonstrate 9 field types:
  * string (plain and with default values)
  * boolean
  * email (format: "email")
  * uri (format: "uri")
  * date (format: "date")
  * integer (with min/max and default)
  * number (with min/max and default)
  * enum with enumNames for human-readable labels
- Added required fields support (name field is required)
- Added 10-minute timeout to elicitation request
- Improved response handling to dynamically show all provided fields
- Updated tool description to reflect comprehensive field type support
- Removed unused requestElicitation helper function (inlined implementation)
- Removed unused ElicitRequest import

The implementation follows PR #17's approach of directly using
extra.sendRequest() while preserving the user-friendly response handling
with emojis and formatted output from the original implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-16 19:13:33 +01:00
olaservo
c9b0135aa5 fix: preserve WSL paths and improve path normalization logic 2025-10-12 19:59:22 -07:00
olaservo
636b0872cb chore: add cors dependency to package.json 2025-10-12 18:22:08 -07:00
olaservo
f6fbfc4c5e Merge remote-tracking branch 'upstream/main' into add-sequentialthinking-tests-update-sdk 2025-10-12 18:09:41 -07:00
cliffhall
23b8279aaa Do not initiate sampling on resource subscription.
* In everything.ts
  - remove the automatic sampling call in the resource handler for SubscribeRequestSchema
2025-10-10 16:05:26 -04:00
Olivier Chafik
d6e218d0f8 Update everything.ts 2025-10-08 17:53:52 +01:00
Olivier Chafik
232258426e add zip tool to everything server (demonstrates consuming and producing URIs, incl. data URIs) 2025-10-08 17:44:24 +01:00