mcpls
Copilot instructions75 starsChanged 11 months agoApache-2.0View on GitHub
mcpls is a bridge between MCP (Model Context Protocol) and LSP (Language Server Protocol). AI clients speak MCP to mcpls; mcpls spawns and communicates with language servers over LSP. Key crates: mcpls-core/src/bridge/, lsp/, mcp/, config/. Prefer newtypes over primitive aliases for domain values. A raw u32 for a line number and a raw u32 for a column are indistinguishable to the compiler; a Line(u32) and Column(u32) make transpositions a compile error. Encode protocol state in the type system where possible.…
In this repositoryOne other file it gives its agents.
- mcplsSkill
The file
We split this copilot-instructions.md into the rules it gives an agent
10 rules. About 0 are common, 0 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Prefer newtypes over primitive aliases for domain values.
- Very specific: line 22
Avoid stringly-typed dispatch.
- Very specific: line 31
Prefer iterator adapters over manual loops.
- Very specific: line 35
Avoid unnecessary heap allocation.
- Very specific: line 39
Use let-else (stabilised in Rust 1.65) to reduce nesting when early return on None or Err is needed:
- Very specific: line 68
Prefer tokio::join! or tokio::try_join!
- Very specific: line 75
Use tokio::sync::mpsc for async-to-async channels.
- Very specific: line 79
Prefer tokio::select! with a cancellation token over bare loop { recv().await } for background tasks that must shut down cleanly.
- Very specific: line 84
When reviewing code, check whether newer stable Rust APIs would simplify it.
- Very specific: line 97
When a dependency provides a feature already in std, prefer std.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for mcpls
mcpls is a bridge between MCP (Model Context Protocol) and LSP (Language Server Protocol). AI clients speak MCP to mcpls; mcpls spawns and communicates with language servers over LSP.
AI Client ←→ [MCP/stdio] ←→ mcpls ←→ [LSP/stdio] ←→ language serverKey crates: mcpls-core/src/bridge/, lsp/, mcp/, config/.
Type safety
Prefer newtypes over primitive aliases for domain values. A raw u32 for a line number
and a raw u32 for a column are indistinguishable to the compiler; a Line(u32) and
Column(u32) make transpositions a compile error.
Encode protocol state in the type system where possible. A document that has been opened and one that has not should ideally be different types, not the same type with a boolean field. Typestate prevents calling operations that are only valid on open documents.
Avoid stringly-typed dispatch. Matching on &str method names to branch protocol
behaviour should be replaced with a typed enum as soon as the set of methods is known
and bounded.
Option<T> and Result<T, E> must not be unwrapped with .unwrap() or .expect() in
production code paths. Use ?, if let, let-else, or explicit error mapping.
Idiomatic Rust
Prefer iterator adapters over manual loops. map, filter, flat_map, collect, and
fold express intent more clearly and are easier to compose than for with a mutable
accumulator.
Avoid unnecessary heap allocation. Prefer &str over String in function signatures
where ownership is not required. Prefer Cow<str> when a function sometimes borrows and
sometimes owns.
Use let-else (stabilised in Rust 1.65) to reduce nesting when early return on None
or Err is needed:
// prefer
let Some(value) = option else { return Err(...) };
// over
let value = match option { Some(v) => v, None => return Err(...) };Derive Clone, Debug, PartialEq on data types unless there is a specific reason not
to. Their absence makes testing harder and the omission is rarely intentional.
Architecture
A component that bridges two protocols (MCP and LSP) must not let either protocol's failure mode affect the other. LSP request timeouts must not stall MCP response delivery, and LSP push notifications must not block MCP request handling.
Shared mutable state must be scoped as narrowly as possible. A Mutex that guards a
large composite struct is a concurrency bottleneck; prefer separate locks for
independent sub-components (e.g. a cache and a client are independent).
A Mutex guard must never be held across an .await point that involves I/O. Doing so
holds the lock for the full duration of the network round-trip, blocking every other
task that needs the lock. Extract the guarded value before the .await or restructure
so the lock is released first.
Async
Prefer tokio::join! or tokio::try_join! over sequential .await chains when
operations are independent. Sequential awaits serialise work that could run concurrently.
Blocking operations (std::fs, std::thread::sleep, CPU-heavy loops) must not run on
the async executor. Use tokio::fs, tokio::time::sleep, or tokio::task::spawn_blocking
for work that would block a task for more than a few microseconds.
Use tokio::sync::mpsc for async-to-async channels. Use std::sync::mpsc::sync_channel
only for bridging a synchronous context to async, and always with try_send when the
intent is to drop events under backpressure — send blocks on a full channel.
Prefer tokio::select! with a cancellation token over bare loop { recv().await }
for background tasks that must shut down cleanly.
API currency and MSRV
When reviewing code, check whether newer stable Rust APIs would simplify it. If a
simpler or safer API was stabilised after the current rust-version in Cargo.toml,
suggest bumping MSRV and using the new API. Document the bump in CHANGELOG under
### Changed.
Examples of APIs worth adopting when MSRV permits:
let-elseexpressions (1.65) — replace verbosematch/unwrap_or_elsefor early returnstd::io::read_to_stringon aFilehandle (1.0, but pairing with.metadata()on the same handle closes TOCTOU windows — prefer over separatestat+open)OnceLock(1.70) — prefer overlazy_staticoronce_cellfor static initialisationis_some_and/is_none_or(1.70) — replacemap(|v| ...).unwrap_or(false)patternsIterator::array_chunks(nightly → stable tracking) — watch stabilisation status
When a dependency provides a feature already in std, prefer std. Fewer dependencies
reduce supply-chain risk and compile time.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

